@primer/react 0.0.0-20260602154623 → 0.0.0-20260602172019

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260602154623
3
+ ## 0.0.0-20260602172019
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAapE,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;AAOD,eAAO,MAAM,YAAY,mFA4IxB,CAAA"}
1
+ {"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqC,MAAM,OAAO,CAAA;AAczD,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;AAOD,eAAO,MAAM,YAAY,mFAwIxB,CAAA"}
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useRef, useState, useEffect } from 'react';
1
+ import React, { forwardRef, useRef, useState } from 'react';
2
2
  import VisuallyHidden from '../_VisuallyHidden.js';
3
3
  import { ActionList } from '../ActionList/index.js';
4
4
  import { UnderlineWrapper, UnderlineItemList, LoadingCounter } from '../internal/components/UnderlineTabbedInterface.js';
@@ -7,6 +7,7 @@ import classes from './UnderlineNav.module.css.js';
7
7
  import { UnderlineNavContext } from './UnderlineNavContext.js';
8
8
  import { UnderlineNavItemsRegistry } from './UnderlineNavItem.js';
9
9
  import { clsx } from 'clsx';
10
+ import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
10
11
  import { jsxs, jsx } from 'react/jsx-runtime';
11
12
  import { SkeletonText } from '../SkeletonText/SkeletonText.js';
12
13
  import CounterLabel from '../CounterLabel/CounterLabel.js';
@@ -39,20 +40,15 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
39
40
  // Find the current item if it has overflowed into the menu, so we can reflect
40
41
  // its "current" state on the overflow menu anchor.
41
42
  const overflowingCurrentItem = (_menuItems$find = menuItems.find(([, itemProps]) => itemProps['aria-current'] !== undefined && itemProps['aria-current'] !== false && itemProps['aria-current'] !== 'false')) === null || _menuItems$find === void 0 ? void 0 : _menuItems$find[1];
42
- if (process.env.NODE_ENV !== "production") {
43
- const validChildren = getValidChildren(children);
44
-
45
- // Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
46
- // eslint-disable-next-line react-hooks/rules-of-hooks
47
- useEffect(() => {
48
- // Address illegal state where there are multiple items that have `aria-current='page'` attribute
49
- const activeElements = validChildren.filter(child => {
50
- return child.props['aria-current'] !== undefined;
51
- });
52
- !(activeElements.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only one current element is allowed') : invariant(false) : void 0;
53
- !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;
54
- }, [validChildren, ariaLabel]);
55
- }
43
+ const validChildren = getValidChildren(children);
44
+ useDevOnlyEffect(() => {
45
+ // Address illegal state where there are multiple items that have `aria-current='page'` attribute
46
+ const activeElements = validChildren.filter(child => {
47
+ return child.props['aria-current'] !== undefined;
48
+ });
49
+ !(activeElements.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only one current element is allowed') : invariant(false) : void 0;
50
+ !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;
51
+ }, [validChildren, ariaLabel]);
56
52
  return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
57
53
  value: {
58
54
  loadingCounters
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260602154623",
4
+ "version": "0.0.0-20260602172019",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",