@docsvision/material-ui-pickers 3.2.0-beta.26 → 3.2.0-beta.28
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}/DatePickerToolbar.js +3 -3
- package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.d.ts +2 -2
- package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.js +2 -2
- package/{build/DateTimePicker → DateTimePicker}/DateTimePickerToolbar.js +4 -4
- package/{build/MuiPickersUtilsProvider.d.ts → MuiPickersUtilsProvider.d.ts} +1 -1
- package/{build/Picker → Picker}/Picker.d.ts +3 -3
- package/{build/Picker → Picker}/Picker.js +1 -1
- package/{build/Picker → Picker}/WrappedPurePicker.js +2 -1
- package/{build/TimePicker → TimePicker}/TimePicker.d.ts +4 -2
- package/{build/TimePicker → TimePicker}/TimePicker.js +2 -2
- 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/{build/_helpers → _helpers}/text-field-helper.js +1 -1
- package/{build/_helpers → _helpers}/time-utils.d.ts +2 -2
- package/{build/_shared → _shared}/WithUtils.d.ts +1 -1
- package/{build/_shared → _shared}/hooks/useKeyboardPickerState.js +1 -1
- package/{build/_shared → _shared}/hooks/useUtils.d.ts +2 -2
- package/{build/dist → dist}/material-ui-pickers.esm.js +1187 -834
- package/dist/material-ui-pickers.esm.js.map +1 -0
- package/{build/dist → dist}/material-ui-pickers.js +1187 -834
- package/dist/material-ui-pickers.js.map +1 -0
- package/{build/dist → dist}/material-ui-pickers.umd.js +1178 -825
- package/dist/material-ui-pickers.umd.min.js +1 -0
- package/{build/index.d.ts → index.d.ts} +11 -11
- package/package.json +62 -135
- package/{build/typings → typings}/BasePicker.d.ts +1 -1
- package/{build/views → views}/Calendar/Calendar.js +1 -1
- package/{build/views → views}/Calendar/CalendarHeader.js +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/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/9db1cba1a61cb58db53f38425bbd1f95.7z +0 -0
- package/build/_helpers/text-field-helper.d.ts +0 -32
- 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 -62
- package/copy.js +0 -58
- package/remove-prop-types.js +0 -37
- package/rollup.config.js +0 -145
- 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 -275
- package/src/Picker/WrappedKeyboardPicker.tsx +0 -136
- package/src/Picker/WrappedPurePicker.tsx +0 -128
- package/src/Rifm/Rifm.ts +0 -213
- 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 -239
- package/src/_helpers/time-utils.ts +0 -83
- package/src/_helpers/utils.ts +0 -8
- package/src/_shared/KeyboardDateInput.tsx +0 -161
- 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 -134
- 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 -60
- package/src/typings/date.ts +0 -3
- package/src/typings/extendMui.ts +0 -10
- package/src/typings/overrides.ts +0 -44
- package/src/views/Calendar/Calendar.tsx +0 -361
- 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}/DatePicker.d.ts +0 -0
- /package/{build/DatePicker → DatePicker}/DatePicker.js +0 -0
- /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/MuiPickersUtilsProvider.js → MuiPickersUtilsProvider.js} +0 -0
- /package/{build/Picker → Picker}/WrappedKeyboardPicker.d.ts +0 -0
- /package/{build/Picker → Picker}/WrappedKeyboardPicker.js +0 -0
- /package/{build/Picker → Picker}/WrappedPurePicker.d.ts +0 -0
- /package/{build/README.md → README.md} +0 -0
- /package/{build/Rifm → Rifm}/Rifm.d.ts +0 -0
- /package/{build/Rifm → Rifm}/Rifm.js +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}/KeyboardDateInput.d.ts +0 -0
- /package/{build/_shared → _shared}/KeyboardDateInput.js +0 -0
- /package/{build/_shared → _shared}/ModalDialog.d.ts +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}/PureDateInput.js +0 -0
- /package/{build/_shared → _shared}/ToolbarButton.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/useIsLandscape.js +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/useKeyboardPickerState.d.ts +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/usePickerState.d.ts +0 -0
- /package/{build/_shared → _shared}/hooks/usePickerState.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/constants → constants}/prop-types.js +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.d.ts +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/Clock.d.ts +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.d.ts +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,113 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import ModalDialog from '../_shared/ModalDialog';
|
|
4
|
-
import { Omit } from '@material-ui/core';
|
|
5
|
-
import { WrapperProps } from './Wrapper';
|
|
6
|
-
import { useKeyDown } from '../_shared/hooks/useKeyDown';
|
|
7
|
-
import { DialogProps as MuiDialogProps } from '@material-ui/core/Dialog';
|
|
8
|
-
|
|
9
|
-
export interface ModalWrapperProps<T = {}> extends WrapperProps<T> {
|
|
10
|
-
/**
|
|
11
|
-
* "OK" label message
|
|
12
|
-
* @default "OK"
|
|
13
|
-
*/
|
|
14
|
-
okLabel?: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* "CANCEL" label message
|
|
17
|
-
* @default "CANCEL"
|
|
18
|
-
*/
|
|
19
|
-
cancelLabel?: React.ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* "CLEAR" label message
|
|
22
|
-
* @default "CLEAR"
|
|
23
|
-
*/
|
|
24
|
-
clearLabel?: React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* "TODAY" label message
|
|
27
|
-
* @default "TODAY"
|
|
28
|
-
*/
|
|
29
|
-
todayLabel?: React.ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* If true today button will be displayed <b>Note*</b> that clear button has higher priority
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
showTodayButton?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Show clear action in picker dialog
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
clearable?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Props to be passed directly to material-ui Dialog
|
|
42
|
-
* @type {Partial<MuiDialogProps>}
|
|
43
|
-
*/
|
|
44
|
-
DialogProps?: Partial<Omit<MuiDialogProps, 'classes'>>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const ModalWrapper: React.FC<ModalWrapperProps<any>> = ({
|
|
48
|
-
open,
|
|
49
|
-
children,
|
|
50
|
-
okLabel,
|
|
51
|
-
cancelLabel,
|
|
52
|
-
clearLabel,
|
|
53
|
-
todayLabel,
|
|
54
|
-
showTodayButton,
|
|
55
|
-
clearable,
|
|
56
|
-
DialogProps,
|
|
57
|
-
showTabs,
|
|
58
|
-
wider,
|
|
59
|
-
InputComponent,
|
|
60
|
-
DateInputProps,
|
|
61
|
-
onClear,
|
|
62
|
-
onAccept,
|
|
63
|
-
onDismiss,
|
|
64
|
-
onSetToday,
|
|
65
|
-
...other
|
|
66
|
-
}) => {
|
|
67
|
-
useKeyDown(open, {
|
|
68
|
-
Enter: onAccept,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<React.Fragment>
|
|
73
|
-
<InputComponent {...other} {...DateInputProps} />
|
|
74
|
-
|
|
75
|
-
<ModalDialog
|
|
76
|
-
wider={wider}
|
|
77
|
-
showTabs={showTabs}
|
|
78
|
-
open={open}
|
|
79
|
-
onClear={onClear}
|
|
80
|
-
onAccept={onAccept}
|
|
81
|
-
onDismiss={onDismiss}
|
|
82
|
-
onSetToday={onSetToday}
|
|
83
|
-
clearLabel={clearLabel}
|
|
84
|
-
todayLabel={todayLabel}
|
|
85
|
-
okLabel={okLabel}
|
|
86
|
-
cancelLabel={cancelLabel}
|
|
87
|
-
clearable={clearable}
|
|
88
|
-
showTodayButton={showTodayButton}
|
|
89
|
-
children={children}
|
|
90
|
-
{...DialogProps}
|
|
91
|
-
/>
|
|
92
|
-
</React.Fragment>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
ModalWrapper.propTypes = {
|
|
97
|
-
okLabel: PropTypes.node,
|
|
98
|
-
cancelLabel: PropTypes.node,
|
|
99
|
-
clearLabel: PropTypes.node,
|
|
100
|
-
clearable: PropTypes.bool,
|
|
101
|
-
todayLabel: PropTypes.node,
|
|
102
|
-
showTodayButton: PropTypes.bool,
|
|
103
|
-
DialogProps: PropTypes.object,
|
|
104
|
-
} as any;
|
|
105
|
-
|
|
106
|
-
ModalWrapper.defaultProps = {
|
|
107
|
-
okLabel: 'OK',
|
|
108
|
-
cancelLabel: 'Cancel',
|
|
109
|
-
clearLabel: 'Clear',
|
|
110
|
-
todayLabel: 'Today',
|
|
111
|
-
clearable: false,
|
|
112
|
-
showTodayButton: false,
|
|
113
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { makeStyles } from '@material-ui/core';
|
|
3
|
-
import { DIALOG_WIDTH } from '../constants/dimensions';
|
|
4
|
-
|
|
5
|
-
const useStyles = makeStyles(
|
|
6
|
-
theme => ({
|
|
7
|
-
staticWrapperRoot: {
|
|
8
|
-
overflow: 'hidden',
|
|
9
|
-
minWidth: DIALOG_WIDTH,
|
|
10
|
-
display: 'flex',
|
|
11
|
-
flexDirection: 'column',
|
|
12
|
-
backgroundColor: theme.palette.background.paper,
|
|
13
|
-
},
|
|
14
|
-
}),
|
|
15
|
-
{ name: 'MuiPickersStaticWrapper' }
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
export const StaticWrapper: React.FC = ({ children }) => {
|
|
19
|
-
const classes = useStyles();
|
|
20
|
-
|
|
21
|
-
return <div className={classes.staticWrapperRoot} children={children} />;
|
|
22
|
-
};
|
package/src/wrappers/Wrapper.tsx
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Omit } from '@material-ui/core';
|
|
3
|
-
import { StaticWrapper } from './StaticWrapper';
|
|
4
|
-
import { PureDateInputProps } from '../_shared/PureDateInput';
|
|
5
|
-
import { ModalWrapper, ModalWrapperProps } from './ModalWrapper';
|
|
6
|
-
import { InlineWrapper, InlineWrapperProps } from './InlineWrapper';
|
|
7
|
-
import { KeyboardDateInputProps } from '../_shared/KeyboardDateInput';
|
|
8
|
-
|
|
9
|
-
export type WrapperVariant = 'dialog' | 'inline' | 'static';
|
|
10
|
-
|
|
11
|
-
export interface WrapperProps<T> {
|
|
12
|
-
open: boolean;
|
|
13
|
-
onAccept: () => void;
|
|
14
|
-
onDismiss: () => void;
|
|
15
|
-
onClear: () => void;
|
|
16
|
-
onSetToday: () => void;
|
|
17
|
-
InputComponent: React.FC<T>;
|
|
18
|
-
DateInputProps: T;
|
|
19
|
-
wider?: boolean;
|
|
20
|
-
showTabs?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type OmitInnerWrapperProps<T extends WrapperProps<any>> = Omit<
|
|
24
|
-
T,
|
|
25
|
-
keyof WrapperProps<any> | 'showTabs'
|
|
26
|
-
>;
|
|
27
|
-
|
|
28
|
-
export type ModalRoot = OmitInnerWrapperProps<ModalWrapperProps>;
|
|
29
|
-
|
|
30
|
-
export type InlineRoot = OmitInnerWrapperProps<InlineWrapperProps>;
|
|
31
|
-
|
|
32
|
-
// prettier-ignore
|
|
33
|
-
export type ExtendWrapper<TInput extends PureDateInputProps | KeyboardDateInputProps> = {
|
|
34
|
-
/**
|
|
35
|
-
* Picker container option
|
|
36
|
-
* @default 'dialog'
|
|
37
|
-
*/
|
|
38
|
-
variant?: WrapperVariant
|
|
39
|
-
} & ModalRoot
|
|
40
|
-
& InlineRoot
|
|
41
|
-
& Omit<TInput, 'inputValue' | 'onChange' | 'format' | 'validationError' | 'format' | 'forwardedRef'>
|
|
42
|
-
|
|
43
|
-
export function getWrapperFromVariant<T>(
|
|
44
|
-
variant?: WrapperVariant
|
|
45
|
-
): React.ComponentType<InlineWrapperProps<T> | ModalWrapperProps<T>> {
|
|
46
|
-
switch (variant) {
|
|
47
|
-
case 'inline':
|
|
48
|
-
return InlineWrapper as any;
|
|
49
|
-
|
|
50
|
-
case 'static':
|
|
51
|
-
return StaticWrapper as any;
|
|
52
|
-
|
|
53
|
-
default:
|
|
54
|
-
return ModalWrapper as any;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type Props<T> = {
|
|
59
|
-
variant?: WrapperVariant;
|
|
60
|
-
children?: React.ReactChild;
|
|
61
|
-
} & (ModalWrapperProps<T> | InlineWrapperProps<T>);
|
|
62
|
-
|
|
63
|
-
export const VariantContext = React.createContext<WrapperVariant | null>(null);
|
|
64
|
-
|
|
65
|
-
export const Wrapper: <T extends KeyboardDateInputProps | PureDateInputProps>(
|
|
66
|
-
p: Props<T>
|
|
67
|
-
) => React.ReactElement<Props<T>> = ({ variant, ...props }) => {
|
|
68
|
-
const Component = getWrapperFromVariant<typeof props.DateInputProps>(variant);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<VariantContext.Provider value={variant || 'dialog'}>
|
|
72
|
-
<Component {...props} />
|
|
73
|
-
</VariantContext.Provider>
|
|
74
|
-
);
|
|
75
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"outDir": "build",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"target": "es5",
|
|
7
|
-
"lib": ["dom", "es2016"],
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"jsx": "react",
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"noImplicitAny": true,
|
|
12
|
-
"strict": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true,
|
|
15
|
-
"esModuleInterop": true,
|
|
16
|
-
"suppressImplicitAnyIndexErrors": true,
|
|
17
|
-
"resolveJsonModule": true
|
|
18
|
-
},
|
|
19
|
-
"include": ["src/**/*.ts*", "typings.d.ts"],
|
|
20
|
-
"exclude": ["./src/__tests__/**/*", "build"]
|
|
21
|
-
}
|
package/typings.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|