@mui/x-date-pickers 5.0.8 → 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 +64 -0
- package/index.js +1 -1
- package/internals/components/PickersPopper.js +2 -1
- 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/index.js +1 -1
- package/legacy/internals/components/PickersPopper.js +2 -1
- package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +2 -2
- package/legacy/internals/utils/utils.js +16 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +2 -1
- package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +2 -2
- package/modern/internals/utils/utils.js +15 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +3 -1
- 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,70 @@
|
|
|
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
|
+
|
|
6
70
|
## 5.17.11
|
|
7
71
|
|
|
8
72
|
_Nov 10, 2022_
|
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
|
|
@@ -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
|
+
};
|
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
|
|
@@ -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
|
+
};
|
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
|
|
@@ -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
|
+
};
|
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
|
|
@@ -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;
|