@mui/utils 9.0.0-beta.0 → 9.0.0-beta.1

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 CHANGED
@@ -1,5 +1,53 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 9.0.0-beta.1
4
+
5
+ <!-- generated comparing v9.0.0-beta.0..master -->
6
+
7
+ _Apr 2, 2026_
8
+
9
+ A big thanks to the 11 contributors who made this release possible.
10
+
11
+ ### `@mui/material@9.0.0-beta.1`
12
+
13
+ #### Breaking Changes
14
+
15
+ - [grid] Remove 'column' and 'column-reverse' options from `direction` prop (#47564) @sai6855
16
+ - [icons] Remove legacy `*Outline` icons (#48116) @mj12albert
17
+ - [list-item-icon] Use theme spacing instead of hardcoded minWidth (#46597) @adiitxa
18
+
19
+ #### Changes
20
+
21
+ - [all components] Fix `slotProps.transition` types (#48153) @mj12albert
22
+ - [alert][dialog] Accessibility improvements (#48113) @silviuaavram
23
+ - [autocomplete] Fix helper text focusing input when clicked (#48156) @mj12albert
24
+ - [button-base] Add `nativeButton` prop (#47989) @mj12albert
25
+ - [input] Fix high contrast cutoff on first character (#48150) @silviuaavram
26
+ - [menu] Fix empty roving focus container (#48114) @mj12albert
27
+ - [utils] Explicitly register roving tab items with parent (#48122) @mj12albert
28
+
29
+ ### Docs
30
+
31
+ - Fix HTML validation errors (#48107) @Janpot
32
+ - Fix duplicate IDs and HTML validation issues (#48095) @Janpot
33
+ - Fix the dark mode footer row shadow for the Data Grid on the advanced components page (#48149) @arminmeh
34
+ - Improve jsdom section (#48098) @oliviertassinari
35
+ - Update "Deprecated APIs removed" section to h2 in "Upgrade to v9" docs (#48115) @ZeeshanTamboli
36
+ - [docs][progress] Label all demo components (#48143) @mj12albert
37
+ - [docs-infra] Add x-scheduler to component API URL resolver (#48097) @rita-codes
38
+ - [docs-infra] Resolve some redirects (#48165) @Janpot
39
+ - [docs-infra] Update v9 Search Index (#48028) @dav-is
40
+
41
+ ### Core
42
+
43
+ - [code-infra] Discover exports for bundle size report (#48170) @Janpot
44
+ - [internal] Fix use of ellipsis (#48096) @oliviertassinari
45
+ - [test] Add screenshot test for Virtualized Table (#47947) @mnajdova
46
+ - [test] Remove `componentsProp` from `describeConformance` tests (#48142) @ZeeshanTamboli
47
+ - [theme] Do not create channel tokens for custom colors when `nativeColor` is used (#47765) @ZeeshanTamboli
48
+
49
+ All contributors of this release in alphabetical order: @adiitxa, @arminmeh, @dav-is, @Janpot, @mj12albert, @mnajdova, @oliviertassinari, @rita-codes, @sai6855, @silviuaavram, @ZeeshanTamboli
50
+
3
51
  ## 9.0.0-beta.0
4
52
 
5
53
  <!-- generated comparing v9.0.0-alpha.4..master -->
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Fast shallow compare for plain objects.
3
+ * Returns `true` when both objects have the same own enumerable keys and each value is equal
4
+ * according to `Object.is()`.
5
+ */
6
+ export default function fastObjectShallowCompare<T extends Record<string, any> | null>(a: T, b: T): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Fast shallow compare for plain objects.
3
+ * Returns `true` when both objects have the same own enumerable keys and each value is equal
4
+ * according to `Object.is()`.
5
+ */
6
+ export default function fastObjectShallowCompare<T extends Record<string, any> | null>(a: T, b: T): boolean;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = fastObjectShallowCompare;
7
+ // From mui-x: https://github.com/mui/mui-x/blob/bb92fb0adac6764461adea9a9d7d43f1095f49e5/packages/x-internals/src/fastObjectShallowCompare/fastObjectShallowCompare.ts
8
+ /* eslint-disable guard-for-in */
9
+
10
+ const is = Object.is;
11
+
12
+ /**
13
+ * Fast shallow compare for plain objects.
14
+ * Returns `true` when both objects have the same own enumerable keys and each value is equal
15
+ * according to `Object.is()`.
16
+ */
17
+ function fastObjectShallowCompare(a, b) {
18
+ if (a === b) {
19
+ return true;
20
+ }
21
+ if (!(a instanceof Object) || !(b instanceof Object)) {
22
+ return false;
23
+ }
24
+ let aLength = 0;
25
+ let bLength = 0;
26
+ for (const key in a) {
27
+ aLength += 1;
28
+ if (!is(a[key], b[key])) {
29
+ return false;
30
+ }
31
+ if (!(key in b)) {
32
+ return false;
33
+ }
34
+ }
35
+
36
+ // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
37
+ for (const _ in b) {
38
+ bLength += 1;
39
+ }
40
+ return aLength === bLength;
41
+ }
@@ -0,0 +1,35 @@
1
+ // From mui-x: https://github.com/mui/mui-x/blob/bb92fb0adac6764461adea9a9d7d43f1095f49e5/packages/x-internals/src/fastObjectShallowCompare/fastObjectShallowCompare.ts
2
+ /* eslint-disable guard-for-in */
3
+
4
+ const is = Object.is;
5
+
6
+ /**
7
+ * Fast shallow compare for plain objects.
8
+ * Returns `true` when both objects have the same own enumerable keys and each value is equal
9
+ * according to `Object.is()`.
10
+ */
11
+ export default function fastObjectShallowCompare(a, b) {
12
+ if (a === b) {
13
+ return true;
14
+ }
15
+ if (!(a instanceof Object) || !(b instanceof Object)) {
16
+ return false;
17
+ }
18
+ let aLength = 0;
19
+ let bLength = 0;
20
+ for (const key in a) {
21
+ aLength += 1;
22
+ if (!is(a[key], b[key])) {
23
+ return false;
24
+ }
25
+ if (!(key in b)) {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
31
+ for (const _ in b) {
32
+ bLength += 1;
33
+ }
34
+ return aLength === bLength;
35
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./fastObjectShallowCompare.mjs";
@@ -0,0 +1 @@
1
+ export { default } from "./fastObjectShallowCompare.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 _fastObjectShallowCompare.default;
11
+ }
12
+ });
13
+ var _fastObjectShallowCompare = _interopRequireDefault(require("./fastObjectShallowCompare"));
@@ -0,0 +1 @@
1
+ export { default } from "./fastObjectShallowCompare.mjs";
package/index.d.mts CHANGED
@@ -15,6 +15,7 @@ export { default as unstable_createChainedFunction } from "./createChainedFuncti
15
15
  export { default as unstable_debounce } from "./debounce/index.mjs";
16
16
  export { default as unstable_deprecatedPropType } from "./deprecatedPropType/index.mjs";
17
17
  export { default as unstable_fastDeepAssign } from "./fastDeepAssign/index.mjs";
18
+ export { default as unstable_fastObjectShallowCompare } from "./fastObjectShallowCompare/index.mjs";
18
19
  export { default as unstable_isObjectEmpty } from "./isObjectEmpty/index.mjs";
19
20
  export { default as unstable_isMuiElement } from "./isMuiElement/index.mjs";
20
21
  export { default as unstable_ownerDocument } from "./ownerDocument/index.mjs";
@@ -51,5 +52,4 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
51
52
  export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
52
53
  export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
53
54
  export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
54
- export { default as unstable_useRovingTabIndex } from "./useRovingTabIndex/index.mjs";
55
55
  export * from "./types/index.mjs";
package/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { default as unstable_createChainedFunction } from "./createChainedFuncti
15
15
  export { default as unstable_debounce } from "./debounce/index.js";
16
16
  export { default as unstable_deprecatedPropType } from "./deprecatedPropType/index.js";
17
17
  export { default as unstable_fastDeepAssign } from "./fastDeepAssign/index.js";
18
+ export { default as unstable_fastObjectShallowCompare } from "./fastObjectShallowCompare/index.js";
18
19
  export { default as unstable_isObjectEmpty } from "./isObjectEmpty/index.js";
19
20
  export { default as unstable_isMuiElement } from "./isMuiElement/index.js";
20
21
  export { default as unstable_ownerDocument } from "./ownerDocument/index.js";
@@ -51,5 +52,4 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
51
52
  export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.js";
52
53
  export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.js";
53
54
  export { default as unstable_getReactElementRef } from "./getReactElementRef/index.js";
54
- export { default as unstable_useRovingTabIndex } from "./useRovingTabIndex/index.js";
55
55
  export * from "./types/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v9.0.0-beta.0
2
+ * @mui/utils v9.0.0-beta.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -30,6 +30,7 @@ var _exportNames = {
30
30
  unstable_debounce: true,
31
31
  unstable_deprecatedPropType: true,
32
32
  unstable_fastDeepAssign: true,
33
+ unstable_fastObjectShallowCompare: true,
33
34
  unstable_isObjectEmpty: true,
34
35
  unstable_isMuiElement: true,
35
36
  unstable_ownerDocument: true,
@@ -64,8 +65,7 @@ var _exportNames = {
64
65
  unstable_resolveComponentProps: true,
65
66
  unstable_extractEventHandlers: true,
66
67
  unstable_getReactNodeRef: true,
67
- unstable_getReactElementRef: true,
68
- unstable_useRovingTabIndex: true
68
+ unstable_getReactElementRef: true
69
69
  };
70
70
  Object.defineProperty(exports, "HTMLElementType", {
71
71
  enumerable: true,
@@ -211,6 +211,12 @@ Object.defineProperty(exports, "unstable_fastDeepAssign", {
211
211
  return _fastDeepAssign.default;
212
212
  }
213
213
  });
214
+ Object.defineProperty(exports, "unstable_fastObjectShallowCompare", {
215
+ enumerable: true,
216
+ get: function () {
217
+ return _fastObjectShallowCompare.default;
218
+ }
219
+ });
214
220
  Object.defineProperty(exports, "unstable_generateUtilityClass", {
215
221
  enumerable: true,
216
222
  get: function () {
@@ -355,12 +361,6 @@ Object.defineProperty(exports, "unstable_useOnMount", {
355
361
  return _useOnMount.default;
356
362
  }
357
363
  });
358
- Object.defineProperty(exports, "unstable_useRovingTabIndex", {
359
- enumerable: true,
360
- get: function () {
361
- return _useRovingTabIndex.default;
362
- }
363
- });
364
364
  Object.defineProperty(exports, "unstable_useSlotProps", {
365
365
  enumerable: true,
366
366
  get: function () {
@@ -401,6 +401,7 @@ var _createChainedFunction = _interopRequireDefault(require("./createChainedFunc
401
401
  var _debounce = _interopRequireDefault(require("./debounce"));
402
402
  var _deprecatedPropType = _interopRequireDefault(require("./deprecatedPropType"));
403
403
  var _fastDeepAssign = _interopRequireDefault(require("./fastDeepAssign"));
404
+ var _fastObjectShallowCompare = _interopRequireDefault(require("./fastObjectShallowCompare"));
404
405
  var _isObjectEmpty = _interopRequireDefault(require("./isObjectEmpty"));
405
406
  var _isMuiElement = _interopRequireDefault(require("./isMuiElement"));
406
407
  var _ownerDocument = _interopRequireDefault(require("./ownerDocument"));
@@ -445,7 +446,6 @@ var _resolveComponentProps = _interopRequireDefault(require("./resolveComponentP
445
446
  var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
446
447
  var _getReactNodeRef = _interopRequireDefault(require("./getReactNodeRef"));
447
448
  var _getReactElementRef = _interopRequireDefault(require("./getReactElementRef"));
448
- var _useRovingTabIndex = _interopRequireDefault(require("./useRovingTabIndex"));
449
449
  var _types = require("./types");
450
450
  Object.keys(_types).forEach(function (key) {
451
451
  if (key === "default" || key === "__esModule") return;
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v9.0.0-beta.0
2
+ * @mui/utils v9.0.0-beta.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -22,6 +22,7 @@ export { default as unstable_createChainedFunction } from "./createChainedFuncti
22
22
  export { default as unstable_debounce } from "./debounce/index.mjs";
23
23
  export { default as unstable_deprecatedPropType } from "./deprecatedPropType/index.mjs";
24
24
  export { default as unstable_fastDeepAssign } from "./fastDeepAssign/index.mjs";
25
+ export { default as unstable_fastObjectShallowCompare } from "./fastObjectShallowCompare/index.mjs";
25
26
  export { default as unstable_isObjectEmpty } from "./isObjectEmpty/index.mjs";
26
27
  export { default as unstable_isMuiElement } from "./isMuiElement/index.mjs";
27
28
  export { default as unstable_ownerDocument } from "./ownerDocument/index.mjs";
@@ -57,5 +58,4 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
57
58
  export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
58
59
  export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
59
60
  export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
60
- export { default as unstable_useRovingTabIndex } from "./useRovingTabIndex/index.mjs";
61
61
  export * from "./types/index.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/utils",
3
- "version": "9.0.0-beta.0",
3
+ "version": "9.0.0-beta.1",
4
4
  "author": "MUI Team",
5
5
  "description": "Utility functions for React components.",
6
6
  "keywords": [
@@ -288,6 +288,20 @@
288
288
  "default": "./fastDeepAssign/index.mjs"
289
289
  }
290
290
  },
291
+ "./fastObjectShallowCompare": {
292
+ "import": {
293
+ "types": "./fastObjectShallowCompare/index.d.mts",
294
+ "default": "./fastObjectShallowCompare/index.mjs"
295
+ },
296
+ "require": {
297
+ "types": "./fastObjectShallowCompare/index.d.ts",
298
+ "default": "./fastObjectShallowCompare/index.js"
299
+ },
300
+ "default": {
301
+ "types": "./fastObjectShallowCompare/index.d.mts",
302
+ "default": "./fastObjectShallowCompare/index.mjs"
303
+ }
304
+ },
291
305
  "./formatMuiErrorMessage": {
292
306
  "import": {
293
307
  "types": "./formatMuiErrorMessage/index.d.mts",
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { UseRovingTabIndexReturnValue } from "./useRovingTabIndex.mjs";
3
+ type RovingTabIndexContextValue = UseRovingTabIndexReturnValue<unknown>;
4
+ export declare const RovingTabIndexContext: React.Context<RovingTabIndexContextValue | undefined>;
5
+ export declare function useRovingTabIndexContext(): RovingTabIndexContextValue;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { UseRovingTabIndexReturnValue } from "./useRovingTabIndex.js";
3
+ type RovingTabIndexContextValue = UseRovingTabIndexReturnValue<unknown>;
4
+ export declare const RovingTabIndexContext: React.Context<RovingTabIndexContextValue | undefined>;
5
+ export declare function useRovingTabIndexContext(): RovingTabIndexContextValue;
6
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.RovingTabIndexContext = void 0;
9
+ exports.useRovingTabIndexContext = useRovingTabIndexContext;
10
+ var React = _interopRequireWildcard(require("react"));
11
+ const RovingTabIndexContext = exports.RovingTabIndexContext = /*#__PURE__*/React.createContext(undefined);
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ RovingTabIndexContext.displayName = 'RovingTabIndexContext';
14
+ }
15
+ function useRovingTabIndexContext() {
16
+ const context = React.useContext(RovingTabIndexContext);
17
+ if (context === undefined) {
18
+ throw new Error('MUI: RovingTabIndexContext is missing. Roving tab index items must be placed within a roving tab index provider.');
19
+ }
20
+ return context;
21
+ }
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ export const RovingTabIndexContext = /*#__PURE__*/React.createContext(undefined);
5
+ if (process.env.NODE_ENV !== 'production') {
6
+ RovingTabIndexContext.displayName = 'RovingTabIndexContext';
7
+ }
8
+ export function useRovingTabIndexContext() {
9
+ const context = React.useContext(RovingTabIndexContext);
10
+ if (context === undefined) {
11
+ throw new Error('MUI: RovingTabIndexContext is missing. Roving tab index items must be placed within a roving tab index provider.');
12
+ }
13
+ return context;
14
+ }
@@ -1 +1,2 @@
1
- export { default } from "./useRovingTabIndex.mjs";
1
+ export * from "./RovingTabIndexContext.mjs";
2
+ export * from "./useRovingTabIndex.mjs";
@@ -1 +1,2 @@
1
- export { default } from "./useRovingTabIndex.js";
1
+ export * from "./RovingTabIndexContext.js";
2
+ export * from "./useRovingTabIndex.js";
@@ -1,13 +1,27 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- Object.defineProperty(exports, "default", {
8
- enumerable: true,
9
- get: function () {
10
- return _useRovingTabIndex.default;
11
- }
6
+ var _RovingTabIndexContext = require("./RovingTabIndexContext");
7
+ Object.keys(_RovingTabIndexContext).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _RovingTabIndexContext[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _RovingTabIndexContext[key];
14
+ }
15
+ });
12
16
  });
13
- var _useRovingTabIndex = _interopRequireDefault(require("./useRovingTabIndex"));
17
+ var _useRovingTabIndex = require("./useRovingTabIndex");
18
+ Object.keys(_useRovingTabIndex).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _useRovingTabIndex[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _useRovingTabIndex[key];
25
+ }
26
+ });
27
+ });
@@ -1 +1,2 @@
1
- export { default } from "./useRovingTabIndex.mjs";
1
+ export * from "./RovingTabIndexContext.mjs";
2
+ export * from "./useRovingTabIndex.mjs";
@@ -1,31 +1,179 @@
1
1
  import * as React from 'react';
2
- export type UseRovingTabIndexOptions = {
3
- focusableIndex?: number | undefined;
2
+ export interface Item<Key = unknown> {
3
+ /**
4
+ * The logical id used to track the item across reorders and re-renders.
5
+ * Components such as `Tabs` use the tab value here, while `MenuItem` generates an internal id.
6
+ */
7
+ id: Key;
8
+ /**
9
+ * The item's current DOM element.
10
+ */
11
+ element: HTMLElement | null;
12
+ /**
13
+ * Whether the item ignores user interaction.
14
+ */
15
+ disabled: boolean;
16
+ /**
17
+ * Whether a disabled item should still be allowed to receive roving focus.
18
+ * `MenuList` uses this for its `disabledItemsFocusable` behavior.
19
+ */
20
+ focusableWhenDisabled: boolean;
21
+ /**
22
+ * An optional text string used for typeahead matching.
23
+ */
24
+ textValue?: string | undefined;
25
+ /**
26
+ * Whether the item is currently selected in the consumer component's own state model.
27
+ * `MenuList` uses this when `variant="selectedMenu"` to prefer the selected item by default,
28
+ * and `Tabs` sets this on the selected tab.
29
+ */
30
+ selected: boolean;
31
+ }
32
+ export interface UseRovingTabIndexParams<Key = unknown> {
33
+ /**
34
+ * The logical item id that should own `tabIndex=0`.
35
+ *
36
+ * Pass a concrete id when the consumer wants to drive roving focus explicitly.
37
+ * For example, `Tabs` uses the selected tab value here when focus is outside the list so
38
+ * that keyboard focus re-enters on the selected tab.
39
+ *
40
+ * `undefined` means "the hook should choose the active item using its default-item logic".
41
+ * `null` means "there is intentionally no preferred item", which also falls back to the
42
+ * default-item logic.
43
+ */
44
+ activeItemId?: Key | null | undefined;
45
+ /**
46
+ * Chooses the default item when `activeItemId` is not driving the tab stop directly.
47
+ *
48
+ * `MenuList` uses this to prefer the selected item when `variant="selectedMenu"`, then
49
+ * falls back to the first focusable item.
50
+ */
51
+ getDefaultActiveItemId?: ((items: Item<Key>[]) => Key | null) | undefined;
52
+ /**
53
+ * The axis used by arrow-key navigation.
54
+ */
4
55
  orientation: 'horizontal' | 'vertical';
56
+ /**
57
+ * Whether horizontal keyboard navigation should follow right-to-left semantics.
58
+ * Only affects horizontal lists.
59
+ * @default false
60
+ */
5
61
  isRtl?: boolean | undefined;
6
- shouldFocus?: ((element: HTMLElement | null) => boolean) | undefined;
7
- shouldWrap?: boolean | undefined;
8
- };
9
- type UseRovingTabIndexReturn = {
10
- getItemProps: (index: number, ref?: React.Ref<HTMLElement>) => {
11
- ref: (element: HTMLElement | null) => void;
12
- tabIndex: number;
13
- };
62
+ /**
63
+ * Filters items out of roving navigation without removing them from the registry.
64
+ * For example, `MenuList` uses this so disabled menu items can stay registered while still
65
+ * being skipped for roving focus unless `disabledItemsFocusable` is enabled.
66
+ */
67
+ isItemFocusable?: ((item: Item<Key>) => boolean) | undefined;
68
+ /**
69
+ * Whether keyboard navigation should wrap from the last item back to the first, and vice versa.
70
+ * @default true
71
+ */
72
+ wrap?: boolean | undefined;
73
+ }
74
+ export interface UseRovingTabIndexReturnValue<Key = unknown> {
75
+ /**
76
+ * The item id that currently owns `tabIndex=0` for this render.
77
+ */
78
+ activeItemId: Key | null;
79
+ /**
80
+ * Imperatively moves focus to the next matching item.
81
+ * Consumers such as `MenuList` use this for typeahead and other non-arrow-key navigation.
82
+ */
83
+ focusNext: (isItemFocusableOverride?: (item: Item<Key>) => boolean) => Key | null;
84
+ /**
85
+ * Returns the current active item record from a fresh registry snapshot.
86
+ */
87
+ getActiveItem: () => Item<Key> | null;
88
+ /**
89
+ * Returns the props that enable roving behavior on the container element.
90
+ *
91
+ * Spread these props onto the list or composite root element that should listen for focus
92
+ * and keyboard events.
93
+ */
14
94
  getContainerProps: (ref?: React.Ref<HTMLElement>) => {
95
+ /**
96
+ * Keeps the active item in sync when focus moves onto one of the registered items.
97
+ */
15
98
  onFocus: (event: React.FocusEvent<HTMLElement>) => void;
99
+ /**
100
+ * Handles arrow-key, Home, and End navigation for the roving set.
101
+ */
16
102
  onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
103
+ /**
104
+ * Merges the consumer ref with the internal container ref used by the hook.
105
+ */
17
106
  ref: (element: HTMLElement | null) => void;
18
107
  };
19
- focusNext: (shouldSkipFocusOverride?: (element: HTMLElement | null) => boolean) => number;
20
- };
108
+ /**
109
+ * Returns the current item registry.
110
+ * The map is keyed by item id and stores normalized item records.
111
+ */
112
+ getItemMap: () => Map<Key, Item<Key>>;
113
+ /**
114
+ * Reports whether the supplied item id currently owns `tabIndex=0`.
115
+ */
116
+ isItemActive: (itemId: Key) => boolean;
117
+ /**
118
+ * Registers or updates an item in the roving registry.
119
+ */
120
+ registerItem: (item: Item<Key>) => void;
121
+ /**
122
+ * Updates the current active item id.
123
+ */
124
+ setActiveItemId: (itemId: Key | null) => void;
125
+ /**
126
+ * Removes an item from the roving registry.
127
+ */
128
+ unregisterItem: (itemId: Key) => void;
129
+ }
130
+ export interface UseRovingTabIndexItemParams<Key = unknown> {
131
+ /**
132
+ * The logical id that will be used as the item's registry key.
133
+ */
134
+ id: Key;
135
+ /**
136
+ * The consumer's ref for the item's DOM element.
137
+ * The item hook merges this with its own registration ref callback.
138
+ */
139
+ ref?: React.Ref<HTMLElement> | undefined;
140
+ /**
141
+ * Whether the item ignores user interaction.
142
+ * @default false
143
+ */
144
+ disabled?: boolean | undefined;
145
+ /**
146
+ * Whether the item should still be focusable even when `disabled` is true.
147
+ * @default false
148
+ */
149
+ focusableWhenDisabled?: boolean | undefined;
150
+ /**
151
+ * An optional text string used for typeahead matching.
152
+ */
153
+ textValue?: string | undefined;
154
+ /**
155
+ * Whether the item is selected in the consumer component's state model.
156
+ * @default false
157
+ */
158
+ selected?: boolean | undefined;
159
+ }
160
+ export interface UseRovingTabIndexItemReturnValue {
161
+ /**
162
+ * The merged ref callback that registers the item element with the root registry.
163
+ */
164
+ ref: React.RefCallback<HTMLElement | null>;
165
+ /**
166
+ * The `tabIndex` that should be applied to the item element.
167
+ * The active item receives `0`; every other item receives `-1`.
168
+ */
169
+ tabIndex: number;
170
+ }
21
171
  /**
22
- * Provides roving tab index behavior for a container and its focusable children.
172
+ * Provides roving tab index behavior for a composite container and its focusable children.
23
173
  * This is useful for implementing keyboard navigation in components like menus, tabs, and lists.
24
174
  * The hook manages the focus state of child elements and provides props to be spread on both the container and the items.
25
175
  * The container will handle keyboard events to move focus between items based on the specified orientation and wrapping behavior.
26
- *
27
- * @param options - Configuration options for the roving tab index behavior, including orientation, initial focusable index, RTL support, and custom focus logic.
28
- * @returns An object containing `getItemProps` and `getContainerProps` functions to be spread on the respective elements, and a `focusNext` function to programmatically move focus to the next item.
29
176
  */
30
- export default function useRovingTabIndex(options: UseRovingTabIndexOptions): UseRovingTabIndexReturn;
31
- export {};
177
+ export declare function useRovingTabIndexRoot<Key = unknown>(params: UseRovingTabIndexParams<Key>): UseRovingTabIndexReturnValue<Key>;
178
+ export declare function useRovingTabIndexItem<Key = unknown>(params: UseRovingTabIndexItemParams<Key>): UseRovingTabIndexItemReturnValue;
179
+ export declare function isItemFocusable(item: Item<unknown>): boolean;