@mui/utils 7.3.5 → 7.3.7
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 +144 -1
- package/elementTypeAcceptingRef/elementTypeAcceptingRef.js +5 -0
- package/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js +4 -0
- package/esm/getActiveElement/getActiveElement.d.ts +20 -0
- package/esm/getActiveElement/getActiveElement.js +26 -0
- package/esm/getActiveElement/index.d.ts +1 -0
- package/esm/getActiveElement/index.js +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/getActiveElement/getActiveElement.d.ts +20 -0
- package/getActiveElement/getActiveElement.js +32 -0
- package/getActiveElement/index.d.ts +1 -0
- package/getActiveElement/index.js +13 -0
- package/index.d.ts +1 -0
- package/index.js +9 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 7.3.7
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v7.3.6..master -->
|
|
6
|
+
|
|
7
|
+
_Jan 8, 2026_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 16 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@7.3.7`
|
|
12
|
+
|
|
13
|
+
- [accordion] Remove unnecessary handling of `square` prop on Accordion Root (#47457) @ZeeshanTamboli
|
|
14
|
+
- [alert] Remove unnecessary default icon mapping fallback (#47460) @ZeeshanTamboli
|
|
15
|
+
- [appbar] Fix inherit color CSS variable not getting applied (#47518) @ZeeshanTamboli
|
|
16
|
+
- [autocomplete] Fix `ArrowLeft`, `Backspace` & `Delete` behavior for multiple and single-value rendering with proper caret handling (#47411) @jnbain
|
|
17
|
+
- [backdrop] Remove unnecessary passing of `classes` from root slot (#47519) @ZeeshanTamboli
|
|
18
|
+
- [button-group] Fix styles when variant is `contained` (#47499) @ZeeshanTamboli
|
|
19
|
+
- [card-action-area] Remove incorrect root ref being forwarded to focus highlight component (#47523) @ZeeshanTamboli
|
|
20
|
+
- [checkbox] Fix readonly checkboxes (#47503) @mj12albert
|
|
21
|
+
- [click-away-listener] Tighten the parameter type of createHandleSynthetic method (#47525) @ZeeshanTamboli
|
|
22
|
+
- [dialog] Fix backdrop theme style overrides (#47544) @ZeeshanTamboli
|
|
23
|
+
- [focus-trap] Compute `activeElement` inside `loopFocus` on every keydown (#47566) @ZeeshanTamboli
|
|
24
|
+
- [modal] Take non-integer padding-right into consideration when scroll locking (#47420) @Zache
|
|
25
|
+
- [select] Fix dropdown width does not match trigger width on window resize (#47526) @AarishMansur
|
|
26
|
+
- [tabs] Fix passing incorrect slot name props (scrollButton → scrollButtons) (#47215) @rithik56
|
|
27
|
+
|
|
28
|
+
### Docs
|
|
29
|
+
|
|
30
|
+
- [card] Fix key warning (#47524) @ZeeshanTamboli
|
|
31
|
+
- [dialog] Replace TranstionProps with slotProps.transition (#47569) @sai6855
|
|
32
|
+
- [number-field] Use stable Base UI package (#47504) @siriwatknp
|
|
33
|
+
- [snackbar] Replace TransitionComponent with slots.transition (#47570) @sai6855
|
|
34
|
+
- Fix incorrect indentation in migration guide (#47571) @sai6855
|
|
35
|
+
- Enable MUI chat on Material UI demos (#46837) @siriwatknp
|
|
36
|
+
- Add docs and website banner for Dev survey'25 (#47521) @prakhargupta1
|
|
37
|
+
- Update Tailwind CSS v4 + Next.js Pages Router docs (#47546) @atharva3333
|
|
38
|
+
- Add warning callout to Sync plugin doc (#47511) @mapache-salvaje
|
|
39
|
+
- Update typo in TailwindCSS v4 integration with Next.js docs (#47512) @TimKraemer
|
|
40
|
+
- Fix link to contributing guide (#47473) @oliviertassinari
|
|
41
|
+
- Improve description of Accordion props (#47459) @ZeeshanTamboli
|
|
42
|
+
|
|
43
|
+
### Core
|
|
44
|
+
|
|
45
|
+
- [blog] Whats new since MUI X v8 [DX-51] (#47140) @joserodolfofreitas
|
|
46
|
+
- [code-infra] Fix React@next CI job (#47493) @Janpot
|
|
47
|
+
- [code-infra] Move font loading to @mui/docs (#47385) @Janpot
|
|
48
|
+
- [code-infra] Fix CI for React 18 (#47560) @Janpot
|
|
49
|
+
- [code-infra] Prevent legacy browsers tests from updating (#47496) @Janpot
|
|
50
|
+
- [code-infra] Move `@mui/internal-test-utils` to code infra repo (#47422) @Janpot
|
|
51
|
+
- [code-infra] Fix React@next CI job (#47493) @Janpot
|
|
52
|
+
- [examples] Update Next.js versions to v16 in Next.js examples (DX-57) (#47453) @alelthomas
|
|
53
|
+
- [internal] Bump Next.js & React version to avoid security vulnerability (#47427) @oliviertassinari
|
|
54
|
+
- [test] Use plain playwright for e2e (#47410) @mj12albert
|
|
55
|
+
- [test] Fix react-18 tests (#47407) @Janpot
|
|
56
|
+
|
|
57
|
+
All contributors of this release in alphabetical order: @AarishMansur, @alelthomas, @atharva3333, @bricefrisco, @Janpot, @jnbain, @joserodolfofreitas, @mapache-salvaje, @mj12albert, @oliviertassinari, @prakhargupta1, @rithik56, @siriwatknp, @TimKraemer, @Zache, @ZeeshanTamboli
|
|
58
|
+
|
|
59
|
+
## 7.3.6
|
|
60
|
+
|
|
61
|
+
<!-- generated comparing v7.3.5..master -->
|
|
62
|
+
|
|
63
|
+
_Dec 3, 2025_
|
|
64
|
+
|
|
65
|
+
A big thanks to the 22 contributors who made this release possible.
|
|
66
|
+
|
|
67
|
+
### @mui/material@7.3.6
|
|
68
|
+
|
|
69
|
+
- [Accordion] Move properties to the AccordionOwnProps interface (#47348) @Aleksan4e3
|
|
70
|
+
- [Autocomplete] Remove unnecessary `filterSelectedOptions` dependency from `syncHighlightedIndex` useCallback (#47378) @ZeeshanTamboli
|
|
71
|
+
- [Autocomplete] Fix input caret not showing when focusing after chip navigation (#47249) @vrachuri28
|
|
72
|
+
- [Autocomplete] Fix ArrowLeft crash when value is not set with single-value rendering (#47214) @rithik56
|
|
73
|
+
- [Button] Fix running formAction when passed (#47185) @sai6855
|
|
74
|
+
- [Chip] Remove leftover closing parenthesis in CSS class key (#47345) @ZeeshanTamboli
|
|
75
|
+
- [ListItem] Add `secondaryAction` slot to `ListItem` (#47399) @sai6855
|
|
76
|
+
- [NumberField] Fix scroll behavior (#47397) @oliviertassinari
|
|
77
|
+
- [Select] Fix keyboard navigation while rendering in shadow DOM (#47380) @xBlizZer
|
|
78
|
+
- [Select] Fix cannot pass certain event handlers (#47366) @ZeeshanTamboli
|
|
79
|
+
- [Slider] Accept readonly array for `marks` prop (#47370) @pcorpet
|
|
80
|
+
- [Snackbar] Avoid unnecessary `ownerState` spread into `useSnackbar` (#47373) @ZeeshanTamboli
|
|
81
|
+
- [TextField] Allow custom props in slot props via TS module augmentation (#47367) @kumarvishwajeettrivedi
|
|
82
|
+
- [Tabs] Fix Arrow key navigation failing when component is rendered in shadow DOM (#47178) @sai6855
|
|
83
|
+
- Fix typings for theme `applyStyles` with custom color schemes (#47242) @akankshahu
|
|
84
|
+
|
|
85
|
+
### @mui/system@7.3.6
|
|
86
|
+
|
|
87
|
+
- Fix unwanted attribute on DOM from InitColorSchemeScript `class` attribute (#47200) @siriwatknp
|
|
88
|
+
|
|
89
|
+
### @mui/lab@7.3.6
|
|
90
|
+
|
|
91
|
+
- [Masonry] Fix layout flicker and single column issue (#43903) @Fanzzzd
|
|
92
|
+
|
|
93
|
+
### Docs
|
|
94
|
+
|
|
95
|
+
- Fix default theme viewer styling (#47400) @sai6855
|
|
96
|
+
- Remove repetitive words (#47384) @rifeplight
|
|
97
|
+
- Fix link to Portal API docs (#47383) @ZeeshanTamboli
|
|
98
|
+
- Remove mentions of MUI Base from Material UI docs (#47324) @mapache-salvaje
|
|
99
|
+
- Update CSP guidance (#47342) @rossdakin
|
|
100
|
+
- Fix pathname collision in LLMs docs generator (#47209) @siriwatknp
|
|
101
|
+
- Resolve redirected urls to their final location (#47193) @Janpot
|
|
102
|
+
- Document correct default values for `elevation` and `square` props (#47261) @Ad1tya-007
|
|
103
|
+
- Fix display of colors in dark mode in palette customization page (#47403) @sai6855
|
|
104
|
+
- Add Number Field component page (#47165) @siriwatknp
|
|
105
|
+
- Fix mcp schema change (#47171) @sai6855
|
|
106
|
+
|
|
107
|
+
### Core
|
|
108
|
+
|
|
109
|
+
- [code-infra] Add types for markdown loader (#47075) @Janpot
|
|
110
|
+
- [code-infra] Build test utils with code-infra pipeline (#47405) @Janpot
|
|
111
|
+
- [code-infra] Vitest test migration (#44325) @JCQuintas
|
|
112
|
+
- [code-infra] Revive docs bundle analyzer (#47401) @Janpot
|
|
113
|
+
- [code-infra] Update tests from vitest PR (#47344) @Janpot
|
|
114
|
+
- [code-infra] Use util from code-infra to fetch changelogs (#47350) @brijeshb42
|
|
115
|
+
- [code-infra] Enable production sourcemaps (#47352) @Janpot
|
|
116
|
+
- [code-infra] Use code-infra orb utils in circle ci (#47179) @brijeshb42
|
|
117
|
+
- [code-infra] Use `next/font` for local fonts (#47351) @Janpot
|
|
118
|
+
- [code-infra] New broken links checker (#47113) @Janpot
|
|
119
|
+
- [code-infra] Remove profiler (#47258) @Janpot
|
|
120
|
+
- [code-infra] Api doc optimizations (#47188) @Janpot
|
|
121
|
+
- [code-infra] Increase type check parallelism (#47192) @Janpot
|
|
122
|
+
- [code-infra] Remove deprecated baseUrl (#47210) @Janpot
|
|
123
|
+
- [code-infra] Disable next.js cache (#47233) @Janpot
|
|
124
|
+
- [code-infra] release:build for bundle checker (#47207) @Janpot
|
|
125
|
+
- [code-infra] Parallelize module augmentation tests (#47208) @Janpot
|
|
126
|
+
- [code-infra] Fix next.js parallelism at 2 for macos runner (#47201) @Janpot
|
|
127
|
+
- [code-infra] Fix bash escape (#46969) @oliviertassinari
|
|
128
|
+
- [code-infra] Utilise eslint cache in CI (#47194) @Janpot
|
|
129
|
+
- [code-infra] Enable Next.js build cache to improve CI performance (#47176) @Copilot
|
|
130
|
+
- [code-infra] Remove `apps` folder (#47183) @Janpot
|
|
131
|
+
- [code-infra] Migrate everything to getStaticProps (#47152) @Janpot
|
|
132
|
+
- [docs-infra] Migrate to `next/font` (#47347) @Janpot
|
|
133
|
+
- [docs-infra] Add some `ComponentLinkHeader` bottom margin (#47328) @Janpot
|
|
134
|
+
- [docs-infra] Exclude a few pages from llms-txt (#47111) @Janpot
|
|
135
|
+
- [examples] Add missing .gitignore to NextJS App Router example (#47251) @shamblonaut
|
|
136
|
+
- [examples] Migrate Next.js `next.config.js` to `next.config.mjs` (#44040) @albarv340
|
|
137
|
+
- [internal] Remove leftover testing-library libraries from `mui-material` package (#47392) @ZeeshanTamboli
|
|
138
|
+
- [internal] Remove unnecessary `clean-css` package from docs (#47314) @ZeeshanTamboli
|
|
139
|
+
- [internal] Fix typo `buidApiDocs` -> `buildApiDocs` (#47235) @Ad1tya-007
|
|
140
|
+
- [internal] Remove unused `@vitest/browser` and `@vitest/coverage-v8` (#47189) @ZeeshanTamboli
|
|
141
|
+
- [test] Update e2e test app (#47252) @Ad1tya-007
|
|
142
|
+
- [test] Fix flaky Virtualize Autocomplete regression test (#47199) @ZeeshanTamboli
|
|
143
|
+
|
|
144
|
+
All contributors of this release in alphabetical order: @Ad1tya-007, @akankshahu, @albarv340, @Aleksan4e3, @brijeshb42, @Copilot, @Fanzzzd, @Janpot, @JCQuintas, @kumarvishwajeettrivedi, @mapache-salvaje, @oliviertassinari, @pcorpet, @rifeplight, @rithik56, @rossdakin, @sai6855, @shamblonaut, @siriwatknp, @vrachuri28, @xBlizZer, @ZeeshanTamboli
|
|
145
|
+
|
|
3
146
|
## 7.3.5
|
|
4
147
|
|
|
5
148
|
<!-- generated comparing v7.3.4..master -->
|
|
@@ -666,7 +809,7 @@ A big thanks to the 7 contributors who made this release possible.
|
|
|
666
809
|
- Fix `Grid`, `GridLegacy`, `Stack`, `Badge`, `Select`, `Autocomplete` demos CSS variables (#45693) @DiegoAndai
|
|
667
810
|
- Add "Material UI v7 is here" to the notifications (#45694) @DiegoAndai
|
|
668
811
|
- Fix `Breadcrumbs`, `List`, `Divider`, and `Typography` dark mode demos (#45692) @siriwatknp
|
|
669
|
-
- Fix Material
|
|
812
|
+
- Fix Material Icons page in dark mode (#45691) @mnajdova
|
|
670
813
|
|
|
671
814
|
All contributors of this release in alphabetical order: @aarongarciah, @DiegoAndai, @eduter, @Janpot, @micttyoid, @mnajdova, @siriwatknp
|
|
672
815
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
11
|
var _chainPropTypes = _interopRequireDefault(require("../chainPropTypes"));
|
|
10
12
|
function isClassComponent(elementType) {
|
|
11
13
|
// elementType.prototype?.isReactComponent
|
|
@@ -39,6 +41,9 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
|
|
|
39
41
|
if (typeof propValue === 'function' && !isClassComponent(propValue)) {
|
|
40
42
|
warningHint = 'Did you accidentally provide a plain function component instead?';
|
|
41
43
|
}
|
|
44
|
+
if (propValue === React.Fragment) {
|
|
45
|
+
warningHint = 'Did you accidentally provide a React.Fragment instead?';
|
|
46
|
+
}
|
|
42
47
|
if (warningHint !== undefined) {
|
|
43
48
|
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
44
49
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import chainPropTypes from "../chainPropTypes/index.js";
|
|
3
4
|
function isClassComponent(elementType) {
|
|
4
5
|
// elementType.prototype?.isReactComponent
|
|
@@ -32,6 +33,9 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
|
|
|
32
33
|
if (typeof propValue === 'function' && !isClassComponent(propValue)) {
|
|
33
34
|
warningHint = 'Did you accidentally provide a plain function component instead?';
|
|
34
35
|
}
|
|
36
|
+
if (propValue === React.Fragment) {
|
|
37
|
+
warningHint = 'Did you accidentally provide a React.Fragment instead?';
|
|
38
|
+
}
|
|
35
39
|
if (warningHint !== undefined) {
|
|
36
40
|
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
37
41
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the actual active element, traversing through shadow roots if necessary.
|
|
3
|
+
*
|
|
4
|
+
* When an element inside a shadow root has focus, `document.activeElement` returns
|
|
5
|
+
* the shadow host element. This function recursively traverses shadow roots to find
|
|
6
|
+
* the actual focused element.
|
|
7
|
+
*
|
|
8
|
+
* @param root - The document or shadow root to start the search from.
|
|
9
|
+
* @returns The actual focused element, or null if no element has focus.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // In a shadow DOM context
|
|
13
|
+
* const activeElement = getActiveElement(document);
|
|
14
|
+
* // Returns the actual focused element inside the shadow root
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Starting from a specific document
|
|
18
|
+
* const activeElement = getActiveElement(ownerDocument(element));
|
|
19
|
+
*/
|
|
20
|
+
export default function activeElement(doc: Document | ShadowRoot): Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the actual active element, traversing through shadow roots if necessary.
|
|
3
|
+
*
|
|
4
|
+
* When an element inside a shadow root has focus, `document.activeElement` returns
|
|
5
|
+
* the shadow host element. This function recursively traverses shadow roots to find
|
|
6
|
+
* the actual focused element.
|
|
7
|
+
*
|
|
8
|
+
* @param root - The document or shadow root to start the search from.
|
|
9
|
+
* @returns The actual focused element, or null if no element has focus.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // In a shadow DOM context
|
|
13
|
+
* const activeElement = getActiveElement(document);
|
|
14
|
+
* // Returns the actual focused element inside the shadow root
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Starting from a specific document
|
|
18
|
+
* const activeElement = getActiveElement(ownerDocument(element));
|
|
19
|
+
*/
|
|
20
|
+
export default function activeElement(doc) {
|
|
21
|
+
let element = doc.activeElement;
|
|
22
|
+
while (element?.shadowRoot?.activeElement != null) {
|
|
23
|
+
element = element.shadowRoot.activeElement;
|
|
24
|
+
}
|
|
25
|
+
return element;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getActiveElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getActiveElement.js";
|
package/esm/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.js";
|
|
|
5
5
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.js";
|
|
6
6
|
export { default as exactProp } from "./exactProp/index.js";
|
|
7
7
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.js";
|
|
8
|
+
export { default as unstable_getActiveElement } from "./getActiveElement/index.js";
|
|
8
9
|
export { default as getDisplayName } from "./getDisplayName/index.js";
|
|
9
10
|
export { default as HTMLElementType } from "./HTMLElementType/index.js";
|
|
10
11
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.js";
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v7.3.
|
|
2
|
+
* @mui/utils v7.3.7
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -12,6 +12,7 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.js";
|
|
|
12
12
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.js";
|
|
13
13
|
export { default as exactProp } from "./exactProp/index.js";
|
|
14
14
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.js";
|
|
15
|
+
export { default as unstable_getActiveElement } from "./getActiveElement/index.js";
|
|
15
16
|
export { default as getDisplayName } from "./getDisplayName/index.js";
|
|
16
17
|
export { default as HTMLElementType } from "./HTMLElementType/index.js";
|
|
17
18
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the actual active element, traversing through shadow roots if necessary.
|
|
3
|
+
*
|
|
4
|
+
* When an element inside a shadow root has focus, `document.activeElement` returns
|
|
5
|
+
* the shadow host element. This function recursively traverses shadow roots to find
|
|
6
|
+
* the actual focused element.
|
|
7
|
+
*
|
|
8
|
+
* @param root - The document or shadow root to start the search from.
|
|
9
|
+
* @returns The actual focused element, or null if no element has focus.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // In a shadow DOM context
|
|
13
|
+
* const activeElement = getActiveElement(document);
|
|
14
|
+
* // Returns the actual focused element inside the shadow root
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Starting from a specific document
|
|
18
|
+
* const activeElement = getActiveElement(ownerDocument(element));
|
|
19
|
+
*/
|
|
20
|
+
export default function activeElement(doc: Document | ShadowRoot): Element | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = activeElement;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the actual active element, traversing through shadow roots if necessary.
|
|
9
|
+
*
|
|
10
|
+
* When an element inside a shadow root has focus, `document.activeElement` returns
|
|
11
|
+
* the shadow host element. This function recursively traverses shadow roots to find
|
|
12
|
+
* the actual focused element.
|
|
13
|
+
*
|
|
14
|
+
* @param root - The document or shadow root to start the search from.
|
|
15
|
+
* @returns The actual focused element, or null if no element has focus.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // In a shadow DOM context
|
|
19
|
+
* const activeElement = getActiveElement(document);
|
|
20
|
+
* // Returns the actual focused element inside the shadow root
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Starting from a specific document
|
|
24
|
+
* const activeElement = getActiveElement(ownerDocument(element));
|
|
25
|
+
*/
|
|
26
|
+
function activeElement(doc) {
|
|
27
|
+
let element = doc.activeElement;
|
|
28
|
+
while (element?.shadowRoot?.activeElement != null) {
|
|
29
|
+
element = element.shadowRoot.activeElement;
|
|
30
|
+
}
|
|
31
|
+
return element;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getActiveElement.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _getActiveElement.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _getActiveElement = _interopRequireDefault(require("./getActiveElement"));
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.js";
|
|
|
5
5
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.js";
|
|
6
6
|
export { default as exactProp } from "./exactProp/index.js";
|
|
7
7
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.js";
|
|
8
|
+
export { default as unstable_getActiveElement } from "./getActiveElement/index.js";
|
|
8
9
|
export { default as getDisplayName } from "./getDisplayName/index.js";
|
|
9
10
|
export { default as HTMLElementType } from "./HTMLElementType/index.js";
|
|
10
11
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v7.3.
|
|
2
|
+
* @mui/utils v7.3.7
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -20,6 +20,7 @@ var _exportNames = {
|
|
|
20
20
|
elementTypeAcceptingRef: true,
|
|
21
21
|
exactProp: true,
|
|
22
22
|
formatMuiErrorMessage: true,
|
|
23
|
+
unstable_getActiveElement: true,
|
|
23
24
|
getDisplayName: true,
|
|
24
25
|
HTMLElementType: true,
|
|
25
26
|
ponyfillGlobal: true,
|
|
@@ -213,6 +214,12 @@ Object.defineProperty(exports, "unstable_generateUtilityClasses", {
|
|
|
213
214
|
return _generateUtilityClasses.default;
|
|
214
215
|
}
|
|
215
216
|
});
|
|
217
|
+
Object.defineProperty(exports, "unstable_getActiveElement", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function () {
|
|
220
|
+
return _getActiveElement.default;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
216
223
|
Object.defineProperty(exports, "unstable_getReactElementRef", {
|
|
217
224
|
enumerable: true,
|
|
218
225
|
get: function () {
|
|
@@ -363,6 +370,7 @@ var _elementAcceptingRef = _interopRequireDefault(require("./elementAcceptingRef
|
|
|
363
370
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("./elementTypeAcceptingRef"));
|
|
364
371
|
var _exactProp = _interopRequireDefault(require("./exactProp"));
|
|
365
372
|
var _formatMuiErrorMessage = _interopRequireDefault(require("./formatMuiErrorMessage"));
|
|
373
|
+
var _getActiveElement = _interopRequireDefault(require("./getActiveElement"));
|
|
366
374
|
var _getDisplayName = _interopRequireDefault(require("./getDisplayName"));
|
|
367
375
|
var _HTMLElementType = _interopRequireDefault(require("./HTMLElementType"));
|
|
368
376
|
var _ponyfillGlobal = _interopRequireDefault(require("./ponyfillGlobal"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.7",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Utility functions for React components.",
|
|
6
6
|
"keywords": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@types/prop-types": "^15.7.15",
|
|
29
29
|
"clsx": "^2.1.1",
|
|
30
30
|
"prop-types": "^15.8.1",
|
|
31
|
-
"react-is": "^19.2.
|
|
32
|
-
"@mui/types": "^7.4.
|
|
31
|
+
"react-is": "^19.2.3",
|
|
32
|
+
"@mui/types": "^7.4.10"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|