@mui/utils 9.0.1 → 9.1.0
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 +84 -0
- package/LICENSE +1 -1
- package/fastDeepAssign/fastDeepAssign.js +6 -1
- package/fastDeepAssign/fastDeepAssign.mjs +6 -1
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +9 -1
- package/index.mjs +2 -1
- package/isHostComponent/isHostComponent.d.mts +1 -1
- package/isHostComponent/isHostComponent.d.ts +1 -1
- package/package.json +16 -2
- package/useRovingTabIndex/useRovingTabIndex.js +3 -3
- package/useRovingTabIndex/useRovingTabIndex.mjs +3 -3
- package/useValueAsRef/index.d.mts +1 -0
- package/useValueAsRef/index.d.ts +1 -0
- package/useValueAsRef/index.js +13 -0
- package/useValueAsRef/index.mjs +1 -0
- package/useValueAsRef/useValueAsRef.d.mts +14 -0
- package/useValueAsRef/useValueAsRef.d.ts +14 -0
- package/useValueAsRef/useValueAsRef.js +35 -0
- package/useValueAsRef/useValueAsRef.mjs +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# [Versions](https://mui.com/material-ui/getting-started/versions/)
|
|
2
2
|
|
|
3
|
+
## 9.1.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v9.0.1..master -->
|
|
6
|
+
|
|
7
|
+
_Jun 8, 2026_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- ⚙️ Support for the [prefers-reduced-motion](https://mui.com/material-ui/transitions/#reduced-motion) setting.
|
|
12
|
+
- ♿️ Improved support for Windows High Contrast mode with the [enhanceHighContrast](https://mui.com/material-ui/customization/palette/#windows-high-contrast-mode) theme wrapper.
|
|
13
|
+
|
|
14
|
+
### `@mui/material@9.1.0`
|
|
15
|
+
|
|
16
|
+
- [autocomplete] Enable clearing highlight when mouse leaves popup (#48354) @mj12albert
|
|
17
|
+
- [autocomplete] Fix `freeSolo` controlled values cleared by initial `null` (#48611) @mj12albert
|
|
18
|
+
- [autocomplete] Fix item removal when it receives focus from VoiceOver before using Backspace (#48572) @silviuaavram
|
|
19
|
+
- [autocomplete] Fix `resetHighlightOnMouseLeave` JSdoc (#48536) @mj12albert
|
|
20
|
+
- [autocomplete] Guard against null inputRef during unmount (#48617) @noam3127
|
|
21
|
+
- [badge] Add `aria-hidden` to badge content and polish docs demos (#48471) @mj12albert
|
|
22
|
+
- [badge] Use inline CSS variables for anchorOrigin/overlap positioning (#48549) @siriwatknp
|
|
23
|
+
- [button] Fix customized flex gap styles (#48542) @mj12albert
|
|
24
|
+
- [dialog] Fix unwanted `DialogPaper` focus ring (#48535) @mj12albert
|
|
25
|
+
- [focus trap] Fix incorrect tab order when `tabIndex >= 1` (#48546) @mj12albert
|
|
26
|
+
- [progress] Show runtime errors only once (#48591) @silviuaavram
|
|
27
|
+
- [select] Allow spacebar to select elements (#48615) @silviuaavram
|
|
28
|
+
- [select] Support typeahead when closed (#48563) @mj12albert
|
|
29
|
+
- [step button] Choose higher contrast ripple color for dark mode focus (#48612) @silviuaavram
|
|
30
|
+
- [stepper] Include StepConnector inside Step element (#48492) @silviuaavram
|
|
31
|
+
- [stepper] Proper support for vertical alternativeLabel (#48485) @silviuaavram
|
|
32
|
+
- [tabs] Fix React 18 roving tabindex and dedupe invalid-value warning (#48605) @Janpot
|
|
33
|
+
- [theme] Add HighContrast theme enhancer (#48319) @silviuaavram
|
|
34
|
+
- [timeline item] Fix extra ::before spacing when TimelineOppositeContent is present (#46663) @tyalau
|
|
35
|
+
- [tooltip] Prevent stuck-open tooltip when child becomes disabled (#48606) @Janpot
|
|
36
|
+
- [transitions] Custom `Transition` component (#48325) @mj12albert
|
|
37
|
+
- [transitions] Support `prefers-reduced-motion` (#48357) @mj12albert
|
|
38
|
+
|
|
39
|
+
### `@mui/utils@9.1.0`
|
|
40
|
+
|
|
41
|
+
- [utils] Prevent prototype pollution in fastDeepAssign (#48580) @Janpot
|
|
42
|
+
|
|
43
|
+
### Docs
|
|
44
|
+
|
|
45
|
+
- [docs] Add function `slotProps` documentation (#48574) @mj12albert
|
|
46
|
+
- [docs] Clarify styled-components version compatibility (#48533) @nightt5879
|
|
47
|
+
- [docs] Fix broken URLs (#48520) @oliviertassinari
|
|
48
|
+
- [docs] Fix invalid JSON in Zed MCP setup example (#48490) @pavan-sh
|
|
49
|
+
- [docs] Mention release version for enhanceHighContrast (#48609) @silviuaavram
|
|
50
|
+
- [docs] Remove outdated MUI X v8 notification (#48600) @cherniavskii
|
|
51
|
+
- [docs] Remove redundant enhanceHighContrast information (#48632) @silviuaavram
|
|
52
|
+
- [docs-infra] Decrease loaded bundle size on docs (#48584) @brijeshb42
|
|
53
|
+
- [docs-infra] Drop multi-locale plumbing from API pages (#48370) @brijeshb42
|
|
54
|
+
- [docs-infra] Fix Cookie banner heading (#48529) @oliviertassinari
|
|
55
|
+
- [docs-infra] Infinitely cache all static assets (#48627) @brijeshb42
|
|
56
|
+
- [docs-infra] Remove outdated noSEOadvantage entries (#48527) @oliviertassinari
|
|
57
|
+
- [docs-infra] Restore build-only invariant throws via `NEXT_RUNTIME` guard (#48475) @Janpot
|
|
58
|
+
- [docs-infra] Test HTML validation in broken links checker (#48088) @Janpot
|
|
59
|
+
- [docs][icons] Fix Font Awesome Chip demo in dark mode (#48576) @siriwatknp
|
|
60
|
+
- [docs][icons] Remove redundant font awesome demo (#48493) @ZeeshanTamboli
|
|
61
|
+
- [docs][modal] Add nested modal guidance (#46507) @JakeSaterlay
|
|
62
|
+
- [docs][stepper] Fix focus management in examples (#48494) @silviuaavram
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
- Eslint markdown (#48371) @Janpot
|
|
67
|
+
- [agents] Fix some docs links (#48561) @silviuaavram
|
|
68
|
+
- [blog] Copy editing improvement on v9 announcement blog posts (#48543) @joserodolfofreitas
|
|
69
|
+
- [code-infra] Cleanup unused jss packages (#48590) @brijeshb42
|
|
70
|
+
- [code-infra] Collapse canary workflows into nightly and nightly-cron (#48556) @Janpot
|
|
71
|
+
- [code-infra] Convert @mui/private-theming to TypeScript (#48565) @Janpot
|
|
72
|
+
- [code-infra] Convert @mui/styled-engine to TypeScript (#48544) @Janpot
|
|
73
|
+
- [code-infra] Convert @mui/styled-engine-sc to TypeScript (#48577) @Janpot
|
|
74
|
+
- [code-infra] Fix duplicate resource_class in test_regressions CI job (#48601) @LukasTy
|
|
75
|
+
- [code-infra] Make @mui/internal-docs-utils compatible with TypeScript 6 (#48594) @Janpot
|
|
76
|
+
- [code-infra] Migrate CircleCI jobs to Gen2 resource classes (#48593) @LukasTy
|
|
77
|
+
- [code-infra] Parallelize visual regression screenshots (#48557) @Janpot
|
|
78
|
+
- [code-infra] Run nightly-cron on v7.x (#48579) @Janpot
|
|
79
|
+
- [core] Fix typescript@next typecheck (#48587) @Janpot
|
|
80
|
+
- [pnpm] Add security settings to pnpm-workspace.yaml (#48582) @Janpot
|
|
81
|
+
- [styled-engine-sc] Fix compatibility with Vite and Vitest (#48558) @mj12albert
|
|
82
|
+
- [test] Add axe-core tests for mui-material (#48341) @siriwatknp
|
|
83
|
+
- [test] Configure Tailwind CSS in the visual-regression app (#48575) @Janpot
|
|
84
|
+
|
|
85
|
+
All contributors of this release in alphabetical order: @brijeshb42, @cherniavskii, @JakeSaterlay, @Janpot, @joserodolfofreitas, @LukasTy, @mj12albert, @nightt5879, @noam3127, @oliviertassinari, @pavan-sh, @silviuaavram, @siriwatknp, @tyalau, @ZeeshanTamboli
|
|
86
|
+
|
|
3
87
|
## 9.0.1
|
|
4
88
|
|
|
5
89
|
<!-- generated comparing v9.0.0..master -->
|
package/LICENSE
CHANGED
|
@@ -9,7 +9,6 @@ exports.default = fastDeepAssign;
|
|
|
9
9
|
// MIT License
|
|
10
10
|
// Copyright (c) 2012 - 2022 James Halliday, Josh Duff, and other contributors of deepmerge
|
|
11
11
|
|
|
12
|
-
/* eslint-disable guard-for-in */
|
|
13
12
|
/* eslint-disable no-else-return */
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -43,6 +42,9 @@ function cloneArray(value) {
|
|
|
43
42
|
function cloneObject(target) {
|
|
44
43
|
const result = {};
|
|
45
44
|
for (const key in target) {
|
|
45
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
46
48
|
result[key] = clone(target[key]);
|
|
47
49
|
}
|
|
48
50
|
return result;
|
|
@@ -69,6 +71,9 @@ function clone(entry) {
|
|
|
69
71
|
}
|
|
70
72
|
function mergeObject(target, source) {
|
|
71
73
|
for (const key in source) {
|
|
74
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
72
77
|
if (key in target) {
|
|
73
78
|
target[key] = fastDeepAssign(target[key], source[key]);
|
|
74
79
|
} else {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// MIT License
|
|
4
4
|
// Copyright (c) 2012 - 2022 James Halliday, Josh Duff, and other contributors of deepmerge
|
|
5
5
|
|
|
6
|
-
/* eslint-disable guard-for-in */
|
|
7
6
|
/* eslint-disable no-else-return */
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -37,6 +36,9 @@ function cloneArray(value) {
|
|
|
37
36
|
function cloneObject(target) {
|
|
38
37
|
const result = {};
|
|
39
38
|
for (const key in target) {
|
|
39
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
40
42
|
result[key] = clone(target[key]);
|
|
41
43
|
}
|
|
42
44
|
return result;
|
|
@@ -63,6 +65,9 @@ function clone(entry) {
|
|
|
63
65
|
}
|
|
64
66
|
function mergeObject(target, source) {
|
|
65
67
|
for (const key in source) {
|
|
68
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
66
71
|
if (key in target) {
|
|
67
72
|
target[key] = fastDeepAssign(target[key], source[key]);
|
|
68
73
|
} else {
|
package/index.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./u
|
|
|
35
35
|
export { default as unstable_useOnMount } from "./useOnMount/index.mjs";
|
|
36
36
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.mjs";
|
|
37
37
|
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.mjs";
|
|
38
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.mjs";
|
|
38
39
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
39
40
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
40
41
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
package/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./u
|
|
|
35
35
|
export { default as unstable_useOnMount } from "./useOnMount/index.js";
|
|
36
36
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.js";
|
|
37
37
|
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.js";
|
|
38
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.js";
|
|
38
39
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.js";
|
|
39
40
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.js";
|
|
40
41
|
export { default as usePreviousProps } from "./usePreviousProps/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.0
|
|
2
|
+
* @mui/utils v9.1.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -51,6 +51,7 @@ var _exportNames = {
|
|
|
51
51
|
unstable_useOnMount: true,
|
|
52
52
|
unstable_useIsFocusVisible: true,
|
|
53
53
|
unstable_useForcedRerendering: true,
|
|
54
|
+
unstable_useValueAsRef: true,
|
|
54
55
|
unstable_isFocusVisible: true,
|
|
55
56
|
unstable_getScrollbarSize: true,
|
|
56
57
|
usePreviousProps: true,
|
|
@@ -401,6 +402,12 @@ Object.defineProperty(exports, "unstable_useTimeout", {
|
|
|
401
402
|
return _useTimeout.default;
|
|
402
403
|
}
|
|
403
404
|
});
|
|
405
|
+
Object.defineProperty(exports, "unstable_useValueAsRef", {
|
|
406
|
+
enumerable: true,
|
|
407
|
+
get: function () {
|
|
408
|
+
return _useValueAsRef.default;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
404
411
|
Object.defineProperty(exports, "usePreviousProps", {
|
|
405
412
|
enumerable: true,
|
|
406
413
|
get: function () {
|
|
@@ -449,6 +456,7 @@ var _useTimeout = _interopRequireWildcard(require("./useTimeout"));
|
|
|
449
456
|
var _useOnMount = _interopRequireDefault(require("./useOnMount"));
|
|
450
457
|
var _useIsFocusVisible = _interopRequireDefault(require("./useIsFocusVisible"));
|
|
451
458
|
var _useForcedRerendering = _interopRequireDefault(require("./useForcedRerendering"));
|
|
459
|
+
var _useValueAsRef = _interopRequireDefault(require("./useValueAsRef"));
|
|
452
460
|
var _isFocusVisible = _interopRequireDefault(require("./isFocusVisible"));
|
|
453
461
|
var _getScrollbarSize = _interopRequireDefault(require("./getScrollbarSize"));
|
|
454
462
|
var _usePreviousProps = _interopRequireDefault(require("./usePreviousProps"));
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.0
|
|
2
|
+
* @mui/utils v9.1.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -42,6 +42,7 @@ export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./u
|
|
|
42
42
|
export { default as unstable_useOnMount } from "./useOnMount/index.mjs";
|
|
43
43
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.mjs";
|
|
44
44
|
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.mjs";
|
|
45
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.mjs";
|
|
45
46
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
46
47
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
47
48
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Determines if a given element is a DOM element name (i.e. not a React component).
|
|
4
4
|
*/
|
|
5
|
-
declare function isHostComponent(element: React.ElementType): element is "symbol" | "object" | "search" | "big" | "link" | "small" | "sub" | "sup" | "map" | "filter" | "input" | "set" | "base" | "code" | "data" | "time" | "
|
|
5
|
+
declare function isHostComponent(element: React.ElementType): element is "symbol" | "object" | "search" | "big" | "link" | "small" | "sub" | "sup" | "map" | "filter" | "input" | "set" | "base" | "code" | "data" | "time" | "source" | "progress" | "stop" | "track" | "button" | "address" | "center" | "view" | "clipPath" | "marker" | "mask" | "a" | "abbr" | "area" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "canvas" | "caption" | "cite" | "col" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr" | "keygen" | "menuitem" | "param" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "noindex" | "webview";
|
|
6
6
|
export default isHostComponent;
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Determines if a given element is a DOM element name (i.e. not a React component).
|
|
4
4
|
*/
|
|
5
|
-
declare function isHostComponent(element: React.ElementType): element is "symbol" | "object" | "search" | "big" | "link" | "small" | "sub" | "sup" | "map" | "filter" | "input" | "set" | "base" | "code" | "data" | "time" | "
|
|
5
|
+
declare function isHostComponent(element: React.ElementType): element is "symbol" | "object" | "search" | "big" | "link" | "small" | "sub" | "sup" | "map" | "filter" | "input" | "set" | "base" | "code" | "data" | "time" | "source" | "progress" | "stop" | "track" | "button" | "address" | "center" | "view" | "clipPath" | "marker" | "mask" | "a" | "abbr" | "area" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "canvas" | "caption" | "cite" | "col" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr" | "keygen" | "menuitem" | "param" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "noindex" | "webview";
|
|
6
6
|
export default isHostComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Utility functions for React components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
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.
|
|
31
|
+
"react-is": "^19.2.6",
|
|
32
32
|
"@mui/types": "^9.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
@@ -904,6 +904,20 @@
|
|
|
904
904
|
"default": "./useTimeout/index.mjs"
|
|
905
905
|
}
|
|
906
906
|
},
|
|
907
|
+
"./useValueAsRef": {
|
|
908
|
+
"import": {
|
|
909
|
+
"types": "./useValueAsRef/index.d.mts",
|
|
910
|
+
"default": "./useValueAsRef/index.mjs"
|
|
911
|
+
},
|
|
912
|
+
"require": {
|
|
913
|
+
"types": "./useValueAsRef/index.d.ts",
|
|
914
|
+
"default": "./useValueAsRef/index.js"
|
|
915
|
+
},
|
|
916
|
+
"default": {
|
|
917
|
+
"types": "./useValueAsRef/index.d.mts",
|
|
918
|
+
"default": "./useValueAsRef/index.mjs"
|
|
919
|
+
}
|
|
920
|
+
},
|
|
907
921
|
"./visuallyHidden": {
|
|
908
922
|
"import": {
|
|
909
923
|
"types": "./visuallyHidden/index.d.mts",
|
|
@@ -36,10 +36,10 @@ function useRovingTabIndexRoot(params) {
|
|
|
36
36
|
wrap = true
|
|
37
37
|
} = params;
|
|
38
38
|
const [activeItemIdState, setActiveItemIdState] = React.useState(activeItemIdProp);
|
|
39
|
-
const
|
|
39
|
+
const [previousActiveItemIdProp, setPreviousActiveItemIdProp] = React.useState(activeItemIdProp);
|
|
40
40
|
let activeItemIdCandidate = activeItemIdState;
|
|
41
|
-
if (activeItemIdProp !==
|
|
42
|
-
|
|
41
|
+
if (activeItemIdProp !== previousActiveItemIdProp) {
|
|
42
|
+
setPreviousActiveItemIdProp(activeItemIdProp);
|
|
43
43
|
if (activeItemIdProp !== undefined && activeItemIdProp !== activeItemIdState) {
|
|
44
44
|
activeItemIdCandidate = activeItemIdProp;
|
|
45
45
|
setActiveItemIdState(activeItemIdProp);
|
|
@@ -27,10 +27,10 @@ export function useRovingTabIndexRoot(params) {
|
|
|
27
27
|
wrap = true
|
|
28
28
|
} = params;
|
|
29
29
|
const [activeItemIdState, setActiveItemIdState] = React.useState(activeItemIdProp);
|
|
30
|
-
const
|
|
30
|
+
const [previousActiveItemIdProp, setPreviousActiveItemIdProp] = React.useState(activeItemIdProp);
|
|
31
31
|
let activeItemIdCandidate = activeItemIdState;
|
|
32
|
-
if (activeItemIdProp !==
|
|
33
|
-
|
|
32
|
+
if (activeItemIdProp !== previousActiveItemIdProp) {
|
|
33
|
+
setPreviousActiveItemIdProp(activeItemIdProp);
|
|
34
34
|
if (activeItemIdProp !== undefined && activeItemIdProp !== activeItemIdState) {
|
|
35
35
|
activeItemIdCandidate = activeItemIdProp;
|
|
36
36
|
setActiveItemIdState(activeItemIdProp);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useValueAsRef.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useValueAsRef.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 _useValueAsRef.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _useValueAsRef = _interopRequireDefault(require("./useValueAsRef"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./useValueAsRef.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ValueRef<T> {
|
|
2
|
+
current: T;
|
|
3
|
+
next: T;
|
|
4
|
+
effect: () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Copied from `@base-ui/utils/useValueAsRef`.
|
|
8
|
+
*
|
|
9
|
+
* Stores the latest value in a stable ref. The ref updates after React commits,
|
|
10
|
+
* so effects and delayed callbacks can read the current value without depending
|
|
11
|
+
* on it and rerunning.
|
|
12
|
+
*/
|
|
13
|
+
export default function useValueAsRef<T>(value: T): ValueRef<T>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ValueRef<T> {
|
|
2
|
+
current: T;
|
|
3
|
+
next: T;
|
|
4
|
+
effect: () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Copied from `@base-ui/utils/useValueAsRef`.
|
|
8
|
+
*
|
|
9
|
+
* Stores the latest value in a stable ref. The ref updates after React commits,
|
|
10
|
+
* so effects and delayed callbacks can read the current value without depending
|
|
11
|
+
* on it and rerunning.
|
|
12
|
+
*/
|
|
13
|
+
export default function useValueAsRef<T>(value: T): ValueRef<T>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = useValueAsRef;
|
|
9
|
+
var _useEnhancedEffect = _interopRequireDefault(require("../useEnhancedEffect/useEnhancedEffect"));
|
|
10
|
+
var _useLazyRef = _interopRequireDefault(require("../useLazyRef/useLazyRef"));
|
|
11
|
+
/**
|
|
12
|
+
* Copied from `@base-ui/utils/useValueAsRef`.
|
|
13
|
+
*
|
|
14
|
+
* Stores the latest value in a stable ref. The ref updates after React commits,
|
|
15
|
+
* so effects and delayed callbacks can read the current value without depending
|
|
16
|
+
* on it and rerunning.
|
|
17
|
+
*/
|
|
18
|
+
function useValueAsRef(value) {
|
|
19
|
+
const latest = (0, _useLazyRef.default)(() => createValueRef(value)).current;
|
|
20
|
+
latest.next = value;
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- effect never changes; it reads latest.next.
|
|
23
|
+
(0, _useEnhancedEffect.default)(latest.effect);
|
|
24
|
+
return latest;
|
|
25
|
+
}
|
|
26
|
+
function createValueRef(value) {
|
|
27
|
+
const latest = {
|
|
28
|
+
current: value,
|
|
29
|
+
next: value,
|
|
30
|
+
effect: () => {
|
|
31
|
+
latest.current = latest.next;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return latest;
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import useEnhancedEffect from "../useEnhancedEffect/useEnhancedEffect.mjs";
|
|
4
|
+
import useLazyRef from "../useLazyRef/useLazyRef.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Copied from `@base-ui/utils/useValueAsRef`.
|
|
7
|
+
*
|
|
8
|
+
* Stores the latest value in a stable ref. The ref updates after React commits,
|
|
9
|
+
* so effects and delayed callbacks can read the current value without depending
|
|
10
|
+
* on it and rerunning.
|
|
11
|
+
*/
|
|
12
|
+
export default function useValueAsRef(value) {
|
|
13
|
+
const latest = useLazyRef(() => createValueRef(value)).current;
|
|
14
|
+
latest.next = value;
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- effect never changes; it reads latest.next.
|
|
17
|
+
useEnhancedEffect(latest.effect);
|
|
18
|
+
return latest;
|
|
19
|
+
}
|
|
20
|
+
function createValueRef(value) {
|
|
21
|
+
const latest = {
|
|
22
|
+
current: value,
|
|
23
|
+
next: value,
|
|
24
|
+
effect: () => {
|
|
25
|
+
latest.current = latest.next;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return latest;
|
|
29
|
+
}
|