@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260805165233
3
+ ## 0.0.0-20260805174819
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -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(21);
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] === Symbol.for("react.memo_cache_sentinel")) {
400
- t1 = { groupHeading: GroupHeading };
401
- $[5] = t1;
402
- } else t1 = $[5];
403
- const [slots, childrenWithoutHeading] = useSlots(children, t1);
414
+ if ($[5] !== children) {
415
+ t1 = flattenFragmentChildren(children);
416
+ $[5] = children;
417
+ $[6] = t1;
418
+ } else t1 = $[6];
404
419
  let t2;
405
- if ($[6] !== headingLevel) {
406
- t2 = headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
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 groupHeadingAs = t2;
424
+ const [slots] = useSlots(t1, t2);
411
425
  let t3;
412
- if ($[8] !== hideDivider) {
413
- t3 = !hideDivider && /*#__PURE__*/ jsx(ActionList.Divider, {});
414
- $[8] = hideDivider;
415
- $[9] = t3;
416
- } else t3 = $[9];
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 ($[10] !== groupHeadingAs || $[11] !== slots.groupHeading || $[12] !== title) {
419
- t4 = slots.groupHeading ? /*#__PURE__*/ React.cloneElement(slots.groupHeading, { headingWrapElement: "div" }) : title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
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
- $[10] = groupHeadingAs;
425
- $[11] = slots.groupHeading;
426
- $[12] = title;
427
- $[13] = t4;
428
- } else t4 = $[13];
429
- let t5;
430
- if ($[14] !== childrenWithoutHeading || $[15] !== props || $[16] !== t4) {
431
- t5 = /*#__PURE__*/ jsxs(ActionList.Group, {
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: [t4, childrenWithoutHeading]
462
+ children: [t6, childrenWithoutHeading]
434
463
  });
435
- $[14] = childrenWithoutHeading;
436
- $[15] = props;
437
- $[16] = t4;
438
- $[17] = t5;
439
- } else t5 = $[17];
440
- let t6;
441
- if ($[18] !== t3 || $[19] !== t5) {
442
- t6 = /*#__PURE__*/ jsxs(Fragment, { children: [t3, t5] });
443
- $[18] = t3;
444
- $[19] = t5;
445
- $[20] = t6;
446
- } else t6 = $[20];
447
- return t6;
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260805165233",
4
+ "version": "0.0.0-20260805174819",
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",