@docsvision/material-ui-pickers 3.2.0-beta.27 → 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.
Files changed (35) hide show
  1. package/DatePicker/DatePickerToolbar.js +3 -3
  2. package/DateTimePicker/DateTimePicker.d.ts +2 -2
  3. package/DateTimePicker/DateTimePicker.js +2 -2
  4. package/DateTimePicker/DateTimePickerToolbar.js +4 -4
  5. package/MuiPickersUtilsProvider.d.ts +1 -1
  6. package/Picker/Picker.d.ts +3 -3
  7. package/Picker/Picker.js +1 -1
  8. package/Picker/WrappedPurePicker.js +2 -1
  9. package/TimePicker/TimePicker.d.ts +4 -2
  10. package/TimePicker/TimePicker.js +2 -2
  11. package/TimePicker/TimePickerToolbar.js +3 -3
  12. package/_helpers/date-utils.d.ts +2 -2
  13. package/_helpers/date-utils.js +3 -3
  14. package/_helpers/text-field-helper.d.ts +3 -3
  15. package/_helpers/text-field-helper.js +1 -1
  16. package/_helpers/time-utils.d.ts +2 -2
  17. package/_shared/WithUtils.d.ts +1 -1
  18. package/_shared/hooks/useKeyboardPickerState.js +1 -1
  19. package/_shared/hooks/useUtils.d.ts +2 -2
  20. package/dist/material-ui-pickers.esm.js +1187 -834
  21. package/dist/material-ui-pickers.esm.js.map +1 -1
  22. package/dist/material-ui-pickers.js +1187 -834
  23. package/dist/material-ui-pickers.js.map +1 -1
  24. package/dist/material-ui-pickers.umd.js +1178 -825
  25. package/dist/material-ui-pickers.umd.min.js +1 -1
  26. package/index.d.ts +11 -11
  27. package/package.json +5 -5
  28. package/typings/BasePicker.d.ts +1 -1
  29. package/views/Calendar/Calendar.js +1 -1
  30. package/views/Calendar/CalendarHeader.js +1 -1
  31. package/views/Clock/Clock.js +1 -1
  32. package/views/Clock/ClockNumbers.d.ts +2 -2
  33. package/views/Clock/ClockView.js +1 -1
  34. package/views/Month/MonthView.js +1 -1
  35. package/views/Year/YearView.js +2 -2
@@ -40,7 +40,7 @@ exports.DatePickerToolbar = function (_a) {
40
40
  _b[classes.toolbar] = !isYearOnly,
41
41
  _b[classes.toolbarLandscape] = isLandscape,
42
42
  _b)) },
43
- React.createElement(ToolbarButton_1.default, { variant: isYearOnly ? 'h3' : 'subtitle1', onClick: function () { return setOpenView('year'); }, selected: openView === 'year', label: utils.getYearText(date) }),
44
- !isYearOnly && !isYearAndMonth && (React.createElement(ToolbarButton_1.default, { variant: "h4", selected: openView === 'date', onClick: function () { return setOpenView('date'); }, align: isLandscape ? 'left' : 'center', label: utils.getDatePickerHeaderText(date), className: clsx_1.default((_c = {}, _c[classes.dateLandscape] = isLandscape, _c)) })),
45
- isYearAndMonth && (React.createElement(ToolbarButton_1.default, { variant: "h4", onClick: function () { return setOpenView('month'); }, selected: openView === 'month', label: utils.getMonthText(date) }))));
43
+ React.createElement(ToolbarButton_1.default, { variant: isYearOnly ? 'h3' : 'subtitle1', onClick: function () { return setOpenView('year'); }, selected: openView === 'year', label: utils.formatByString(date, utils.formats.year) }),
44
+ !isYearOnly && !isYearAndMonth && (React.createElement(ToolbarButton_1.default, { variant: "h4", selected: openView === 'date', onClick: function () { return setOpenView('date'); }, align: isLandscape ? 'left' : 'center', label: utils.formatByString(date, utils.formats.normalDateWithWeekday), className: clsx_1.default((_c = {}, _c[classes.dateLandscape] = isLandscape, _c)) })),
45
+ isYearAndMonth && (React.createElement(ToolbarButton_1.default, { variant: "h4", onClick: function () { return setOpenView('month'); }, selected: openView === 'month', label: utils.formatByString(date, utils.formats.month) }))));
46
46
  };
@@ -8,9 +8,9 @@ export declare type DateTimePickerView = 'year' | 'date' | 'month' | 'hours' | '
8
8
  export declare type BaseDateTimePickerProps = BaseTimePickerProps & BaseDatePickerProps;
9
9
  export interface DateTimePickerViewsProps extends BaseDateTimePickerProps {
10
10
  /** Array of views to show */
11
- views?: ('year' | 'date' | 'month' | 'hours' | 'minutes')[];
11
+ views?: ('year' | 'date' | 'month' | 'hours' | 'minutes' | 'seconds')[];
12
12
  /** Open to DatePicker */
13
- openTo?: 'year' | 'date' | 'month' | 'hours' | 'minutes';
13
+ openTo?: 'year' | 'date' | 'month' | 'hours' | 'minutes' | 'seconds';
14
14
  /** To show tabs */
15
15
  hideTabs?: boolean;
16
16
  /** Date tab icon */
@@ -26,8 +26,8 @@ function useOptions(props) {
26
26
  return {
27
27
  getDefaultFormat: function () {
28
28
  return text_field_helper_1.pick12hOr24hFormat(props.format, props.ampm, {
29
- '12h': utils.dateTime12hFormat,
30
- '24h': utils.dateTime24hFormat,
29
+ '12h': utils.formats.fullDateTime12h,
30
+ '24h': utils.formats.fullDateTime24h,
31
31
  });
32
32
  },
33
33
  };
@@ -43,13 +43,13 @@ exports.DateTimePickerToolbar = function (_a) {
43
43
  React.createElement(core_1.Grid, { container: true, justify: "center", wrap: "nowrap" },
44
44
  React.createElement(core_1.Grid, { item: true, container: true, xs: 5, justify: "flex-start", direction: "column" },
45
45
  React.createElement("div", null,
46
- React.createElement(ToolbarButton_1.default, { variant: "subtitle1", onClick: function () { return setOpenView('year'); }, selected: openView === 'year', label: utils.getYearText(date) })),
46
+ React.createElement(ToolbarButton_1.default, { variant: "subtitle1", onClick: function () { return setOpenView('year'); }, selected: openView === 'year', label: utils.formatByString(date, utils.formats.year) })),
47
47
  React.createElement("div", null,
48
- React.createElement(ToolbarButton_1.default, { variant: "h4", onClick: function () { return setOpenView('date'); }, selected: openView === 'date', label: utils.getDateTimePickerHeaderText(date) }))),
48
+ React.createElement(ToolbarButton_1.default, { variant: "h4", onClick: function () { return setOpenView('date'); }, selected: openView === 'date', label: utils.formatByString(date, utils.formats.shortDate) }))),
49
49
  React.createElement(core_1.Grid, { item: true, container: true, xs: 6, justify: "center", alignItems: "flex-end", direction: rtl ? 'row-reverse' : 'row' },
50
- React.createElement(ToolbarButton_1.default, { variant: "h3", onClick: function () { return setOpenView('hours'); }, selected: openView === 'hours', label: utils.getHourText(date, ampm) }),
50
+ React.createElement(ToolbarButton_1.default, { variant: "h3", onClick: function () { return setOpenView('hours'); }, selected: openView === 'hours', label: utils.formatByString(date, ampm ? utils.formats.hours12h : utils.formats.hours24h) }),
51
51
  React.createElement(ToolbarText_1.default, { variant: "h3", label: ":", className: classes.separator }),
52
- React.createElement(ToolbarButton_1.default, { variant: "h3", onClick: function () { return setOpenView('minutes'); }, selected: openView === 'minutes', label: utils.getMinuteText(date) })),
52
+ React.createElement(ToolbarButton_1.default, { variant: "h3", onClick: function () { return setOpenView('minutes'); }, selected: openView === 'minutes', label: utils.formatByString(date, utils.formats.minutes) })),
53
53
  ampm && (React.createElement(core_1.Grid, { item: true, container: true, xs: 1, direction: "column", justify: "flex-end" },
54
54
  React.createElement(ToolbarButton_1.default, { variant: "subtitle1", selected: meridiemMode === 'am', label: utils.getMeridiemText('am'), onClick: function () { return handleMeridiemChange('am'); } }),
55
55
  React.createElement(ToolbarButton_1.default, { variant: "subtitle1", selected: meridiemMode === 'pm', label: utils.getMeridiemText('pm'), onClick: function () { return handleMeridiemChange('pm'); } }))))),
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IUtils } from '@date-io/core/IUtils';
3
3
  import { MaterialUiPickersDate } from './typings/date';
4
- export declare const MuiPickersContext: React.Context<IUtils<MaterialUiPickersDate> | null>;
4
+ export declare const MuiPickersContext: React.Context<IUtils<MaterialUiPickersDate, any> | null>;
5
5
  export interface MuiPickersUtilsProviderProps {
6
6
  utils: any;
7
7
  children: React.ReactNode;
@@ -31,17 +31,17 @@ export interface PickerViewProps extends BaseDatePickerProps, BaseTimePickerProp
31
31
  hideTabs?: boolean;
32
32
  dateRangeIcon?: React.ReactNode;
33
33
  timeIcon?: React.ReactNode;
34
+ showActionsBar?: boolean;
34
35
  }
35
36
  interface PickerProps extends PickerViewProps {
36
37
  date: MaterialUiPickersDate;
37
38
  orientation?: BasePickerProps['orientation'];
38
39
  onChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
39
- showActionsBar?: boolean;
40
40
  showTodayButton?: boolean;
41
- todayLabel?: string;
41
+ todayLabel?: React.ReactNode;
42
42
  showShiftButtons?: boolean;
43
43
  setShiftFunction?: (days: number) => Date;
44
- shiftButtonValues?: Object;
44
+ shiftButtonValues?: Record<string, React.Key>;
45
45
  onSetToday?: () => void;
46
46
  onSetShift?: (shiftDate: Date) => void;
47
47
  }
package/Picker/Picker.js CHANGED
@@ -96,7 +96,7 @@ exports.Picker = function (props) {
96
96
  return (React.createElement("div", { className: clsx_1.default(classes.container, (_a = {},
97
97
  _a[classes.containerLandscape] = isLandscape,
98
98
  _a)) },
99
- !disableToolbar && (React.createElement(ToolbarComponent, __assign({ date: date, onChange: onChange, setOpenView: setOpenView, openView: openView, hideTabs: hideTabs, dateRangeIcon: dateRangeIcon, timeIcon: timeIcon, isLandscape: isLandscape }, props))),
99
+ !disableToolbar && (React.createElement(ToolbarComponent, __assign({ setOpenView: setOpenView, openView: openView, hideTabs: hideTabs, dateRangeIcon: dateRangeIcon, timeIcon: timeIcon, isLandscape: isLandscape }, props))),
100
100
  React.createElement("div", { className: clsx_1.default(classes.pickerView, (_b = {}, _b[classes.pickerViewLandscape] = isLandscape, _b)) },
101
101
  openView === 'year' && (React.createElement(YearView_1.YearSelection, { date: date, onChange: handleChangeAndOpenNext, minDate: minDate, maxDate: maxDate, disablePast: disablePast, disableFuture: disableFuture, onYearChange: onYearChange, animateYearScrolling: animateYearScrolling })),
102
102
  openView === 'month' && (React.createElement(MonthView_1.MonthSelection, { date: date, onChange: handleChangeAndOpenNext, minDate: minDate, maxDate: maxDate, disablePast: disablePast, disableFuture: disableFuture, onMonthChange: onMonthChange })),
@@ -39,9 +39,10 @@ function makePurePicker(_a) {
39
39
  function WrappedPurePicker(props) {
40
40
  var allowKeyboardControl = props.allowKeyboardControl, ampm = props.ampm, hideTabs = props.hideTabs, animateYearScrolling = props.animateYearScrolling, autoOk = props.autoOk, disableFuture = props.disableFuture, disablePast = props.disablePast, format = props.format, forwardedRef = props.forwardedRef, initialFocusedDate = props.initialFocusedDate, invalidDateMessage = props.invalidDateMessage, labelFunc = props.labelFunc, leftArrowIcon = props.leftArrowIcon, leftArrowButtonProps = props.leftArrowButtonProps, maxDate = props.maxDate, maxDateMessage = props.maxDateMessage, minDate = props.minDate, onOpen = props.onOpen, onClose = props.onClose, minDateMessage = props.minDateMessage, strictCompareDates = props.strictCompareDates, minutesStep = props.minutesStep, onAccept = props.onAccept, onChange = props.onChange, onMonthChange = props.onMonthChange, onYearChange = props.onYearChange, renderDay = props.renderDay, views = props.views, openTo = props.openTo, rightArrowIcon = props.rightArrowIcon, rightArrowButtonProps = props.rightArrowButtonProps, shouldDisableDate = props.shouldDisableDate, dateRangeIcon = props.dateRangeIcon, emptyLabel = props.emptyLabel, invalidLabel = props.invalidLabel, timeIcon = props.timeIcon, value = props.value, variant = props.variant, orientation = props.orientation, disableToolbar = props.disableToolbar, loadingIndicator = props.loadingIndicator, _a = props.ToolbarComponent, ToolbarComponent = _a === void 0 ? DefaultToolbarComponent : _a, showActionsBar = props.showActionsBar, showTodayButton = props.showTodayButton, todayLabel = props.todayLabel, showShiftButtons = props.showShiftButtons, setShiftFunction = props.setShiftFunction, shiftButtonValues = props.shiftButtonValues, other = __rest(props, ["allowKeyboardControl", "ampm", "hideTabs", "animateYearScrolling", "autoOk", "disableFuture", "disablePast", "format", "forwardedRef", "initialFocusedDate", "invalidDateMessage", "labelFunc", "leftArrowIcon", "leftArrowButtonProps", "maxDate", "maxDateMessage", "minDate", "onOpen", "onClose", "minDateMessage", "strictCompareDates", "minutesStep", "onAccept", "onChange", "onMonthChange", "onYearChange", "renderDay", "views", "openTo", "rightArrowIcon", "rightArrowButtonProps", "shouldDisableDate", "dateRangeIcon", "emptyLabel", "invalidLabel", "timeIcon", "value", "variant", "orientation", "disableToolbar", "loadingIndicator", "ToolbarComponent", "showActionsBar", "showTodayButton", "todayLabel", "showShiftButtons", "setShiftFunction", "shiftButtonValues"]);
41
41
  var injectedProps = getCustomProps ? getCustomProps(props) : {};
42
+ var dialogVariantProps = variant === "dialog" ? { showTodayButton: showTodayButton, todayLabel: todayLabel } : {};
42
43
  var options = useOptions(props);
43
44
  var _b = usePickerState_1.usePickerState(props, options), pickerProps = _b.pickerProps, inputProps = _b.inputProps, wrapperProps = _b.wrapperProps;
44
- return (React.createElement(Wrapper_1.Wrapper, __assign({ variant: variant, InputComponent: PureDateInput_1.PureDateInput, DateInputProps: inputProps, showTodayButton: showTodayButton, todayLabel: todayLabel }, wrapperProps, injectedProps, other),
45
+ return (React.createElement(Wrapper_1.Wrapper, __assign({ variant: variant, InputComponent: PureDateInput_1.PureDateInput, DateInputProps: inputProps }, wrapperProps, injectedProps, dialogVariantProps, other),
45
46
  React.createElement(Picker_1.Picker, __assign({}, pickerProps, { orientation: orientation, disableToolbar: disableToolbar, ToolbarComponent: ToolbarComponent, hideTabs: hideTabs, ampm: ampm, views: views, openTo: openTo, allowKeyboardControl: allowKeyboardControl, minutesStep: minutesStep, animateYearScrolling: animateYearScrolling, disableFuture: disableFuture, disablePast: disablePast, leftArrowIcon: leftArrowIcon, leftArrowButtonProps: leftArrowButtonProps, maxDate: maxDate, minDate: minDate, strictCompareDates: strictCompareDates, onMonthChange: onMonthChange, onYearChange: onYearChange, renderDay: renderDay, dateRangeIcon: dateRangeIcon, timeIcon: timeIcon, rightArrowIcon: rightArrowIcon, rightArrowButtonProps: rightArrowButtonProps, shouldDisableDate: shouldDisableDate, loadingIndicator: loadingIndicator, showActionsBar: showActionsBar, showTodayButton: showTodayButton, todayLabel: todayLabel, showShiftButtons: showShiftButtons, setShiftFunction: setShiftFunction, shiftButtonValues: shiftButtonValues }))));
46
47
  }
47
48
  return WrappedPurePicker;
@@ -2,6 +2,7 @@
2
2
  /// <reference types="styled-jsx" />
3
3
  import { WrappedPurePickerProps } from '../Picker/WrappedPurePicker';
4
4
  import { WrappedKeyboardPickerProps } from '../Picker/WrappedKeyboardPicker';
5
+ declare type TimePickerView = 'hours' | 'minutes' | 'seconds';
5
6
  export interface BaseTimePickerProps {
6
7
  /**
7
8
  * 12h/24h view for hour selection clock
@@ -16,11 +17,12 @@ export interface BaseTimePickerProps {
16
17
  }
17
18
  export interface TimePickerViewsProps extends BaseTimePickerProps {
18
19
  /** Array of views to show */
19
- views?: ('hours' | 'minutes' | 'seconds')[];
20
+ views?: TimePickerView[];
20
21
  /** Open to timepicker */
21
- openTo?: 'hours' | 'minutes' | 'seconds';
22
+ openTo?: TimePickerView;
22
23
  }
23
24
  export declare type TimePickerProps = WrappedPurePickerProps & TimePickerViewsProps;
24
25
  export declare type KeyboardTimePickerProps = WrappedKeyboardPickerProps & TimePickerViewsProps;
25
26
  export declare const TimePicker: import("react").FunctionComponent<TimePickerProps>;
26
27
  export declare const KeyboardTimePicker: import("react").FunctionComponent<KeyboardTimePickerProps>;
28
+ export {};
@@ -26,8 +26,8 @@ function useOptions(props) {
26
26
  return {
27
27
  getDefaultFormat: function () {
28
28
  return text_field_helper_1.pick12hOr24hFormat(props.format, props.ampm, {
29
- '12h': utils.time12hFormat,
30
- '24h': utils.time24hFormat,
29
+ '12h': utils.formats.hours12h,
30
+ '24h': utils.formats.hours24h,
31
31
  });
32
32
  },
33
33
  };
@@ -88,11 +88,11 @@ var TimePickerToolbar = function (_a) {
88
88
  _c[classes.hourMinuteLabelLandscape] = isLandscape,
89
89
  _c[classes.hourMinuteLabelReverse] = theme.direction === 'rtl',
90
90
  _c)) },
91
- utils_1.arrayIncludes(views, 'hours') && (React.createElement(ToolbarButton_1.default, { variant: clockTypographyVariant, onClick: function () { return setOpenView(ClockType_1.default.HOURS); }, selected: openView === ClockType_1.default.HOURS, label: utils.getHourText(date, Boolean(ampm)) })),
91
+ utils_1.arrayIncludes(views, 'hours') && (React.createElement(ToolbarButton_1.default, { variant: clockTypographyVariant, onClick: function () { return setOpenView(ClockType_1.default.HOURS); }, selected: openView === ClockType_1.default.HOURS, label: utils.formatByString(date, ampm ? utils.formats.hours12h : utils.formats.hours24h) })),
92
92
  utils_1.arrayIncludes(views, ['hours', 'minutes']) && (React.createElement(ToolbarText_1.default, { label: ":", variant: clockTypographyVariant, selected: false, className: classes.separator })),
93
- utils_1.arrayIncludes(views, 'minutes') && (React.createElement(ToolbarButton_1.default, { variant: clockTypographyVariant, onClick: function () { return setOpenView(ClockType_1.default.MINUTES); }, selected: openView === ClockType_1.default.MINUTES, label: utils.getMinuteText(date) })),
93
+ utils_1.arrayIncludes(views, 'minutes') && (React.createElement(ToolbarButton_1.default, { variant: clockTypographyVariant, onClick: function () { return setOpenView(ClockType_1.default.MINUTES); }, selected: openView === ClockType_1.default.MINUTES, label: utils.formatByString(date, utils.formats.minutes) })),
94
94
  utils_1.arrayIncludes(views, ['minutes', 'seconds']) && (React.createElement(ToolbarText_1.default, { variant: "h2", label: ":", selected: false, className: classes.separator })),
95
- utils_1.arrayIncludes(views, 'seconds') && (React.createElement(ToolbarButton_1.default, { variant: "h2", onClick: function () { return setOpenView(ClockType_1.default.SECONDS); }, selected: openView === ClockType_1.default.SECONDS, label: utils.getSecondText(date) }))),
95
+ utils_1.arrayIncludes(views, 'seconds') && (React.createElement(ToolbarButton_1.default, { variant: "h2", onClick: function () { return setOpenView(ClockType_1.default.SECONDS); }, selected: openView === ClockType_1.default.SECONDS, label: utils.formatByString(date, utils.formats.seconds) }))),
96
96
  ampm && (React.createElement("div", { className: clsx_1.default(classes.ampmSelection, (_d = {},
97
97
  _d[classes.ampmLandscape] = isLandscape,
98
98
  _d[classes.ampmSelectionWithSeconds] = utils_1.arrayIncludes(views, 'seconds'),
@@ -3,7 +3,7 @@ import { MaterialUiPickersDate } from '../typings/date';
3
3
  import { DatePickerView } from '../DatePicker/DatePicker';
4
4
  interface FindClosestDateParams {
5
5
  date: MaterialUiPickersDate;
6
- utils: IUtils<MaterialUiPickersDate>;
6
+ utils: IUtils<MaterialUiPickersDate, any>;
7
7
  minDate: MaterialUiPickersDate;
8
8
  maxDate: MaterialUiPickersDate;
9
9
  disableFuture: boolean;
@@ -13,5 +13,5 @@ interface FindClosestDateParams {
13
13
  export declare const findClosestEnabledDate: ({ date, utils, minDate, maxDate, disableFuture, disablePast, shouldDisableDate, }: FindClosestDateParams) => MaterialUiPickersDate;
14
14
  export declare const isYearOnlyView: (views: DatePickerView[]) => boolean;
15
15
  export declare const isYearAndMonthViews: (views: DatePickerView[]) => boolean;
16
- export declare const getFormatByViews: (views: DatePickerView[], utils: IUtils<MaterialUiPickersDate>) => string;
16
+ export declare const getFormatByViews: (views: DatePickerView[], utils: IUtils<MaterialUiPickersDate, any>) => any;
17
17
  export {};
@@ -52,10 +52,10 @@ exports.isYearAndMonthViews = function (views) {
52
52
  };
53
53
  exports.getFormatByViews = function (views, utils) {
54
54
  if (exports.isYearOnlyView(views)) {
55
- return utils.yearFormat;
55
+ return utils.formats.year;
56
56
  }
57
57
  if (exports.isYearAndMonthViews(views)) {
58
- return utils.yearMonthFormat;
58
+ return utils.formats.monthAndYear;
59
59
  }
60
- return utils.dateFormat;
60
+ return utils.formats.monthAndDate;
61
61
  };
@@ -3,7 +3,7 @@
3
3
  import { IUtils } from '@date-io/core/IUtils';
4
4
  import { ParsableDate } from '../constants/prop-types';
5
5
  import { BasePickerProps } from '../typings/BasePicker';
6
- export declare const getDisplayDate: (value: ParsableDate, format: string, utils: IUtils<any>, isEmpty: boolean, { invalidLabel, emptyLabel, labelFunc }: Pick<BasePickerProps, "onError" | "variant" | "open" | "disabled" | "format" | "orientation" | "onClose" | "onOpen" | "onAccept" | "autoOk" | "labelFunc" | "initialFocusedDate" | "invalidLabel" | "emptyLabel" | "disableToolbar" | "ToolbarComponent" | "showShiftButtons" | "setShiftFunction" | "shiftButtonValues">) => string;
6
+ export declare const getDisplayDate: (value: ParsableDate, format: string, utils: IUtils<any, any>, isEmpty: boolean, { invalidLabel, emptyLabel, labelFunc }: Pick<BasePickerProps, "onError" | "variant" | "open" | "disabled" | "format" | "orientation" | "onClose" | "onOpen" | "onAccept" | "autoOk" | "labelFunc" | "initialFocusedDate" | "invalidLabel" | "emptyLabel" | "disableToolbar" | "ToolbarComponent" | "showShiftButtons" | "setShiftFunction" | "shiftButtonValues">) => string;
7
7
  export interface BaseValidationProps {
8
8
  /**
9
9
  * Message, appearing when date cannot be parsed
@@ -23,10 +23,10 @@ export interface DateValidationProps extends BaseValidationProps {
23
23
  */
24
24
  maxDateMessage?: React.ReactNode;
25
25
  }
26
- export declare const validate: (value: ParsableDate, utils: IUtils<any>, { maxDate, minDate, disablePast, disableFuture, maxDateMessage, minDateMessage, invalidDateMessage, strictCompareDates, }: Pick<import("../DatePicker/DatePicker").DatePickerProps, "children" | "ref" | "label" | "select" | "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "innerRef" | "error" | "name" | "margin" | "open" | "disabled" | "key" | "autoFocus" | "type" | "value" | "fullWidth" | "format" | "orientation" | "autoComplete" | "required" | "rows" | "onMonthChange" | "leftArrowIcon" | "rightArrowIcon" | "leftArrowButtonProps" | "rightArrowButtonProps" | "minDate" | "maxDate" | "disablePast" | "disableFuture" | "renderDay" | "allowKeyboardControl" | "shouldDisableDate" | "loadingIndicator" | "hiddenLabel" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "inputRef" | "multiline" | "rowsMax" | "SelectProps" | "InputProps" | "inputVariant" | "TextFieldComponent" | "onClose" | "onOpen" | "onAccept" | "okLabel" | "cancelLabel" | "clearLabel" | "todayLabel" | "clearable" | "showTodayButton" | "DialogProps" | "PopoverProps" | "autoOk" | "labelFunc" | "initialFocusedDate" | "invalidLabel" | "emptyLabel" | "disableToolbar" | "ToolbarComponent" | "showShiftButtons" | "setShiftFunction" | "shiftButtonValues" | "minDateMessage" | "maxDateMessage" | "invalidDateMessage" | "strictCompareDates" | "animateYearScrolling" | "onYearChange">) => import("react").ReactNode;
26
+ export declare const validate: (value: ParsableDate, utils: IUtils<any, any>, { maxDate, minDate, disablePast, disableFuture, maxDateMessage, minDateMessage, invalidDateMessage, strictCompareDates, }: Pick<import("../DatePicker/DatePicker").DatePickerProps, "children" | "ref" | "label" | "select" | "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "innerRef" | "error" | "name" | "margin" | "open" | "disabled" | "key" | "autoFocus" | "type" | "value" | "fullWidth" | "format" | "orientation" | "autoComplete" | "required" | "rows" | "onMonthChange" | "leftArrowIcon" | "rightArrowIcon" | "leftArrowButtonProps" | "rightArrowButtonProps" | "minDate" | "maxDate" | "disablePast" | "disableFuture" | "renderDay" | "allowKeyboardControl" | "shouldDisableDate" | "loadingIndicator" | "hiddenLabel" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "inputRef" | "multiline" | "rowsMax" | "SelectProps" | "InputProps" | "inputVariant" | "TextFieldComponent" | "onClose" | "onOpen" | "onAccept" | "okLabel" | "cancelLabel" | "clearLabel" | "todayLabel" | "clearable" | "showTodayButton" | "DialogProps" | "PopoverProps" | "autoOk" | "labelFunc" | "initialFocusedDate" | "invalidLabel" | "emptyLabel" | "disableToolbar" | "ToolbarComponent" | "showShiftButtons" | "setShiftFunction" | "shiftButtonValues" | "minDateMessage" | "maxDateMessage" | "invalidDateMessage" | "strictCompareDates" | "animateYearScrolling" | "onYearChange">) => import("react").ReactNode;
27
27
  export declare function pick12hOr24hFormat(userFormat: string | undefined, ampm: boolean | undefined, formats: {
28
28
  '12h': string;
29
29
  '24h': string;
30
30
  }): string;
31
31
  export declare function makeMaskFromFormat(format: string, numberMaskChar: string): string;
32
- export declare const maskedDateFormatter: (mask: string, numberMaskChar: string) => (value: string, oldValue: string, currentCaretPosition?: number | undefined) => string;
32
+ export declare const maskedDateFormatter: (mask: string, numberMaskChar: string) => (value: string, oldValue?: string | undefined, currentCaretPosition?: number | undefined) => string;
@@ -13,7 +13,7 @@ exports.getDisplayDate = function (value, format, utils, isEmpty, _a) {
13
13
  if (isEmpty) {
14
14
  return emptyLabel || '';
15
15
  }
16
- return utils.isValid(date) ? utils.format(date, format) : invalidLabel;
16
+ return utils.isValid(date) ? utils.formatByString(date, format) : invalidLabel;
17
17
  };
18
18
  var getComparisonMaxDate = function (utils, strictCompareDates, date) {
19
19
  if (strictCompareDates) {
@@ -2,5 +2,5 @@ import { IUtils } from '@date-io/core/IUtils';
2
2
  import { MaterialUiPickersDate } from '../typings/date';
3
3
  export declare const getHours: (offsetX: number, offsetY: number, ampm: boolean) => number;
4
4
  export declare const getMinutes: (offsetX: number, offsetY: number, step?: number) => number;
5
- export declare const getMeridiem: (date: MaterialUiPickersDate, utils: IUtils<MaterialUiPickersDate>) => "am" | "pm";
6
- export declare const convertToMeridiem: (time: MaterialUiPickersDate, meridiem: "am" | "pm", ampm: boolean, utils: IUtils<MaterialUiPickersDate>) => MaterialUiPickersDate;
5
+ export declare const getMeridiem: (date: MaterialUiPickersDate, utils: IUtils<MaterialUiPickersDate, any>) => "am" | "pm";
6
+ export declare const convertToMeridiem: (time: MaterialUiPickersDate, meridiem: "am" | "pm", ampm: boolean, utils: IUtils<MaterialUiPickersDate, any>) => MaterialUiPickersDate;
@@ -3,6 +3,6 @@ import { Omit } from '@material-ui/core';
3
3
  import { IUtils } from '@date-io/core/IUtils';
4
4
  import { MaterialUiPickersDate } from '../typings/date';
5
5
  export interface WithUtilsProps {
6
- utils: IUtils<MaterialUiPickersDate>;
6
+ utils: IUtils<MaterialUiPickersDate, any>;
7
7
  }
8
8
  export declare const withUtils: () => <P extends WithUtilsProps>(Component: React.ComponentType<P>) => React.FunctionComponent<Omit<P, "utils">>;
@@ -35,7 +35,7 @@ function useKeyboardPickerState(props, options) {
35
35
  }
36
36
  }, [displayDate, setInnerInputValue, utils, value]);
37
37
  var handleKeyboardChange = react_1.useCallback(function (date) {
38
- onChange(date, date === null ? null : utils.format(date, format));
38
+ onChange(date, date === null ? null : utils.formatByString(date, format));
39
39
  }, [format, onChange, utils]);
40
40
  var _c = usePickerState_1.usePickerState(__assign(__assign({}, props), { value: dateValue, onChange: handleKeyboardChange }), options), innerInputProps = _c.inputProps, wrapperProps = _c.wrapperProps, pickerProps = _c.pickerProps;
41
41
  var inputProps = react_1.useMemo(function () { return (__assign(__assign({}, innerInputProps), { format: wrapperProps.format, inputValue: inputValue || innerInputValue, onChange: function (value) {
@@ -1,4 +1,4 @@
1
1
  import { IUtils } from '@date-io/core/IUtils';
2
2
  import { MaterialUiPickersDate } from '../../typings/date';
3
- export declare const checkUtils: (utils: IUtils<MaterialUiPickersDate> | null | undefined) => void;
4
- export declare function useUtils(): IUtils<MaterialUiPickersDate>;
3
+ export declare const checkUtils: (utils: IUtils<MaterialUiPickersDate, any> | null | undefined) => void;
4
+ export declare function useUtils(): IUtils<MaterialUiPickersDate, any>;