@mui/x-date-pickers 7.0.0-alpha.7 → 7.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +4 -21
- package/AdapterDateFns/AdapterDateFns.js +11 -255
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +62 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +291 -0
- package/AdapterDateFnsBase/index.d.ts +1 -0
- package/AdapterDateFnsBase/index.js +1 -0
- package/AdapterDateFnsBase/package.json +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +80 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/AdapterDateFnsV3/index.d.ts +1 -0
- package/AdapterDateFnsV3/index.js +1 -0
- package/AdapterDateFnsV3/package.json +6 -0
- package/CHANGELOG.md +175 -49
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -7
- package/DigitalClock/DigitalClock.js +1 -0
- package/DigitalClock/DigitalClock.types.d.ts +5 -0
- package/LocalizationProvider/LocalizationProvider.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
- package/PickersSectionList/PickersSectionList.js +1 -1
- package/TimeClock/TimeClock.js +1 -0
- package/TimeClock/TimeClock.types.d.ts +5 -0
- package/hooks/useClearableField.js +3 -3
- package/index.js +1 -1
- package/internals/components/PickersInput/PickersInput.d.ts +2 -4
- package/internals/components/PickersInput/PickersInput.js +2 -3
- package/internals/hooks/useField/useField.utils.js +5 -5
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/internals/hooks/useUtils.js +2 -2
- package/internals/hooks/useViews.js +2 -2
- package/internals/index.d.ts +9 -3
- package/internals/index.js +6 -2
- package/internals/models/common.d.ts +1 -1
- package/internals/models/helpers.d.ts +1 -0
- package/internals/utils/views.js +1 -1
- package/legacy/AdapterDateFns/AdapterDateFns.js +222 -458
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +293 -0
- package/legacy/AdapterDateFnsBase/index.js +1 -0
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +306 -0
- package/legacy/AdapterDateFnsV3/index.js +1 -0
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
- package/legacy/DatePicker/DatePickerToolbar.js +2 -7
- package/legacy/DigitalClock/DigitalClock.js +1 -0
- package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/legacy/PickersSectionList/PickersSectionList.js +1 -1
- package/legacy/TimeClock/TimeClock.js +1 -0
- package/legacy/hooks/useClearableField.js +3 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersInput/PickersInput.js +2 -3
- package/legacy/internals/hooks/useField/useField.utils.js +5 -5
- package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/legacy/internals/hooks/useUtils.js +2 -2
- package/legacy/internals/hooks/useViews.js +2 -2
- package/legacy/internals/index.js +6 -2
- package/legacy/internals/utils/views.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/locales/enUS.d.ts +1 -1
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/mk.d.ts +1 -1
- package/locales/utils/getPickersLocalization.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -254
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +290 -0
- package/modern/AdapterDateFnsBase/index.js +1 -0
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/modern/AdapterDateFnsV3/index.js +1 -0
- package/modern/DatePicker/DatePickerToolbar.js +2 -7
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersSectionList/PickersSectionList.js +1 -1
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersInput/PickersInput.js +2 -3
- package/modern/internals/hooks/useField/useField.utils.js +5 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/modern/internals/hooks/useUtils.js +2 -2
- package/modern/internals/hooks/useViews.js +2 -2
- package/modern/internals/index.js +6 -2
- package/modern/internals/utils/views.js +1 -1
- package/modern/locales/index.js +1 -0
- package/node/AdapterDateFns/AdapterDateFns.js +11 -254
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +298 -0
- package/node/AdapterDateFnsBase/index.js +12 -0
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +295 -0
- package/node/AdapterDateFnsV3/index.js +12 -0
- package/node/DatePicker/DatePickerToolbar.js +0 -4
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/LocalizationProvider/LocalizationProvider.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersSectionList/PickersSectionList.js +1 -1
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/hooks/useClearableField.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/components/PickersInput/PickersInput.js +2 -3
- package/node/internals/hooks/useField/useField.utils.js +5 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/node/internals/hooks/useUtils.js +2 -2
- package/node/internals/hooks/useViews.js +2 -2
- package/node/internals/index.js +47 -1
- package/node/internals/utils/views.js +1 -1
- package/node/locales/index.js +11 -0
- package/package.json +2 -2
|
@@ -22,5 +22,5 @@ type DatePickerToolbarComponent = (<TDate>(props: DatePickerToolbarProps<TDate>
|
|
|
22
22
|
*
|
|
23
23
|
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
|
24
24
|
*/
|
|
25
|
-
declare const DatePickerToolbar: DatePickerToolbarComponent;
|
|
26
|
-
export {
|
|
25
|
+
export declare const DatePickerToolbar: DatePickerToolbarComponent;
|
|
26
|
+
export {};
|
|
@@ -26,10 +26,6 @@ const DatePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
26
26
|
slot: 'Root',
|
|
27
27
|
overridesResolver: (_, styles) => styles.root
|
|
28
28
|
})({});
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @ignore - do not document.
|
|
32
|
-
*/
|
|
33
29
|
const DatePickerToolbarTitle = styled(Typography, {
|
|
34
30
|
name: 'MuiDatePickerToolbar',
|
|
35
31
|
slot: 'Title',
|
|
@@ -49,7 +45,7 @@ const DatePickerToolbarTitle = styled(Typography, {
|
|
|
49
45
|
*
|
|
50
46
|
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
|
51
47
|
*/
|
|
52
|
-
const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
|
|
48
|
+
export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
|
|
53
49
|
const props = useThemeProps({
|
|
54
50
|
props: inProps,
|
|
55
51
|
name: 'MuiDatePickerToolbar'
|
|
@@ -133,5 +129,4 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
133
129
|
*/
|
|
134
130
|
view: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
|
|
135
131
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired).isRequired
|
|
136
|
-
} : void 0;
|
|
137
|
-
export { DatePickerToolbar };
|
|
132
|
+
} : void 0;
|
|
@@ -17,6 +17,11 @@ export interface DigitalClockSlotProps {
|
|
|
17
17
|
digitalClockItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
18
18
|
}
|
|
19
19
|
export interface DigitalClockProps<TDate> extends ExportedDigitalClockProps<TDate>, BaseClockProps<TDate, Extract<TimeView, 'hours'>> {
|
|
20
|
+
/**
|
|
21
|
+
* Available views.
|
|
22
|
+
* @default ['hours']
|
|
23
|
+
*/
|
|
24
|
+
views?: readonly 'hours'[];
|
|
20
25
|
/**
|
|
21
26
|
* Override or extend the styles applied to the component.
|
|
22
27
|
*/
|
|
@@ -62,7 +62,7 @@ export const LocalizationProvider = function LocalizationProvider(inProps) {
|
|
|
62
62
|
instance: dateLibInstance
|
|
63
63
|
});
|
|
64
64
|
if (!adapter.isMUIAdapter) {
|
|
65
|
-
throw new Error(['MUI: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`', "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", 'More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation'].join(`\n`));
|
|
65
|
+
throw new Error(['MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`', "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", 'More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation'].join(`\n`));
|
|
66
66
|
}
|
|
67
67
|
return adapter;
|
|
68
68
|
}, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentUtils]);
|
|
@@ -486,6 +486,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
486
486
|
view: PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']),
|
|
487
487
|
/**
|
|
488
488
|
* Available views.
|
|
489
|
+
* @default ['hours', 'minutes']
|
|
489
490
|
*/
|
|
490
491
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired)
|
|
491
492
|
} : void 0;
|
|
@@ -28,6 +28,11 @@ export interface MultiSectionDigitalClockSlotProps {
|
|
|
28
28
|
digitalClockSectionItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
29
29
|
}
|
|
30
30
|
export interface MultiSectionDigitalClockProps<TDate> extends ExportedMultiSectionDigitalClockProps<TDate>, BaseClockProps<TDate, TimeViewWithMeridiem> {
|
|
31
|
+
/**
|
|
32
|
+
* Available views.
|
|
33
|
+
* @default ['hours', 'minutes']
|
|
34
|
+
*/
|
|
35
|
+
views?: readonly TimeViewWithMeridiem[];
|
|
31
36
|
/**
|
|
32
37
|
* Override or extend the styles applied to the component.
|
|
33
38
|
*/
|
|
@@ -119,7 +119,7 @@ const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSection
|
|
|
119
119
|
const handleRootRef = useForkRef(ref, rootRef);
|
|
120
120
|
const getRoot = methodName => {
|
|
121
121
|
if (!rootRef.current) {
|
|
122
|
-
throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component
|
|
122
|
+
throw new Error(`MUI X: Cannot call sectionListRef.${methodName} before the mount of the component.`);
|
|
123
123
|
}
|
|
124
124
|
return rootRef.current;
|
|
125
125
|
};
|
package/TimeClock/TimeClock.js
CHANGED
|
@@ -463,6 +463,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
463
463
|
view: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
464
464
|
/**
|
|
465
465
|
* Available views.
|
|
466
|
+
* @default ['hours', 'minutes']
|
|
466
467
|
*/
|
|
467
468
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
468
469
|
} : void 0;
|
|
@@ -15,6 +15,11 @@ export interface TimeClockSlots extends PickersArrowSwitcherSlots {
|
|
|
15
15
|
export interface TimeClockSlotProps extends PickersArrowSwitcherSlotProps {
|
|
16
16
|
}
|
|
17
17
|
export interface TimeClockProps<TDate, TView extends TimeViewWithMeridiem = TimeView> extends ExportedTimeClockProps<TDate>, BaseClockProps<TDate, TView> {
|
|
18
|
+
/**
|
|
19
|
+
* Available views.
|
|
20
|
+
* @default ['hours', 'minutes']
|
|
21
|
+
*/
|
|
22
|
+
views?: readonly TView[];
|
|
18
23
|
/**
|
|
19
24
|
* Override or extend the styles applied to the component.
|
|
20
25
|
*/
|
|
@@ -42,8 +42,8 @@ export const useClearableField = props => {
|
|
|
42
42
|
});
|
|
43
43
|
return _extends({}, other, {
|
|
44
44
|
InputProps: _extends({}, InputProps, {
|
|
45
|
-
endAdornment:
|
|
46
|
-
children: [/*#__PURE__*/_jsx(InputAdornment, {
|
|
45
|
+
endAdornment: /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
+
children: [clearable && /*#__PURE__*/_jsx(InputAdornment, {
|
|
47
47
|
position: "end",
|
|
48
48
|
sx: {
|
|
49
49
|
marginRight: InputProps != null && InputProps.endAdornment ? -1 : -1.5
|
|
@@ -55,7 +55,7 @@ export const useClearableField = props => {
|
|
|
55
55
|
}, endClearIconProps))
|
|
56
56
|
}))
|
|
57
57
|
}), InputProps == null ? void 0 : InputProps.endAdornment]
|
|
58
|
-
})
|
|
58
|
+
})
|
|
59
59
|
}),
|
|
60
60
|
sx: [{
|
|
61
61
|
'& .clearButton': {
|
package/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FormControlState } from '@mui/material/FormControl';
|
|
3
3
|
import { PickersInputProps } from './PickersInput.types';
|
|
4
|
-
export declare const PickersInputRoot: import("@emotion/styled").StyledComponent<
|
|
5
|
-
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
6
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>>, "hidden" | "content" | "style" | "translate" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "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" | "onResize" | "onResizeCapture" | "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" | keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
|
+
export declare const PickersInputRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
7
5
|
ownerState: OwnerStateType;
|
|
8
|
-
},
|
|
6
|
+
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
9
7
|
export declare const PickersInputSectionsContainer: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement> | keyof import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
10
8
|
ownerState: OwnerStateType;
|
|
11
9
|
}, {}, {}>;
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "inputProps", "inputRef", "sectionListRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import Box from '@mui/material/Box';
|
|
6
5
|
import { useFormControl } from '@mui/material/FormControl';
|
|
7
6
|
import { styled } from '@mui/material/styles';
|
|
8
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
@@ -14,7 +13,7 @@ import { Unstable_PickersSectionList as PickersSectionList, Unstable_PickersSect
|
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
15
|
const round = value => Math.round(value * 1e5) / 1e5;
|
|
17
|
-
export const PickersInputRoot = styled(
|
|
16
|
+
export const PickersInputRoot = styled('div', {
|
|
18
17
|
name: 'MuiPickersInput',
|
|
19
18
|
slot: 'Root',
|
|
20
19
|
overridesResolver: (props, styles) => styles.root
|
|
@@ -160,7 +159,7 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
|
|
|
160
159
|
const handleInputRef = useForkRef(inputProps == null ? void 0 : inputProps.ref, inputRef);
|
|
161
160
|
const muiFormControl = useFormControl();
|
|
162
161
|
if (!muiFormControl) {
|
|
163
|
-
throw new Error('MUI: PickersInput should always be used inside a PickersTextField component');
|
|
162
|
+
throw new Error('MUI X: PickersInput should always be used inside a PickersTextField component');
|
|
164
163
|
}
|
|
165
164
|
const handleInputFocus = event => {
|
|
166
165
|
var _muiFormControl$onFoc;
|
|
@@ -3,7 +3,7 @@ import { getMonthsInYear } from '../../utils/date-utils';
|
|
|
3
3
|
export const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
|
|
4
4
|
const config = utils.formatTokenMap[formatToken];
|
|
5
5
|
if (config == null) {
|
|
6
|
-
throw new Error([`MUI: The token "${formatToken}" is not supported by the Date and Time Pickers.`, 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
|
|
6
|
+
throw new Error([`MUI X: The token "${formatToken}" is not supported by the Date and Time Pickers.`, 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
|
|
7
7
|
}
|
|
8
8
|
if (typeof config === 'string') {
|
|
9
9
|
return {
|
|
@@ -80,7 +80,7 @@ export const cleanLeadingZeros = (utils, valueStr, size) => {
|
|
|
80
80
|
export const cleanDigitSectionValue = (utils, timezone, value, sectionBoundaries, section) => {
|
|
81
81
|
if (process.env.NODE_ENV !== 'production') {
|
|
82
82
|
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
83
|
-
throw new Error([`MUI: The token "${section.format}" is a digit format with letter in it.'
|
|
83
|
+
throw new Error([`MUI X: The token "${section.format}" is a digit format with letter in it.'
|
|
84
84
|
This type of format is only supported for 'day' sections`].join('\n'));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -356,7 +356,7 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
356
356
|
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
357
357
|
} else {
|
|
358
358
|
if (sectionConfig.maxLength == null) {
|
|
359
|
-
throw new Error(`MUI: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
359
|
+
throw new Error(`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
360
360
|
}
|
|
361
361
|
maxLength = sectionConfig.maxLength;
|
|
362
362
|
if (isValidDate) {
|
|
@@ -387,7 +387,7 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
387
387
|
nextFormat = utils.expandFormat(prevFormat);
|
|
388
388
|
formatExpansionOverflow -= 1;
|
|
389
389
|
if (formatExpansionOverflow < 0) {
|
|
390
|
-
throw new Error('MUI: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component');
|
|
390
|
+
throw new Error('MUI X: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component.');
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
const expandedFormat = nextFormat;
|
|
@@ -601,7 +601,7 @@ export const validateSections = (sections, valueType) => {
|
|
|
601
601
|
}
|
|
602
602
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
603
603
|
if (invalidSection) {
|
|
604
|
-
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
604
|
+
console.warn(`MUI X: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
605
605
|
warnedOnceInvalidSection = true;
|
|
606
606
|
}
|
|
607
607
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { usePicker } from './usePicker';
|
|
2
2
|
export type { UsePickerProps, UsePickerBaseProps, UsePickerParams, UsePickerResponse, } from './usePicker.types';
|
|
3
|
-
export type { PickerValueManager, PickerSelectionState } from './usePickerValue.types';
|
|
3
|
+
export type { PickerValueManager, PickerSelectionState, UsePickerValueFieldResponse, } from './usePickerValue.types';
|
|
@@ -138,12 +138,12 @@ export const usePickerValue = ({
|
|
|
138
138
|
if (process.env.NODE_ENV !== 'production') {
|
|
139
139
|
React.useEffect(() => {
|
|
140
140
|
if (isControlled !== (inValue !== undefined)) {
|
|
141
|
-
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
141
|
+
console.error([`MUI X: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
142
142
|
}
|
|
143
143
|
}, [inValue]);
|
|
144
144
|
React.useEffect(() => {
|
|
145
145
|
if (!isControlled && defaultValue !== inDefaultValue) {
|
|
146
|
-
console.error([`MUI: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
146
|
+
console.error([`MUI X: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
147
147
|
}
|
|
148
148
|
}, [JSON.stringify(defaultValue)]);
|
|
149
149
|
}
|
|
@@ -5,10 +5,10 @@ import { DEFAULT_LOCALE } from '../../locales/enUS';
|
|
|
5
5
|
export const useLocalizationContext = () => {
|
|
6
6
|
const localization = React.useContext(MuiPickersAdapterContext);
|
|
7
7
|
if (localization === null) {
|
|
8
|
-
throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
8
|
+
throw new Error(['MUI X: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
9
9
|
}
|
|
10
10
|
if (localization.utils === null) {
|
|
11
|
-
throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
11
|
+
throw new Error(['MUI X: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
12
12
|
}
|
|
13
13
|
const localeText = React.useMemo(() => _extends({}, DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
|
|
14
14
|
return React.useMemo(() => _extends({}, localization, {
|
|
@@ -16,11 +16,11 @@ export function useViews({
|
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
17
|
if (!warnedOnceNotValidView) {
|
|
18
18
|
if (inView != null && !views.includes(inView)) {
|
|
19
|
-
console.warn(`MUI: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
19
|
+
console.warn(`MUI X: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
20
20
|
warnedOnceNotValidView = true;
|
|
21
21
|
}
|
|
22
22
|
if (inView == null && openTo != null && !views.includes(openTo)) {
|
|
23
|
-
console.warn(`MUI: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
23
|
+
console.warn(`MUI X: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
24
24
|
warnedOnceNotValidView = true;
|
|
25
25
|
}
|
|
26
26
|
}
|
package/internals/index.d.ts
CHANGED
|
@@ -33,18 +33,22 @@ export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, UsePickerV
|
|
|
33
33
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
34
34
|
export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
|
|
35
35
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow, } from './hooks/useUtils';
|
|
36
|
-
export type { ExportedUseViewsOptions } from './hooks/useViews';
|
|
36
|
+
export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
|
|
37
|
+
export { useViews } from './hooks/useViews';
|
|
37
38
|
export { useValidation } from './hooks/useValidation';
|
|
38
39
|
export type { ValidationProps, Validator, InferError } from './hooks/useValidation';
|
|
39
40
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
40
41
|
export type { BaseFieldProps, FieldsTextFieldProps } from './models/fields';
|
|
41
42
|
export type { BasePickerProps, BasePickerInputProps, BaseNonStaticPickerProps, } from './models/props/basePickerProps';
|
|
43
|
+
export type { BaseClockProps, DesktopOnlyTimePickerProps } from './models/props/clock';
|
|
44
|
+
export type { BaseTabsProps, ExportedBaseTabsProps } from './models/props/tabs';
|
|
42
45
|
export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/toolbar';
|
|
43
46
|
export type { DefaultizedProps, MakeOptional } from './models/helpers';
|
|
44
|
-
export type { WrapperVariant } from './models/common';
|
|
47
|
+
export type { WrapperVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem, } from './models/common';
|
|
45
48
|
export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
|
|
46
49
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
47
|
-
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, } from './utils/date-utils';
|
|
50
|
+
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
|
|
51
|
+
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
48
52
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
49
53
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
50
54
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, } from './utils/utils';
|
|
@@ -53,8 +57,10 @@ export { extractValidationProps } from './utils/validation/extractValidationProp
|
|
|
53
57
|
export { validateDate } from './utils/validation/validateDate';
|
|
54
58
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
55
59
|
export { validateTime } from './utils/validation/validateTime';
|
|
60
|
+
export { applyDefaultViewProps } from './utils/views';
|
|
56
61
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
57
62
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
58
63
|
export type { DayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, ExportedDayCalendarProps, } from '../DateCalendar/DayCalendar';
|
|
59
64
|
export type { ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
|
60
65
|
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
66
|
+
export { isTimeView } from './utils/time-utils';
|
package/internals/index.js
CHANGED
|
@@ -14,10 +14,12 @@ export { useField, createDateStrForInputFromSections, addPositionPropertiesToSec
|
|
|
14
14
|
export { usePicker } from './hooks/usePicker';
|
|
15
15
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
16
16
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
|
|
17
|
+
export { useViews } from './hooks/useViews';
|
|
17
18
|
export { useValidation } from './hooks/useValidation';
|
|
18
19
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
19
20
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
20
|
-
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate } from './utils/date-utils';
|
|
21
|
+
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
|
|
22
|
+
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
21
23
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
22
24
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
23
25
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
|
@@ -26,6 +28,8 @@ export { extractValidationProps } from './utils/validation/extractValidationProp
|
|
|
26
28
|
export { validateDate } from './utils/validation/validateDate';
|
|
27
29
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
28
30
|
export { validateTime } from './utils/validation/validateTime';
|
|
31
|
+
export { applyDefaultViewProps } from './utils/views';
|
|
29
32
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
30
33
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
31
|
-
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
34
|
+
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
35
|
+
export { isTimeView } from './utils/time-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateView, TimeView } from '
|
|
1
|
+
import { DateView, TimeView } from '../../models/views';
|
|
2
2
|
export type WrapperVariant = 'mobile' | 'desktop' | null;
|
|
3
3
|
export type TimeViewWithMeridiem = TimeView | 'meridiem';
|
|
4
4
|
export type DateOrTimeViewWithMeridiem = DateView | TimeViewWithMeridiem;
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type ExtendMui<C, Removals extends keyof C = never> = Omit<C, 'classes' | 'theme' | Removals>;
|
|
7
7
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
8
|
+
export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
8
9
|
export type DefaultizedProps<P extends {}, RequiredProps extends keyof P, AdditionalProps extends {} = {}> = Omit<P, RequiredProps | keyof AdditionalProps> & Required<Pick<P, RequiredProps>> & AdditionalProps;
|
package/internals/utils/views.js
CHANGED
|
@@ -19,7 +19,7 @@ export const applyDefaultViewProps = ({
|
|
|
19
19
|
} else if (viewsWithDefault.length > 0) {
|
|
20
20
|
openToWithDefault = viewsWithDefault[0];
|
|
21
21
|
} else {
|
|
22
|
-
throw new Error('MUI: The `views` prop must contain at least one view');
|
|
22
|
+
throw new Error('MUI X: The `views` prop must contain at least one view.');
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
25
|
views: viewsWithDefault,
|