@primer/react 0.0.0-20260523120913 → 0.0.0-20260526182004
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 +38 -7
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +7 -4
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +17 -20
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +8 -16
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +8 -16
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +3 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +9 -12
- package/dist/internal/hooks/useDevOnlyEffect.d.ts +16 -0
- package/dist/internal/hooks/useDevOnlyEffect.d.ts.map +1 -0
- package/dist/internal/hooks/useDevOnlyEffect.js +25 -0
- package/dist/internal/hooks/useFocus.d.ts +9 -1
- package/dist/internal/hooks/useFocus.d.ts.map +1 -1
- package/dist/utils/testing/profiler.d.ts +35 -0
- package/dist/utils/testing/profiler.d.ts.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- [#7852](https://github.com/primer/react/pull/7852) [`5504680`](https://github.com/primer/react/commit/5504680614bacc2ce3eecaaa55d10887e6fb152d) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add `data-component` attributes to `Card` and its subcomponents (`Icon`, `Image`, `Heading`, `Description`, `Metadata`, `Menu`). Add an `as` prop (`'div' | 'section'`) so standalone Cards can render as a labelled region landmark; `as="section"` requires `aria-label` or `aria-labelledby`. `Card` now requires `children`. Also improves docs and stories.
|
|
3
|
+
## 0.0.0-20260526182004
|
|
8
4
|
|
|
9
5
|
### Patch Changes
|
|
10
6
|
|
|
11
|
-
- [#
|
|
7
|
+
- [#7864](https://github.com/primer/react/pull/7864) [`e7205ea`](https://github.com/primer/react/commit/e7205ea51b02fb1b7ac9de2df122f7ba67ebe078) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Eliminate nested-update cascades in `useFocus`, `PageLayout.Pane`, and
|
|
8
|
+
`AnchoredOverlay`:
|
|
12
9
|
|
|
13
|
-
-
|
|
10
|
+
- `useFocus` no longer produces a second re-render after focusing; one
|
|
11
|
+
`focus()` call now results in exactly one render instead of two.
|
|
12
|
+
- `PageLayout.Pane` (resizable) no longer triggers a forced re-render
|
|
13
|
+
before paint on mount. The CSS variable and ARIA attributes are still
|
|
14
|
+
updated synchronously in the layout effect; the React state sync is
|
|
15
|
+
wrapped in `startTransition` so it runs in the transition lane rather
|
|
16
|
+
than as part of the layout-effect commit.
|
|
17
|
+
- `AnchoredOverlay` no longer keeps `useAnchoredPosition`'s scroll
|
|
18
|
+
listeners and `ResizeObserver` attached while it is closed. After an
|
|
19
|
+
open→close cycle, the first scroll/resize event no longer fires a
|
|
20
|
+
spurious `setPosition(undefined)` that re-renders the closed overlay.
|
|
21
|
+
|
|
22
|
+
Also adds a profiler-based test harness at
|
|
23
|
+
`src/utils/testing/profiler.tsx` so future regressions can be pinned with
|
|
24
|
+
`counter.updateCount` and `counter.nestedUpdateCount` assertions.
|
|
14
25
|
|
|
15
26
|
- Fake entry to force publishing
|
|
16
27
|
|
|
@@ -24,6 +35,26 @@
|
|
|
24
35
|
layout effect. Behavior is unchanged for consumers, but the initial mount and
|
|
25
36
|
overflow-state transitions produce far fewer per-item renders.
|
|
26
37
|
|
|
38
|
+
- [#7874](https://github.com/primer/react/pull/7874) [`8cc7e99`](https://github.com/primer/react/commit/8cc7e998d2dbde1fb927b598755810b534702a6a) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Dev-only effects (the `if (__DEV__) { useEffect(...) }` pattern with an
|
|
39
|
+
`eslint-disable react-hooks/rules-of-hooks` comment at every call site) are
|
|
40
|
+
now expressed via a new internal `useDevOnlyEffect` hook. The lint
|
|
41
|
+
suppression lives in the wrapper, the effect is dropped from production by
|
|
42
|
+
the consumer's `process.env.NODE_ENV` replacement, and call sites get
|
|
43
|
+
`react-hooks/exhaustive-deps` lint via `additionalEffectHooks`. No public
|
|
44
|
+
API changes.
|
|
45
|
+
|
|
46
|
+
## 38.25.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- [#7852](https://github.com/primer/react/pull/7852) [`5504680`](https://github.com/primer/react/commit/5504680614bacc2ce3eecaaa55d10887e6fb152d) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add `data-component` attributes to `Card` and its subcomponents (`Icon`, `Image`, `Heading`, `Description`, `Metadata`, `Menu`). Add an `as` prop (`'div' | 'section'`) so standalone Cards can render as a labelled region landmark; `as="section"` requires `aria-label` or `aria-labelledby`. `Card` now requires `children`. Also improves docs and stories.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- [#7858](https://github.com/primer/react/pull/7858) [`1ce2906`](https://github.com/primer/react/commit/1ce2906d1816ba443eacfede67d496d074b8d2fb) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add additional fallbacks for CSS Anchor Positioning
|
|
55
|
+
|
|
56
|
+
- [#7843](https://github.com/primer/react/pull/7843) [`fc571fd`](https://github.com/primer/react/commit/fc571fd8c3899f19a1dd9e77b8a22f6528d776e2) Thanks [@joshblack](https://github.com/joshblack)! - Update useMergedRefs so that in React 18 no warning is emitted
|
|
57
|
+
|
|
27
58
|
## 38.24.0
|
|
28
59
|
|
|
29
60
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":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QAAQ,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAuRnF,CAAA"}
|
|
@@ -110,10 +110,13 @@ const AnchoredOverlay = ({
|
|
|
110
110
|
anchorOffset,
|
|
111
111
|
displayInViewport,
|
|
112
112
|
onPositionChange: positionChange,
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
// handles
|
|
116
|
-
|
|
113
|
+
// Disable position computation, scroll listeners, and resize observers
|
|
114
|
+
// when the overlay is closed (no floating element to position) or when
|
|
115
|
+
// native CSS anchor positioning is active (the browser handles it).
|
|
116
|
+
// Skipping the listeners while closed avoids a wasted re-render on the
|
|
117
|
+
// first scroll/resize after a close (where `setPosition(undefined)`
|
|
118
|
+
// would otherwise clear the stale open-position state).
|
|
119
|
+
enabled: open && !cssAnchorPositioning
|
|
117
120
|
}, [overlayElement]);
|
|
118
121
|
useEffect(() => {
|
|
119
122
|
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,OAAO,EAAqB,KAAK,WAAW,EAAC,MAAM,WAAW,CAAA;AAK9D,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA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CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAA;AAIxE,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;AAErE,QAAA,MAAM,qBAAqB,EAYrB,8BAA8B,CAAC,QAAQ,EAAE,0BAA0B,CAAC,CAAA;AAI1E,OAAO,EAAC,mBAAmB,EAAE,qBAAqB,EAAC,CAAA"}
|
package/dist/Banner/Banner.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
3
4
|
import { XIcon, AlertIcon, InfoIcon, CheckCircleIcon, StopIcon } from '@primer/octicons-react';
|
|
4
5
|
import { IconButton } from '../Button/IconButton.js';
|
|
5
6
|
import { ButtonComponent } from '../Button/Button.js';
|
|
@@ -42,25 +43,21 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
42
43
|
const supportsCustomIcon = variant === 'info' || variant === 'upsell';
|
|
43
44
|
const titleId = useId();
|
|
44
45
|
const visual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : icon;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
throw new Error('Expected a title to be provided to the <Banner> component with the `title` prop or through `<Banner.Title>` but no title was found');
|
|
61
|
-
}
|
|
62
|
-
}, [title]);
|
|
63
|
-
}
|
|
46
|
+
useDevOnlyEffect(() => {
|
|
47
|
+
if (title) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const {
|
|
51
|
+
current: banner
|
|
52
|
+
} = bannerRef;
|
|
53
|
+
if (!banner) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const hasTitle = banner.querySelector('[data-banner-title]');
|
|
57
|
+
if (!hasTitle) {
|
|
58
|
+
throw new Error('Expected a title to be provided to the <Banner> component with the `title` prop or through `<Banner.Title>` but no title was found');
|
|
59
|
+
}
|
|
60
|
+
}, [title]);
|
|
64
61
|
return /*#__PURE__*/jsx(BannerContext.Provider, {
|
|
65
62
|
value: {
|
|
66
63
|
titleId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../src/Heading/Heading.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../src/Heading/Heading.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAG/F,KAAK,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE5D,KAAK,kBAAkB,GAAG;IACxB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;CACvC,CAAA;AAED,QAAA,MAAM,OAAO,EAoBP,8BAA8B,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAA;AAIvE,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,OAAO,CAAC,CAAA;AACzD,eAAe,OAAO,CAAA"}
|
package/dist/Heading/Heading.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
3
4
|
import classes from './Heading.module.css.js';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
@@ -12,21 +13,12 @@ const Heading = /*#__PURE__*/forwardRef(({
|
|
|
12
13
|
}, forwardedRef) => {
|
|
13
14
|
const innerRef = React.useRef(null);
|
|
14
15
|
const mergedRef = useMergedRefs(forwardedRef, innerRef);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (innerRef.current && !(innerRef.current instanceof HTMLHeadingElement)) {
|
|
25
|
-
// eslint-disable-next-line no-console
|
|
26
|
-
console.warn('This Heading component should be an instanceof of h1-h6');
|
|
27
|
-
}
|
|
28
|
-
}, [innerRef]);
|
|
29
|
-
}
|
|
16
|
+
useDevOnlyEffect(() => {
|
|
17
|
+
if (innerRef.current && !(innerRef.current instanceof HTMLHeadingElement)) {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.warn('This Heading component should be an instanceof of h1-h6');
|
|
20
|
+
}
|
|
21
|
+
}, [innerRef]);
|
|
30
22
|
return /*#__PURE__*/jsx(Component, {
|
|
31
23
|
className: clsx(className, classes.Heading),
|
|
32
24
|
"data-variant": variant,
|
package/dist/Link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAC,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAI/D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,KAAK,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IACzD,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,EAC9D,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,EACjD,KAAK,YAAY,CAAC,OAAO,CAAC,sBAiC3B,CAAA;AAID,QAAA,MAAM,IAAI,IAvCoB,EAAE,SAAS,KAAK,CAAC,WAAW;;;;CAuCM,CAAA;AAEhE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,eAAe,IAAI,CAAA"}
|
package/dist/Link/Link.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
3
4
|
import classes from './Link.module.css.js';
|
|
4
5
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -16,21 +17,12 @@ const UnwrappedLink = (props, ref) => {
|
|
|
16
17
|
} = props;
|
|
17
18
|
const innerRef = React.useRef(null);
|
|
18
19
|
const mergedRef = useMergedRefs(ref, innerRef);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (innerRef.current && !(innerRef.current instanceof HTMLButtonElement) && !(innerRef.current instanceof HTMLAnchorElement)) {
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.error('Error: Found `Link` component that renders an inaccessible element', innerRef.current, 'Please ensure `Link` always renders as <a> or <button>');
|
|
31
|
-
}
|
|
32
|
-
}, [innerRef]);
|
|
33
|
-
}
|
|
20
|
+
useDevOnlyEffect(() => {
|
|
21
|
+
if (innerRef.current && !(innerRef.current instanceof HTMLButtonElement) && !(innerRef.current instanceof HTMLAnchorElement)) {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.error('Error: Found `Link` component that renders an inaccessible element', innerRef.current, 'Please ensure `Link` always renders as <a> or <button>');
|
|
24
|
+
}
|
|
25
|
+
}, [innerRef]);
|
|
34
26
|
return /*#__PURE__*/jsx(Component, {
|
|
35
27
|
className: clsx(className, classes.Link),
|
|
36
28
|
"data-component": "Link",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaneWidth.d.ts","sourceRoot":"","sources":["../../src/PageLayout/usePaneWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAQrD,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,CAAA;AAEhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,WAAW,CAAA;IAChB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,uFAAuF;IACvF,eAAe,CAAC,EAAE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AG,KAAK,IAAI,kBAErE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,cAAc,KAAG,KAAK,IAAI,SAE5D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,GAAG,cAAc,KAAG,MAOvD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAGpD;AAID,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,WAAW,GAAG,IAAI,EAC1B,QAAQ;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAC,SASvD,CAAA;AA8BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,mBAA2B,EAC3B,WAAW,EACX,YAAY,EAAE,eAAe,GAC9B,EAAE,mBAAmB,GAAG,kBAAkB,CAwR1C"}
|
|
@@ -350,13 +350,15 @@ function usePaneWidth(t0) {
|
|
|
350
350
|
maxWidthDiffRef.current = getMaxWidthDiffFromViewport();
|
|
351
351
|
const initialMax = getMaxPaneWidthRef.current();
|
|
352
352
|
maxPaneWidthRef.current = initialMax;
|
|
353
|
-
setMaxPaneWidth(initialMax);
|
|
354
353
|
(_paneRef$current3 = paneRef.current) === null || _paneRef$current3 === void 0 ? void 0 : _paneRef$current3.style.setProperty("--pane-max-width", `${initialMax}px`);
|
|
355
354
|
updateAriaValues(handleRef.current, {
|
|
356
355
|
min: minPaneWidth,
|
|
357
356
|
max: initialMax,
|
|
358
357
|
current: currentWidthRef.current
|
|
359
358
|
});
|
|
359
|
+
startTransition(() => {
|
|
360
|
+
setMaxPaneWidth(initialMax);
|
|
361
|
+
});
|
|
360
362
|
if (customMaxWidth !== null && !constrainToViewport) {
|
|
361
363
|
return;
|
|
362
364
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAA;AAqB/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAkHD,eAAO,MAAM,YAAY,mFA2ZxB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState,
|
|
1
|
+
import React, { forwardRef, useRef, useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
2
3
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
4
|
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
4
5
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
@@ -196,18 +197,14 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
196
197
|
});
|
|
197
198
|
// This is the case where the viewport is too narrow to show any list item with the more menu. In this case, we only show the dropdown
|
|
198
199
|
const onlyMenuVisible = overflowState.items.length === 0;
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// Address illegal state where there are multiple items that have `aria-current='page'` attribute
|
|
204
|
-
const activeElements = validChildren.filter(child => {
|
|
205
|
-
return child.props['aria-current'] !== undefined;
|
|
206
|
-
});
|
|
207
|
-
!(activeElements.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only one current element is allowed') : invariant(false) : void 0;
|
|
208
|
-
!ariaLabel ? process.env.NODE_ENV !== "production" ? invariant(false, 'Use the `aria-label` prop to provide an accessible label for assistive technology') : invariant(false) : void 0;
|
|
200
|
+
useDevOnlyEffect(() => {
|
|
201
|
+
// Address illegal state where there are multiple items that have `aria-current='page'` attribute
|
|
202
|
+
const activeElements = validChildren.filter(child => {
|
|
203
|
+
return child.props['aria-current'] !== undefined;
|
|
209
204
|
});
|
|
210
|
-
|
|
205
|
+
!(activeElements.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only one current element is allowed') : invariant(false) : void 0;
|
|
206
|
+
!ariaLabel ? process.env.NODE_ENV !== "production" ? invariant(false, 'Use the `aria-label` prop to provide an accessible label for assistive technology') : invariant(false) : void 0;
|
|
207
|
+
}, [validChildren, ariaLabel]);
|
|
211
208
|
|
|
212
209
|
// Returns the measured "no icon" width for an item, looking up by element key.
|
|
213
210
|
// Previously this was a text-based lookup, which silently returned 0 when an
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs an effect only in development. Wrapping `useEffect` in a regular hook
|
|
3
|
+
* with an outer `__DEV__` guard keeps the production cost to zero (the entire
|
|
4
|
+
* call is dropped by the consumer's `process.env.NODE_ENV` replacement) while
|
|
5
|
+
* centralising the `eslint-disable react-hooks/rules-of-hooks` to one place
|
|
6
|
+
* instead of every call site.
|
|
7
|
+
*
|
|
8
|
+
* `exhaustive-deps` is wired up to also check call sites of this hook via
|
|
9
|
+
* `additionalEffectHooks` in `eslint.config.mjs`, so callers get the same
|
|
10
|
+
* deps lint they would for a plain `useEffect`.
|
|
11
|
+
*
|
|
12
|
+
* @param effect The effect callback to run in development.
|
|
13
|
+
* @param deps Dependency list, same semantics as `useEffect`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useDevOnlyEffect: (effect: React.EffectCallback, deps?: React.DependencyList) => void;
|
|
16
|
+
//# sourceMappingURL=useDevOnlyEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDevOnlyEffect.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useDevOnlyEffect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,KAAK,CAAC,cAAc,EAAE,OAAO,KAAK,CAAC,cAAc,SAMzF,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runs an effect only in development. Wrapping `useEffect` in a regular hook
|
|
5
|
+
* with an outer `__DEV__` guard keeps the production cost to zero (the entire
|
|
6
|
+
* call is dropped by the consumer's `process.env.NODE_ENV` replacement) while
|
|
7
|
+
* centralising the `eslint-disable react-hooks/rules-of-hooks` to one place
|
|
8
|
+
* instead of every call site.
|
|
9
|
+
*
|
|
10
|
+
* `exhaustive-deps` is wired up to also check call sites of this hook via
|
|
11
|
+
* `additionalEffectHooks` in `eslint.config.mjs`, so callers get the same
|
|
12
|
+
* deps lint they would for a plain `useEffect`.
|
|
13
|
+
*
|
|
14
|
+
* @param effect The effect callback to run in development.
|
|
15
|
+
* @param deps Dependency list, same semantics as `useEffect`.
|
|
16
|
+
*/
|
|
17
|
+
const useDevOnlyEffect = (effect, deps) => {
|
|
18
|
+
if (process.env.NODE_ENV !== "production") {
|
|
19
|
+
// Forwarding wrapper; deps lint applies at call sites.
|
|
20
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
21
|
+
useEffect(effect, deps);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { useDevOnlyEffect };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Returns a function that focuses the given element on the next render commit.
|
|
4
|
+
*
|
|
5
|
+
* The target is stored in a ref (not state) and the effect is gated by a
|
|
6
|
+
* version counter, so calling `focus()` produces exactly one render — never
|
|
7
|
+
* the two-render cascade you'd get from `setState(target)` followed by
|
|
8
|
+
* `setState(null)` inside the effect.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFocus(): (target: HTMLElement | RefObject<HTMLElement>) => void;
|
|
3
11
|
//# sourceMappingURL=useFocus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocus.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"useFocus.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useFocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAE9E;;;;;;;GAOG;AACH,wBAAgB,QAAQ,aAgBM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,UAIjE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
export type RenderCounter = {
|
|
3
|
+
/** Total number of times the wrapped subtree has rendered (mount + updates). */
|
|
4
|
+
readonly count: number;
|
|
5
|
+
/** Number of mount renders. */
|
|
6
|
+
readonly mountCount: number;
|
|
7
|
+
/** Number of update renders (any cause). */
|
|
8
|
+
readonly updateCount: number;
|
|
9
|
+
/**
|
|
10
|
+
* Number of updates triggered inside the same commit cycle that produced the
|
|
11
|
+
* original render — i.e., a `setState` call from inside a `useLayoutEffect`
|
|
12
|
+
* that forced a synchronous re-render before paint. This is the canonical
|
|
13
|
+
* "nested update" / cascade signal; assert `nestedUpdateCount === 0` to pin
|
|
14
|
+
* that a component never forces a double-commit.
|
|
15
|
+
*/
|
|
16
|
+
readonly nestedUpdateCount: number;
|
|
17
|
+
/** Reset the counter. */
|
|
18
|
+
reset(): void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns a `[Wrap, counter]` pair. Wrap the component under test with `Wrap`
|
|
22
|
+
* to count how many times its subtree renders. Useful for asserting that a
|
|
23
|
+
* single user interaction (or a stable prop) does not cause cascading renders.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const [Wrap, counter] = createRenderCounter()
|
|
27
|
+
* render(<Wrap><MyComponent /></Wrap>)
|
|
28
|
+
* // ... interaction ...
|
|
29
|
+
* expect(counter.updateCount).toBe(1)
|
|
30
|
+
* expect(counter.nestedUpdateCount).toBe(0)
|
|
31
|
+
*/
|
|
32
|
+
export declare function createRenderCounter(id?: string): [(props: {
|
|
33
|
+
children: ReactElement | ReactElement[];
|
|
34
|
+
}) => ReactElement, RenderCounter];
|
|
35
|
+
//# sourceMappingURL=profiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../../src/utils/testing/profiler.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA0C,KAAK,YAAY,EAAC,MAAM,OAAO,CAAA;AAEvF,MAAM,MAAM,aAAa,GAAG;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,SAAkB,GACnB,CAAC,CAAC,KAAK,EAAE;IAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;CAAC,KAAK,YAAY,EAAE,aAAa,CAAC,CAsCrF"}
|
package/package.json
CHANGED