@mui/x-date-pickers 5.0.7 → 5.0.9
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/CHANGELOG.md +93 -0
- package/DatePicker/DatePickerToolbar.js +1 -8
- package/DateTimePicker/DateTimePickerToolbar.js +12 -6
- package/index.js +1 -1
- package/internals/components/PickersPopper.js +2 -1
- package/internals/components/PickersToolbar.js +6 -2
- package/internals/components/PickersToolbarText.d.ts +1 -1
- package/internals/components/wrappers/DesktopTooltipWrapper.js +2 -2
- package/internals/utils/utils.d.ts +1 -0
- package/internals/utils/utils.js +15 -1
- package/legacy/DatePicker/DatePickerToolbar.js +1 -7
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +17 -10
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersPopper.js +2 -1
- package/legacy/internals/components/PickersToolbar.js +7 -2
- package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +2 -2
- package/legacy/internals/utils/utils.js +16 -1
- package/modern/DatePicker/DatePickerToolbar.js +1 -8
- package/modern/DateTimePicker/DateTimePickerToolbar.js +12 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +2 -1
- package/modern/internals/components/PickersToolbar.js +6 -2
- package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +2 -2
- package/modern/internals/utils/utils.js +15 -1
- package/node/DatePicker/DatePickerToolbar.js +1 -9
- package/node/DateTimePicker/DateTimePickerToolbar.js +13 -7
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +3 -1
- package/node/internals/components/PickersToolbar.js +6 -2
- package/node/internals/components/wrappers/DesktopTooltipWrapper.js +1 -1
- package/node/internals/utils/utils.js +20 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,99 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.17.13
|
|
7
|
+
|
|
8
|
+
_Nov 24, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Fix support of the pickers to Shadow DOM (#6971) @flaviendelangle
|
|
13
|
+
- 💅 Improve DataGrid theme augmentation (#6980) @iigrik
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v5.17.13` / `@mui/x-data-grid-pro@v5.17.13` / `@mui/x-data-grid-premium@v5.17.13`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Fix `ErrorOverlay` not receiving defined input props (#6885) @banoth-ravinder
|
|
21
|
+
- [DataGrid] Improve typing for `styleOverrides` (#6980) @iigrik
|
|
22
|
+
- [DataGridPro] Fix lazy-loaded rows not working with `updateRows` API method (#6875) @cherniavskii
|
|
23
|
+
- [l10n] Fix translation of `filterOperatorBefore` in Arabic (ar-SD) locale (#6917) @HassanGhazy
|
|
24
|
+
|
|
25
|
+
### `@mui/x-date-pickers@v5.0.9` / `@mui/x-date-pickers-pro@v5.0.9`
|
|
26
|
+
|
|
27
|
+
#### Changes
|
|
28
|
+
|
|
29
|
+
- [pickers] Fix usage with Shadow DOM (#6971) @flaviendelangle
|
|
30
|
+
|
|
31
|
+
### Docs
|
|
32
|
+
|
|
33
|
+
- [docs] Add new "Expired package version" error type (#6937) @oliviertassinari
|
|
34
|
+
- [docs] Enforce values for installation options in Date / Time pickers Getting Started page (#6896) @01zulfi
|
|
35
|
+
- [docs] Fix live edit @oliviertassinari
|
|
36
|
+
- [docs] Upgrade to Next 13 (#6911) @cherniavskii
|
|
37
|
+
|
|
38
|
+
### Core
|
|
39
|
+
|
|
40
|
+
- [core] Upgrade monorepo (#6906) @cherniavskii
|
|
41
|
+
- [core] Upgrade node to v14.21 (#6939) @piwysocki
|
|
42
|
+
|
|
43
|
+
## 5.17.12
|
|
44
|
+
|
|
45
|
+
_Nov 17, 2022_
|
|
46
|
+
|
|
47
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
48
|
+
|
|
49
|
+
- 🌍 Improve Finnish (fi-FI) locale (#6859) @RainoPikkarainen
|
|
50
|
+
- 🐞 Bugfixes
|
|
51
|
+
|
|
52
|
+
### `@mui/x-data-grid@v5.17.12` / `@mui/x-data-grid-pro@v5.17.12` / `@mui/x-data-grid-premium@v5.17.12`
|
|
53
|
+
|
|
54
|
+
#### Changes
|
|
55
|
+
|
|
56
|
+
- [DataGrid] Fix conflict with the latest version of `@types/react` (#6883) @vizv
|
|
57
|
+
- [DataGridPremium] Support aggregating data from multiple row fields (#6844) @cherniavskii
|
|
58
|
+
- [DataGridPro] Fix detail panel not working with `getRowSpacing` prop (#6858) @cherniavskii
|
|
59
|
+
- [l10n] Improve Finnish (fi-FI) locale (#6859) @RainoPikkarainen
|
|
60
|
+
|
|
61
|
+
### Docs
|
|
62
|
+
|
|
63
|
+
- [docs] Clarify DataGrid Row Pinning docs (#6891) @cherniavskii
|
|
64
|
+
|
|
65
|
+
### Core
|
|
66
|
+
|
|
67
|
+
- [core] Upgrade monorepo (#6864) @m4theushw
|
|
68
|
+
- [license] Polish error messages (#6881) @oliviertassinari
|
|
69
|
+
|
|
70
|
+
## 5.17.11
|
|
71
|
+
|
|
72
|
+
_Nov 10, 2022_
|
|
73
|
+
|
|
74
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
75
|
+
|
|
76
|
+
- 🐞 Bugfixes
|
|
77
|
+
|
|
78
|
+
### `@mui/x-data-grid@v5.17.11` / `@mui/x-data-grid-pro@v5.17.11` / `@mui/x-data-grid-premium@v5.17.11`
|
|
79
|
+
|
|
80
|
+
#### Changes
|
|
81
|
+
|
|
82
|
+
- [DataGrid] Fix for cell focus preventing scroll when virtualization enabled (#6622) @yaredtsy
|
|
83
|
+
- [DataGridPro] Opt-out for column jump back on re-order (#6697) @gavbrennan
|
|
84
|
+
|
|
85
|
+
### `@mui/x-date-pickers@v5.0.8` / `@mui/x-date-pickers-pro@v5.0.8`
|
|
86
|
+
|
|
87
|
+
#### Changes
|
|
88
|
+
|
|
89
|
+
- [pickers] Fix pickers toolbar styling (#6793) @LukasTy
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [docs] Fix link to localization page (#6766) @alexfauquette
|
|
94
|
+
|
|
95
|
+
### Core
|
|
96
|
+
|
|
97
|
+
- [license] Add new license status 'Out of scope' (#6774) @oliviertassinari
|
|
98
|
+
|
|
6
99
|
## 5.17.10
|
|
7
100
|
|
|
8
101
|
_Nov 4, 2022_
|
|
@@ -6,7 +6,6 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
8
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
9
|
-
import { pickersToolbarClasses } from '../internals/components/pickersToolbarClasses';
|
|
10
9
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
11
10
|
import { isYearAndMonthViews, isYearOnlyView } from './shared';
|
|
12
11
|
import { getDatePickerToolbarUtilityClass } from './datePickerToolbarClasses';
|
|
@@ -27,12 +26,7 @@ const DatePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
27
26
|
name: 'MuiDatePickerToolbar',
|
|
28
27
|
slot: 'Root',
|
|
29
28
|
overridesResolver: (_, styles) => styles.root
|
|
30
|
-
})({
|
|
31
|
-
[`& .${pickersToolbarClasses.penIconButton}`]: {
|
|
32
|
-
position: 'relative',
|
|
33
|
-
top: 4
|
|
34
|
-
}
|
|
35
|
-
});
|
|
29
|
+
})({});
|
|
36
30
|
const DatePickerToolbarTitle = styled(Typography, {
|
|
37
31
|
name: 'MuiDatePickerToolbar',
|
|
38
32
|
slot: 'Title',
|
|
@@ -97,7 +91,6 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
97
91
|
isMobileKeyboardViewOpen: isMobileKeyboardViewOpen,
|
|
98
92
|
toggleMobileKeyboardView: toggleMobileKeyboardView,
|
|
99
93
|
isLandscape: isLandscape,
|
|
100
|
-
ownerState: ownerState,
|
|
101
94
|
className: classes.root
|
|
102
95
|
}, other, {
|
|
103
96
|
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["ampm", "parsedValue", "isMobileKeyboardViewOpen", "onChange", "openView", "setOpenView", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
@@ -30,16 +30,22 @@ const DateTimePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
30
30
|
name: 'MuiDateTimePickerToolbar',
|
|
31
31
|
slot: 'Root',
|
|
32
32
|
overridesResolver: (props, styles) => styles.root
|
|
33
|
-
})({
|
|
33
|
+
})(({
|
|
34
|
+
theme
|
|
35
|
+
}) => ({
|
|
34
36
|
paddingLeft: 16,
|
|
35
37
|
paddingRight: 16,
|
|
36
38
|
justifyContent: 'space-around',
|
|
37
|
-
|
|
39
|
+
position: 'relative',
|
|
40
|
+
[`& .${pickersToolbarClasses.penIconButton}`]: _extends({
|
|
38
41
|
position: 'absolute',
|
|
39
|
-
top: 8
|
|
42
|
+
top: 8
|
|
43
|
+
}, theme.direction === 'rtl' ? {
|
|
44
|
+
left: 8
|
|
45
|
+
} : {
|
|
40
46
|
right: 8
|
|
41
|
-
}
|
|
42
|
-
});
|
|
47
|
+
})
|
|
48
|
+
}));
|
|
43
49
|
const DateTimePickerToolbarDateContainer = styled('div', {
|
|
44
50
|
name: 'MuiDateTimePickerToolbar',
|
|
45
51
|
slot: 'DateContainer',
|
package/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
11
11
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
12
12
|
import { PickersActionBar } from '../../PickersActionBar';
|
|
13
13
|
import { getPickersPopperUtilityClass } from './pickersPopperClasses';
|
|
14
|
+
import { getActiveElement } from '../utils/utils';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
|
|
@@ -213,7 +214,7 @@ export function PickersPopper(inProps) {
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
if (open) {
|
|
216
|
-
lastFocusedElementRef.current = document
|
|
217
|
+
lastFocusedElementRef.current = getActiveElement(document);
|
|
217
218
|
} else if (lastFocusedElementRef.current && lastFocusedElementRef.current instanceof HTMLElement) {
|
|
218
219
|
// make sure the button is flushed with updated label, before returning focus to it
|
|
219
220
|
// avoids issue, where screen reader could fail to announce selected date after selection
|
|
@@ -49,9 +49,13 @@ const PickersToolbarContent = styled(Grid, {
|
|
|
49
49
|
name: 'MuiPickersToolbar',
|
|
50
50
|
slot: 'Content',
|
|
51
51
|
overridesResolver: (props, styles) => styles.content
|
|
52
|
-
})({
|
|
52
|
+
})(({
|
|
53
|
+
ownerState
|
|
54
|
+
}) => _extends({
|
|
53
55
|
flex: 1
|
|
54
|
-
}
|
|
56
|
+
}, !ownerState.isLandscape && {
|
|
57
|
+
alignItems: 'center'
|
|
58
|
+
}));
|
|
55
59
|
const PickersToolbarPenIconButton = styled(IconButton, {
|
|
56
60
|
name: 'MuiPickersToolbar',
|
|
57
61
|
slot: 'PenIconButton',
|
|
@@ -6,4 +6,4 @@ export interface PickersToolbarTextProps extends Omit<TypographyProps, 'classes'
|
|
|
6
6
|
value: React.ReactNode;
|
|
7
7
|
classes?: Partial<PickersToolbarTextClasses>;
|
|
8
8
|
}
|
|
9
|
-
export declare const PickersToolbarText: React.ForwardRefExoticComponent<Pick<PickersToolbarTextProps, "selected" | "p" | "slot" | "style" | "title" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "translate" | "className" | "classes" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "children" | "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" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping" | "value"> & React.RefAttributes<HTMLSpanElement>>;
|
|
9
|
+
export declare const PickersToolbarText: React.ForwardRefExoticComponent<Pick<PickersToolbarTextProps, "selected" | "p" | "slot" | "style" | "title" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "translate" | "className" | "classes" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "children" | "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" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping" | "value"> & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useForkRef } from '@mui/material/utils';
|
|
4
4
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
5
|
-
import { executeInTheNextEventLoopTick } from '../../utils/utils';
|
|
5
|
+
import { executeInTheNextEventLoopTick, getActiveElement } from '../../utils/utils';
|
|
6
6
|
import { PickersPopper } from '../PickersPopper';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -30,7 +30,7 @@ export function DesktopTooltipWrapper(props) {
|
|
|
30
30
|
executeInTheNextEventLoopTick(() => {
|
|
31
31
|
var _inputContainerRef$cu, _popperRef$current;
|
|
32
32
|
|
|
33
|
-
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains(document
|
|
33
|
+
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains(getActiveElement(document)) || (_popperRef$current = popperRef.current) != null && _popperRef$current.contains(getActiveElement(document))) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -3,3 +3,4 @@ export declare function arrayIncludes<T>(array: T[] | readonly T[], itemOrItems:
|
|
|
3
3
|
export declare const onSpaceOrEnter: (innerFn: (ev: React.MouseEvent<any> | React.KeyboardEvent<any>) => void, onFocus?: ((event: React.KeyboardEvent<any>) => void) | undefined) => (event: React.KeyboardEvent) => void;
|
|
4
4
|
export declare const executeInTheNextEventLoopTick: (fn: () => void) => void;
|
|
5
5
|
export declare const doNothing: () => void;
|
|
6
|
+
export declare const getActiveElement: (root?: Document | ShadowRoot) => Element | null;
|
package/internals/utils/utils.js
CHANGED
|
@@ -21,4 +21,18 @@ export const onSpaceOrEnter = (innerFn, onFocus) => event => {
|
|
|
21
21
|
export const executeInTheNextEventLoopTick = fn => {
|
|
22
22
|
setTimeout(fn, 0);
|
|
23
23
|
};
|
|
24
|
-
export const doNothing = () => {};
|
|
24
|
+
export const doNothing = () => {}; // https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
25
|
+
|
|
26
|
+
export const getActiveElement = (root = document) => {
|
|
27
|
+
const activeEl = root.activeElement;
|
|
28
|
+
|
|
29
|
+
if (!activeEl) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (activeEl.shadowRoot) {
|
|
34
|
+
return getActiveElement(activeEl.shadowRoot);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return activeEl;
|
|
38
|
+
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
3
|
var _excluded = ["parsedValue", "isLandscape", "isMobileKeyboardViewOpen", "onChange", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"];
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import Typography from '@mui/material/Typography';
|
|
7
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
9
8
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
10
|
-
import { pickersToolbarClasses } from '../internals/components/pickersToolbarClasses';
|
|
11
9
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
12
10
|
import { isYearAndMonthViews, isYearOnlyView } from './shared';
|
|
13
11
|
import { getDatePickerToolbarUtilityClass } from './datePickerToolbarClasses';
|
|
@@ -28,10 +26,7 @@ var DatePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
28
26
|
overridesResolver: function overridesResolver(_, styles) {
|
|
29
27
|
return styles.root;
|
|
30
28
|
}
|
|
31
|
-
})(
|
|
32
|
-
position: 'relative',
|
|
33
|
-
top: 4
|
|
34
|
-
}));
|
|
29
|
+
})({});
|
|
35
30
|
var DatePickerToolbarTitle = styled(Typography, {
|
|
36
31
|
name: 'MuiDatePickerToolbar',
|
|
37
32
|
slot: 'Title',
|
|
@@ -99,7 +94,6 @@ export var DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePicker
|
|
|
99
94
|
isMobileKeyboardViewOpen: isMobileKeyboardViewOpen,
|
|
100
95
|
toggleMobileKeyboardView: toggleMobileKeyboardView,
|
|
101
96
|
isLandscape: isLandscape,
|
|
102
|
-
ownerState: ownerState,
|
|
103
97
|
className: classes.root
|
|
104
98
|
}, other, {
|
|
105
99
|
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
var _excluded = ["ampm", "parsedValue", "isMobileKeyboardViewOpen", "onChange", "openView", "setOpenView", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
@@ -31,15 +31,22 @@ var DateTimePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
31
31
|
overridesResolver: function overridesResolver(props, styles) {
|
|
32
32
|
return styles.root;
|
|
33
33
|
}
|
|
34
|
-
})(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
})(function (_ref) {
|
|
35
|
+
var theme = _ref.theme;
|
|
36
|
+
return _defineProperty({
|
|
37
|
+
paddingLeft: 16,
|
|
38
|
+
paddingRight: 16,
|
|
39
|
+
justifyContent: 'space-around',
|
|
40
|
+
position: 'relative'
|
|
41
|
+
}, "& .".concat(pickersToolbarClasses.penIconButton), _extends({
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: 8
|
|
44
|
+
}, theme.direction === 'rtl' ? {
|
|
45
|
+
left: 8
|
|
46
|
+
} : {
|
|
47
|
+
right: 8
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
43
50
|
var DateTimePickerToolbarDateContainer = styled('div', {
|
|
44
51
|
name: 'MuiDateTimePickerToolbar',
|
|
45
52
|
slot: 'DateContainer',
|
package/legacy/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
12
12
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
13
13
|
import { PickersActionBar } from '../../PickersActionBar';
|
|
14
14
|
import { getPickersPopperUtilityClass } from './pickersPopperClasses';
|
|
15
|
+
import { getActiveElement } from '../utils/utils';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
|
|
@@ -219,7 +220,7 @@ export function PickersPopper(inProps) {
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
if (open) {
|
|
222
|
-
lastFocusedElementRef.current = document
|
|
223
|
+
lastFocusedElementRef.current = getActiveElement(document);
|
|
223
224
|
} else if (lastFocusedElementRef.current && lastFocusedElementRef.current instanceof HTMLElement) {
|
|
224
225
|
// make sure the button is flushed with updated label, before returning focus to it
|
|
225
226
|
// avoids issue, where screen reader could fail to announce selected date after selection
|
|
@@ -53,8 +53,13 @@ var PickersToolbarContent = styled(Grid, {
|
|
|
53
53
|
overridesResolver: function overridesResolver(props, styles) {
|
|
54
54
|
return styles.content;
|
|
55
55
|
}
|
|
56
|
-
})({
|
|
57
|
-
|
|
56
|
+
})(function (_ref2) {
|
|
57
|
+
var ownerState = _ref2.ownerState;
|
|
58
|
+
return _extends({
|
|
59
|
+
flex: 1
|
|
60
|
+
}, !ownerState.isLandscape && {
|
|
61
|
+
alignItems: 'center'
|
|
62
|
+
});
|
|
58
63
|
});
|
|
59
64
|
var PickersToolbarPenIconButton = styled(IconButton, {
|
|
60
65
|
name: 'MuiPickersToolbar',
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useForkRef } from '@mui/material/utils';
|
|
4
4
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
5
|
-
import { executeInTheNextEventLoopTick } from '../../utils/utils';
|
|
5
|
+
import { executeInTheNextEventLoopTick, getActiveElement } from '../../utils/utils';
|
|
6
6
|
import { PickersPopper } from '../PickersPopper';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -28,7 +28,7 @@ export function DesktopTooltipWrapper(props) {
|
|
|
28
28
|
executeInTheNextEventLoopTick(function () {
|
|
29
29
|
var _inputContainerRef$cu, _popperRef$current;
|
|
30
30
|
|
|
31
|
-
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains(document
|
|
31
|
+
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains(getActiveElement(document)) || (_popperRef$current = popperRef.current) != null && _popperRef$current.contains(getActiveElement(document))) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -25,4 +25,19 @@ export var onSpaceOrEnter = function onSpaceOrEnter(innerFn, onFocus) {
|
|
|
25
25
|
export var executeInTheNextEventLoopTick = function executeInTheNextEventLoopTick(fn) {
|
|
26
26
|
setTimeout(fn, 0);
|
|
27
27
|
};
|
|
28
|
-
export var doNothing = function doNothing() {};
|
|
28
|
+
export var doNothing = function doNothing() {}; // https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
29
|
+
|
|
30
|
+
export var getActiveElement = function getActiveElement() {
|
|
31
|
+
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
32
|
+
var activeEl = root.activeElement;
|
|
33
|
+
|
|
34
|
+
if (!activeEl) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (activeEl.shadowRoot) {
|
|
39
|
+
return getActiveElement(activeEl.shadowRoot);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return activeEl;
|
|
43
|
+
};
|
|
@@ -6,7 +6,6 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
8
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
9
|
-
import { pickersToolbarClasses } from '../internals/components/pickersToolbarClasses';
|
|
10
9
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
11
10
|
import { isYearAndMonthViews, isYearOnlyView } from './shared';
|
|
12
11
|
import { getDatePickerToolbarUtilityClass } from './datePickerToolbarClasses';
|
|
@@ -27,12 +26,7 @@ const DatePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
27
26
|
name: 'MuiDatePickerToolbar',
|
|
28
27
|
slot: 'Root',
|
|
29
28
|
overridesResolver: (_, styles) => styles.root
|
|
30
|
-
})({
|
|
31
|
-
[`& .${pickersToolbarClasses.penIconButton}`]: {
|
|
32
|
-
position: 'relative',
|
|
33
|
-
top: 4
|
|
34
|
-
}
|
|
35
|
-
});
|
|
29
|
+
})({});
|
|
36
30
|
const DatePickerToolbarTitle = styled(Typography, {
|
|
37
31
|
name: 'MuiDatePickerToolbar',
|
|
38
32
|
slot: 'Title',
|
|
@@ -97,7 +91,6 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
97
91
|
isMobileKeyboardViewOpen: isMobileKeyboardViewOpen,
|
|
98
92
|
toggleMobileKeyboardView: toggleMobileKeyboardView,
|
|
99
93
|
isLandscape: isLandscape,
|
|
100
|
-
ownerState: ownerState,
|
|
101
94
|
className: classes.root
|
|
102
95
|
}, other, {
|
|
103
96
|
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["ampm", "parsedValue", "isMobileKeyboardViewOpen", "onChange", "openView", "setOpenView", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
@@ -30,16 +30,22 @@ const DateTimePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
30
30
|
name: 'MuiDateTimePickerToolbar',
|
|
31
31
|
slot: 'Root',
|
|
32
32
|
overridesResolver: (props, styles) => styles.root
|
|
33
|
-
})({
|
|
33
|
+
})(({
|
|
34
|
+
theme
|
|
35
|
+
}) => ({
|
|
34
36
|
paddingLeft: 16,
|
|
35
37
|
paddingRight: 16,
|
|
36
38
|
justifyContent: 'space-around',
|
|
37
|
-
|
|
39
|
+
position: 'relative',
|
|
40
|
+
[`& .${pickersToolbarClasses.penIconButton}`]: _extends({
|
|
38
41
|
position: 'absolute',
|
|
39
|
-
top: 8
|
|
42
|
+
top: 8
|
|
43
|
+
}, theme.direction === 'rtl' ? {
|
|
44
|
+
left: 8
|
|
45
|
+
} : {
|
|
40
46
|
right: 8
|
|
41
|
-
}
|
|
42
|
-
});
|
|
47
|
+
})
|
|
48
|
+
}));
|
|
43
49
|
const DateTimePickerToolbarDateContainer = styled('div', {
|
|
44
50
|
name: 'MuiDateTimePickerToolbar',
|
|
45
51
|
slot: 'DateContainer',
|
package/modern/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
11
11
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
12
12
|
import { PickersActionBar } from '../../PickersActionBar';
|
|
13
13
|
import { getPickersPopperUtilityClass } from './pickersPopperClasses';
|
|
14
|
+
import { getActiveElement } from '../utils/utils';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
|
|
@@ -211,7 +212,7 @@ export function PickersPopper(inProps) {
|
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
if (open) {
|
|
214
|
-
lastFocusedElementRef.current = document
|
|
215
|
+
lastFocusedElementRef.current = getActiveElement(document);
|
|
215
216
|
} else if (lastFocusedElementRef.current && lastFocusedElementRef.current instanceof HTMLElement) {
|
|
216
217
|
// make sure the button is flushed with updated label, before returning focus to it
|
|
217
218
|
// avoids issue, where screen reader could fail to announce selected date after selection
|
|
@@ -49,9 +49,13 @@ const PickersToolbarContent = styled(Grid, {
|
|
|
49
49
|
name: 'MuiPickersToolbar',
|
|
50
50
|
slot: 'Content',
|
|
51
51
|
overridesResolver: (props, styles) => styles.content
|
|
52
|
-
})({
|
|
52
|
+
})(({
|
|
53
|
+
ownerState
|
|
54
|
+
}) => _extends({
|
|
53
55
|
flex: 1
|
|
54
|
-
}
|
|
56
|
+
}, !ownerState.isLandscape && {
|
|
57
|
+
alignItems: 'center'
|
|
58
|
+
}));
|
|
55
59
|
const PickersToolbarPenIconButton = styled(IconButton, {
|
|
56
60
|
name: 'MuiPickersToolbar',
|
|
57
61
|
slot: 'PenIconButton',
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useForkRef } from '@mui/material/utils';
|
|
4
4
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
5
|
-
import { executeInTheNextEventLoopTick } from '../../utils/utils';
|
|
5
|
+
import { executeInTheNextEventLoopTick, getActiveElement } from '../../utils/utils';
|
|
6
6
|
import { PickersPopper } from '../PickersPopper';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -28,7 +28,7 @@ export function DesktopTooltipWrapper(props) {
|
|
|
28
28
|
|
|
29
29
|
const handleBlur = () => {
|
|
30
30
|
executeInTheNextEventLoopTick(() => {
|
|
31
|
-
if (inputContainerRef.current?.contains(document
|
|
31
|
+
if (inputContainerRef.current?.contains(getActiveElement(document)) || popperRef.current?.contains(getActiveElement(document))) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -21,4 +21,18 @@ export const onSpaceOrEnter = (innerFn, onFocus) => event => {
|
|
|
21
21
|
export const executeInTheNextEventLoopTick = fn => {
|
|
22
22
|
setTimeout(fn, 0);
|
|
23
23
|
};
|
|
24
|
-
export const doNothing = () => {};
|
|
24
|
+
export const doNothing = () => {}; // https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
25
|
+
|
|
26
|
+
export const getActiveElement = (root = document) => {
|
|
27
|
+
const activeEl = root.activeElement;
|
|
28
|
+
|
|
29
|
+
if (!activeEl) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (activeEl.shadowRoot) {
|
|
34
|
+
return getActiveElement(activeEl.shadowRoot);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return activeEl;
|
|
38
|
+
};
|
|
@@ -21,8 +21,6 @@ var _material = require("@mui/material");
|
|
|
21
21
|
|
|
22
22
|
var _PickersToolbar = require("../internals/components/PickersToolbar");
|
|
23
23
|
|
|
24
|
-
var _pickersToolbarClasses = require("../internals/components/pickersToolbarClasses");
|
|
25
|
-
|
|
26
24
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
27
25
|
|
|
28
26
|
var _shared = require("./shared");
|
|
@@ -52,12 +50,7 @@ const DatePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToolbar
|
|
|
52
50
|
name: 'MuiDatePickerToolbar',
|
|
53
51
|
slot: 'Root',
|
|
54
52
|
overridesResolver: (_, styles) => styles.root
|
|
55
|
-
})({
|
|
56
|
-
[`& .${_pickersToolbarClasses.pickersToolbarClasses.penIconButton}`]: {
|
|
57
|
-
position: 'relative',
|
|
58
|
-
top: 4
|
|
59
|
-
}
|
|
60
|
-
});
|
|
53
|
+
})({});
|
|
61
54
|
const DatePickerToolbarTitle = (0, _styles.styled)(_Typography.default, {
|
|
62
55
|
name: 'MuiDatePickerToolbar',
|
|
63
56
|
slot: 'Title',
|
|
@@ -120,7 +113,6 @@ const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolb
|
|
|
120
113
|
isMobileKeyboardViewOpen: isMobileKeyboardViewOpen,
|
|
121
114
|
toggleMobileKeyboardView: toggleMobileKeyboardView,
|
|
122
115
|
isLandscape: isLandscape,
|
|
123
|
-
ownerState: ownerState,
|
|
124
116
|
className: classes.root
|
|
125
117
|
}, other, {
|
|
126
118
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerToolbarTitle, {
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.DateTimePickerToolbar = DateTimePickerToolbar;
|
|
9
9
|
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
14
|
var React = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
16
|
var _styles = require("@mui/material/styles");
|
|
@@ -54,16 +54,22 @@ const DateTimePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToo
|
|
|
54
54
|
name: 'MuiDateTimePickerToolbar',
|
|
55
55
|
slot: 'Root',
|
|
56
56
|
overridesResolver: (props, styles) => styles.root
|
|
57
|
-
})({
|
|
57
|
+
})(({
|
|
58
|
+
theme
|
|
59
|
+
}) => ({
|
|
58
60
|
paddingLeft: 16,
|
|
59
61
|
paddingRight: 16,
|
|
60
62
|
justifyContent: 'space-around',
|
|
61
|
-
|
|
63
|
+
position: 'relative',
|
|
64
|
+
[`& .${_pickersToolbarClasses.pickersToolbarClasses.penIconButton}`]: (0, _extends2.default)({
|
|
62
65
|
position: 'absolute',
|
|
63
|
-
top: 8
|
|
66
|
+
top: 8
|
|
67
|
+
}, theme.direction === 'rtl' ? {
|
|
68
|
+
left: 8
|
|
69
|
+
} : {
|
|
64
70
|
right: 8
|
|
65
|
-
}
|
|
66
|
-
});
|
|
71
|
+
})
|
|
72
|
+
}));
|
|
67
73
|
const DateTimePickerToolbarDateContainer = (0, _styles.styled)('div', {
|
|
68
74
|
name: 'MuiDateTimePickerToolbar',
|
|
69
75
|
slot: 'DateContainer',
|
package/node/index.js
CHANGED
|
@@ -31,6 +31,8 @@ var _PickersActionBar = require("../../PickersActionBar");
|
|
|
31
31
|
|
|
32
32
|
var _pickersPopperClasses = require("./pickersPopperClasses");
|
|
33
33
|
|
|
34
|
+
var _utils2 = require("../utils/utils");
|
|
35
|
+
|
|
34
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
37
|
|
|
36
38
|
const _excluded = ["onClick", "onTouchStart"];
|
|
@@ -238,7 +240,7 @@ function PickersPopper(inProps) {
|
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
if (open) {
|
|
241
|
-
lastFocusedElementRef.current = document
|
|
243
|
+
lastFocusedElementRef.current = (0, _utils2.getActiveElement)(document);
|
|
242
244
|
} else if (lastFocusedElementRef.current && lastFocusedElementRef.current instanceof HTMLElement) {
|
|
243
245
|
// make sure the button is flushed with updated label, before returning focus to it
|
|
244
246
|
// avoids issue, where screen reader could fail to announce selected date after selection
|
|
@@ -72,9 +72,13 @@ const PickersToolbarContent = (0, _styles.styled)(_Grid.default, {
|
|
|
72
72
|
name: 'MuiPickersToolbar',
|
|
73
73
|
slot: 'Content',
|
|
74
74
|
overridesResolver: (props, styles) => styles.content
|
|
75
|
-
})({
|
|
75
|
+
})(({
|
|
76
|
+
ownerState
|
|
77
|
+
}) => (0, _extends2.default)({
|
|
76
78
|
flex: 1
|
|
77
|
-
}
|
|
79
|
+
}, !ownerState.isLandscape && {
|
|
80
|
+
alignItems: 'center'
|
|
81
|
+
}));
|
|
78
82
|
const PickersToolbarPenIconButton = (0, _styles.styled)(_IconButton.default, {
|
|
79
83
|
name: 'MuiPickersToolbar',
|
|
80
84
|
slot: 'PenIconButton',
|
|
@@ -49,7 +49,7 @@ function DesktopTooltipWrapper(props) {
|
|
|
49
49
|
(0, _utils2.executeInTheNextEventLoopTick)(() => {
|
|
50
50
|
var _inputContainerRef$cu, _popperRef$current;
|
|
51
51
|
|
|
52
|
-
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains(
|
|
52
|
+
if ((_inputContainerRef$cu = inputContainerRef.current) != null && _inputContainerRef$cu.contains((0, _utils2.getActiveElement)(document)) || (_popperRef$current = popperRef.current) != null && _popperRef$current.contains((0, _utils2.getActiveElement)(document))) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.arrayIncludes = arrayIncludes;
|
|
7
|
-
exports.onSpaceOrEnter = exports.executeInTheNextEventLoopTick = exports.doNothing = void 0;
|
|
7
|
+
exports.onSpaceOrEnter = exports.getActiveElement = exports.executeInTheNextEventLoopTick = exports.doNothing = void 0;
|
|
8
8
|
|
|
9
9
|
/* Use it instead of .includes method for IE support */
|
|
10
10
|
function arrayIncludes(array, itemOrItems) {
|
|
@@ -36,6 +36,23 @@ const executeInTheNextEventLoopTick = fn => {
|
|
|
36
36
|
|
|
37
37
|
exports.executeInTheNextEventLoopTick = executeInTheNextEventLoopTick;
|
|
38
38
|
|
|
39
|
-
const doNothing = () => {};
|
|
39
|
+
const doNothing = () => {}; // https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
exports.doNothing = doNothing;
|
|
43
|
+
|
|
44
|
+
const getActiveElement = (root = document) => {
|
|
45
|
+
const activeEl = root.activeElement;
|
|
46
|
+
|
|
47
|
+
if (!activeEl) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (activeEl.shadowRoot) {
|
|
52
|
+
return getActiveElement(activeEl.shadowRoot);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return activeEl;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.getActiveElement = getActiveElement;
|