@primer/react 0.0.0-20260623184653 → 0.0.0-20260623191445
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAqBtE,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;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAsGhC,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAqBtE,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;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAsGhC,eAAO,MAAM,YAAY,mFA6UxB,CAAA"}
|
|
@@ -164,18 +164,32 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
164
164
|
menuItems: []
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
// (placing all items inline with no overflow menu) until the layout effect below recomputes.
|
|
167
|
+
// The ordered signature drives `useResizeObserver` deps below so it re-fires whenever
|
|
168
|
+
// children are added, removed, or reordered.
|
|
170
169
|
const childrenSignature = validChildren.map(child => {
|
|
171
170
|
var _child$key;
|
|
172
171
|
return String((_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : '');
|
|
173
172
|
}).join('|');
|
|
174
|
-
|
|
173
|
+
|
|
174
|
+
// `childrenChanged` only tracks membership (set of keys), not order. This is intentional
|
|
175
|
+
// because `swapMenuItemWithListItem` legitimately reorders `responsiveProps.items` (to keep
|
|
176
|
+
// the selected item visible), and we don't want that to be treated as a stale-children
|
|
177
|
+
// situation. We only need to fall back to rendering `validChildren` directly when a child
|
|
178
|
+
// was actually added or removed (so a new item isn't missed and a removed item isn't kept).
|
|
179
|
+
const responsiveKeys = new Set();
|
|
180
|
+
for (const item of responsiveProps.items) {
|
|
175
181
|
var _item$key;
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
const
|
|
182
|
+
responsiveKeys.add(String((_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : ''));
|
|
183
|
+
}
|
|
184
|
+
for (const item of responsiveProps.menuItems) {
|
|
185
|
+
var _item$key2;
|
|
186
|
+
responsiveKeys.add(String((_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : ''));
|
|
187
|
+
}
|
|
188
|
+
const validKeys = validChildren.map(child => {
|
|
189
|
+
var _child$key2;
|
|
190
|
+
return String((_child$key2 = child.key) !== null && _child$key2 !== void 0 ? _child$key2 : '');
|
|
191
|
+
});
|
|
192
|
+
const childrenChanged = validKeys.length !== responsiveKeys.size || validKeys.some(key => !responsiveKeys.has(key));
|
|
179
193
|
|
|
180
194
|
// Make sure to have the fresh props data for list items when children are changed (keeping aria-current up-to-date)
|
|
181
195
|
const listItems = childrenChanged ? validChildren : responsiveProps.items.map(item => {
|
package/package.json
CHANGED