@primer/react 0.0.0-20260805165233 → 0.0.0-20260805174819
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 +1 -1
- package/dist/NavList/NavList.js +68 -39
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/NavList/NavList.js
CHANGED
|
@@ -375,8 +375,23 @@ const Divider = ActionList.Divider;
|
|
|
375
375
|
Divider.displayName = "NavList.Divider";
|
|
376
376
|
const TrailingAction = ActionList.TrailingAction;
|
|
377
377
|
TrailingAction.displayName = "NavList.TrailingAction";
|
|
378
|
+
function flattenFragmentChildren(children) {
|
|
379
|
+
const flattenedChildren = [];
|
|
380
|
+
React.Children.forEach(children, (child) => {
|
|
381
|
+
if (/*#__PURE__*/ React.isValidElement(child) && child.type === React.Fragment) flattenedChildren.push(...flattenFragmentChildren(child.props.children));
|
|
382
|
+
else flattenedChildren.push(child);
|
|
383
|
+
});
|
|
384
|
+
return flattenedChildren;
|
|
385
|
+
}
|
|
386
|
+
function removeChildFromFragments(children, childToRemove) {
|
|
387
|
+
return React.Children.map(children, (child) => {
|
|
388
|
+
if (child === childToRemove) return null;
|
|
389
|
+
if (/*#__PURE__*/ React.isValidElement(child) && child.type === React.Fragment) return /*#__PURE__*/ React.cloneElement(child, void 0, removeChildFromFragments(child.props.children, childToRemove));
|
|
390
|
+
return child;
|
|
391
|
+
});
|
|
392
|
+
}
|
|
378
393
|
const Group = (t0) => {
|
|
379
|
-
const $ = c(
|
|
394
|
+
const $ = c(26);
|
|
380
395
|
let children;
|
|
381
396
|
let hideDivider;
|
|
382
397
|
let props;
|
|
@@ -396,55 +411,69 @@ const Group = (t0) => {
|
|
|
396
411
|
}
|
|
397
412
|
const headingLevel = React.useContext(NavListHeadingLevelContext);
|
|
398
413
|
let t1;
|
|
399
|
-
if ($[5]
|
|
400
|
-
t1 =
|
|
401
|
-
$[5] =
|
|
402
|
-
|
|
403
|
-
|
|
414
|
+
if ($[5] !== children) {
|
|
415
|
+
t1 = flattenFragmentChildren(children);
|
|
416
|
+
$[5] = children;
|
|
417
|
+
$[6] = t1;
|
|
418
|
+
} else t1 = $[6];
|
|
404
419
|
let t2;
|
|
405
|
-
if ($[
|
|
406
|
-
t2 =
|
|
407
|
-
$[6] = headingLevel;
|
|
420
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
421
|
+
t2 = { groupHeading: GroupHeading };
|
|
408
422
|
$[7] = t2;
|
|
409
423
|
} else t2 = $[7];
|
|
410
|
-
const
|
|
424
|
+
const [slots] = useSlots(t1, t2);
|
|
411
425
|
let t3;
|
|
412
|
-
if ($[8] !==
|
|
413
|
-
t3 =
|
|
414
|
-
$[8] =
|
|
415
|
-
$[9] =
|
|
416
|
-
|
|
426
|
+
if ($[8] !== children || $[9] !== slots.groupHeading) {
|
|
427
|
+
t3 = slots.groupHeading ? removeChildFromFragments(children, slots.groupHeading) : children;
|
|
428
|
+
$[8] = children;
|
|
429
|
+
$[9] = slots.groupHeading;
|
|
430
|
+
$[10] = t3;
|
|
431
|
+
} else t3 = $[10];
|
|
432
|
+
const childrenWithoutHeading = t3;
|
|
417
433
|
let t4;
|
|
418
|
-
if ($[
|
|
419
|
-
t4 =
|
|
434
|
+
if ($[11] !== headingLevel) {
|
|
435
|
+
t4 = headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
|
|
436
|
+
$[11] = headingLevel;
|
|
437
|
+
$[12] = t4;
|
|
438
|
+
} else t4 = $[12];
|
|
439
|
+
const groupHeadingAs = t4;
|
|
440
|
+
let t5;
|
|
441
|
+
if ($[13] !== hideDivider) {
|
|
442
|
+
t5 = !hideDivider && /*#__PURE__*/ jsx(ActionList.Divider, {});
|
|
443
|
+
$[13] = hideDivider;
|
|
444
|
+
$[14] = t5;
|
|
445
|
+
} else t5 = $[14];
|
|
446
|
+
let t6;
|
|
447
|
+
if ($[15] !== groupHeadingAs || $[16] !== slots.groupHeading || $[17] !== title) {
|
|
448
|
+
t6 = slots.groupHeading ? /*#__PURE__*/ React.cloneElement(slots.groupHeading, { headingWrapElement: "div" }) : title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
|
|
420
449
|
as: groupHeadingAs,
|
|
421
450
|
"data-component": "ActionList.GroupHeading",
|
|
422
451
|
children: title
|
|
423
452
|
}) : null;
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
} else
|
|
429
|
-
let
|
|
430
|
-
if ($[
|
|
431
|
-
|
|
453
|
+
$[15] = groupHeadingAs;
|
|
454
|
+
$[16] = slots.groupHeading;
|
|
455
|
+
$[17] = title;
|
|
456
|
+
$[18] = t6;
|
|
457
|
+
} else t6 = $[18];
|
|
458
|
+
let t7;
|
|
459
|
+
if ($[19] !== childrenWithoutHeading || $[20] !== props || $[21] !== t6) {
|
|
460
|
+
t7 = /*#__PURE__*/ jsxs(ActionList.Group, {
|
|
432
461
|
...props,
|
|
433
|
-
children: [
|
|
462
|
+
children: [t6, childrenWithoutHeading]
|
|
434
463
|
});
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
} else
|
|
440
|
-
let
|
|
441
|
-
if ($[
|
|
442
|
-
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
} else
|
|
447
|
-
return
|
|
464
|
+
$[19] = childrenWithoutHeading;
|
|
465
|
+
$[20] = props;
|
|
466
|
+
$[21] = t6;
|
|
467
|
+
$[22] = t7;
|
|
468
|
+
} else t7 = $[22];
|
|
469
|
+
let t8;
|
|
470
|
+
if ($[23] !== t5 || $[24] !== t7) {
|
|
471
|
+
t8 = /*#__PURE__*/ jsxs(Fragment, { children: [t5, t7] });
|
|
472
|
+
$[23] = t5;
|
|
473
|
+
$[24] = t7;
|
|
474
|
+
$[25] = t8;
|
|
475
|
+
} else t8 = $[25];
|
|
476
|
+
return t8;
|
|
448
477
|
};
|
|
449
478
|
const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
450
479
|
const $ = c(23);
|
package/package.json
CHANGED