@primer/react 0.0.0-20260805174819 → 0.0.0-20260805195449

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,11 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260805174819
3
+ ## 0.0.0-20260805195449
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8212](https://github.com/primer/react/pull/8212) [`6a4c131`](https://github.com/primer/react/commit/6a4c1319a70a5f3b5abc7b81b044bd26d042aa75) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ThemeProvider: Add a CSS-variable-based implementation to `@primer/react/next`
8
+ and deprecate the legacy JavaScript theme implementation.
4
9
 
5
10
  ### Patch Changes
6
11
 
@@ -8,8 +13,6 @@
8
13
 
9
14
  - [#8258](https://github.com/primer/react/pull/8258) [`edbcd94`](https://github.com/primer/react/commit/edbcd942354ff45148c2623be8b543ef8789a20f) Thanks [@llastflowers](https://github.com/llastflowers)! - Update `AvatarStack` to not reserve space when collapsed
10
15
 
11
- - [#8273](https://github.com/primer/react/pull/8273) [`8243fbd`](https://github.com/primer/react/commit/8243fbd6276cd00e2f693d45990ae4fe89057c84) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - NavList: Exclude group headings from navigation list item counts
12
-
13
16
  ## 38.35.0
14
17
 
15
18
  ### Minor Changes
@@ -0,0 +1,2 @@
1
+ .prc-ActionList-Group-lMIPQ{list-style:none}.prc-ActionList-Group-lMIPQ:not(:first-child){margin-block-start:var(--base-size-8,.5rem)}.prc-ActionList-Group-lMIPQ:not(:first-child):has(.prc-ActionList-GroupHeadingWrap-laXcX+ul>.prc-ActionList-GroupHeadingWrap-laXcX)>.prc-ActionList-GroupHeadingWrap-laXcX{display:none}.prc-ActionList-GroupList-V5B3-{padding-inline-start:0}.prc-ActionList-GroupHeadingWrap-laXcX{color:var(--fgColor-muted,#59636e);display:flex;flex-direction:column;font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);line-height:18px;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]){background:var(--bgColor-muted,#f6f8fa);border-bottom:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);border-top:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);margin-block-end:var(--base-size-8,.5rem);margin-block-start:calc(var(--base-size-8,.5rem) - var(--borderWidth-thin,.0625rem));padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]):first-child{margin-block-start:0}.prc-ActionList-GroupHeading-STzxi{align-self:flex-start;color:var(--fgColor-muted,#59636e);font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);margin:0}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]{align-items:center;flex-direction:row;gap:var(--base-size-8,.5rem);justify-content:space-between}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]>.prc-ActionList-GroupHeading-STzxi{align-self:center}.prc-ActionList-GroupHeadingTrailingAction-jnb64{align-items:center;display:inline-flex;margin-inline-start:auto}
2
+ /*# sourceMappingURL=Group-efcb39da.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ActionList/Group.module.css.js"],"names":[],"mappings":"AAAA,4BACE,eAcF,CAZE,8CACE,2CAUF,CAJI,2KACE,YACF,CAKN,gCACE,sBACF,CAEA,uCAQE,kCAA2B,CAP3B,YAAa,CAQb,qBAAsB,CAPtB,4CAAsC,CACtC,gDAA6C,CAI7C,gBAAiB,CAIjB,wCAAiC,CADjC,uCAoBF,CAjBE,oEAIE,uCAAgC,CAEhC,uFAAqE,CADrE,oFAAkE,CAFlE,yCAAoC,CADpC,oFAAsE,CAKtE,uCAKF,CAHE,gFACE,oBACF,CAQJ,mCAKE,qBAAsB,CADtB,kCAA2B,CAF3B,4CAAsC,CACtC,gDAA6C,CAF7C,QAKF,CAEA,iEAEE,kBAAmB,CADnB,kBAAmB,CAGnB,4BAAuB,CADvB,6BAMF,CAHE,oGACE,iBACF,CAGF,iDAEE,kBAAmB,CADnB,mBAAoB,CAEpB,wBACF","file":"Group-efcb39da.css","sourcesContent":[".Group {\n list-style: none;\n\n &:not(:first-child) {\n margin-block-start: var(--base-size-8);\n\n /* If somebody tries to pass the `title` prop AND a `NavList.GroupHeading` as a child, hide the `ActionList.GroupHeading */\n /* stylelint-disable-next-line selector-max-specificity, selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(.GroupHeadingWrap + ul > .GroupHeadingWrap) {\n /* stylelint-disable-next-line selector-max-specificity */\n & > .GroupHeadingWrap {\n display: none;\n }\n }\n }\n}\n\n.GroupList {\n padding-inline-start: 0;\n}\n\n.GroupHeadingWrap {\n display: flex;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n\n /* line-height: var(--text-body-lineHeight-small); use when FF rolls out */\n /* stylelint-disable-next-line primer/typography */\n line-height: 18px;\n color: var(--fgColor-muted);\n flex-direction: column;\n padding-inline: var(--base-size-16);\n padding-block: var(--base-size-6);\n\n &:where([data-variant='filled']) {\n /* stylelint-disable-next-line primer/spacing */\n margin-block-start: calc(var(--base-size-8) - var(--borderWidth-thin));\n margin-block-end: var(--base-size-8);\n background: var(--bgColor-muted);\n border-top: solid var(--borderWidth-thin) var(--borderColor-muted);\n border-bottom: solid var(--borderWidth-thin) var(--borderColor-muted);\n padding-inline: var(--base-size-16);\n\n &:first-child {\n margin-block-start: 0;\n }\n }\n\n /* & + ul:has(.GroupHeadingWrap) {\n outline: solid 1px red;\n } */\n}\n\n.GroupHeading {\n margin: 0;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n color: var(--fgColor-muted);\n align-self: flex-start;\n}\n\n.GroupHeadingWrap[data-has-trailing-action] {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: var(--base-size-8);\n\n & > .GroupHeading {\n align-self: center;\n }\n}\n\n.GroupHeadingTrailingAction {\n display: inline-flex;\n align-items: center;\n margin-inline-start: auto;\n}\n"]}
@@ -1,9 +1,9 @@
1
- import "./Group-d89306a8.css";
1
+ import "./Group-efcb39da.css";
2
2
  //#region src/ActionList/Group.module.css.js
3
3
  var Group_module_css_default = {
4
4
  "Group": "prc-ActionList-Group-lMIPQ",
5
- "GroupList": "prc-ActionList-GroupList-V5B3-",
6
5
  "GroupHeadingWrap": "prc-ActionList-GroupHeadingWrap-laXcX",
6
+ "GroupList": "prc-ActionList-GroupList-V5B3-",
7
7
  "GroupHeading": "prc-ActionList-GroupHeading-STzxi",
8
8
  "GroupHeadingTrailingAction": "prc-ActionList-GroupHeadingTrailingAction-jnb64"
9
9
  };
@@ -1,4 +1,4 @@
1
- import { FCWithSlotMarker, WithSlotMarker } from "../utils/types/Slots.js";
1
+ import { FCWithSlotMarker } from "../utils/types/Slots.js";
2
2
  import { ForwardRefComponent } from "../utils/polymorphic.js";
3
3
  import { DistributiveOmit, PolymorphicProps } from "../utils/modern-polymorphic.js";
4
4
  import { ActionListTrailingActionProps } from "../ActionList/TrailingAction.js";
@@ -71,7 +71,7 @@ declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref">
71
71
  Divider: FCWithSlotMarker<React.PropsWithChildren<ActionListDividerProps>>;
72
72
  Group: React.FC<NavListGroupProps>;
73
73
  GroupExpand: React.ForwardRefExoticComponent<NavListGroupExpandProps & React.RefAttributes<HTMLButtonElement>>;
74
- GroupHeading: WithSlotMarker<React.FC<ActionListGroupHeadingProps>>;
74
+ GroupHeading: React.FC<ActionListGroupHeadingProps>;
75
75
  };
76
76
  //#endregion
77
77
  export { NavList, NavListDividerProps, NavListGroupExpandProps, NavListGroupHeadingProps, NavListGroupProps, NavListHeadingProps, NavListItemProps, NavListLeadingVisualProps, NavListProps, NavListSubNavProps, NavListTrailingVisualProps };
@@ -3,7 +3,6 @@ import { useId as useId$1 } from "../hooks/useId.js";
3
3
  import { useSlots } from "../hooks/useSlots.js";
4
4
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
5
5
  import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
6
- import { asSlot } from "../utils/as-slot.js";
7
6
  import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
8
7
  import Heading$1 from "../Heading/Heading.js";
9
8
  import ActionList_module_css_default from "../ActionList/ActionList.module.css.js";
@@ -375,23 +374,8 @@ const Divider = ActionList.Divider;
375
374
  Divider.displayName = "NavList.Divider";
376
375
  const TrailingAction = ActionList.TrailingAction;
377
376
  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
- }
393
377
  const Group = (t0) => {
394
- const $ = c(26);
378
+ const $ = c(19);
395
379
  let children;
396
380
  let hideDivider;
397
381
  let props;
@@ -411,69 +395,48 @@ const Group = (t0) => {
411
395
  }
412
396
  const headingLevel = React.useContext(NavListHeadingLevelContext);
413
397
  let t1;
414
- if ($[5] !== children) {
415
- t1 = flattenFragmentChildren(children);
416
- $[5] = children;
398
+ if ($[5] !== headingLevel) {
399
+ t1 = headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
400
+ $[5] = headingLevel;
417
401
  $[6] = t1;
418
402
  } else t1 = $[6];
403
+ const groupHeadingAs = t1;
419
404
  let t2;
420
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
421
- t2 = { groupHeading: GroupHeading };
422
- $[7] = t2;
423
- } else t2 = $[7];
424
- const [slots] = useSlots(t1, t2);
405
+ if ($[7] !== hideDivider) {
406
+ t2 = !hideDivider && /*#__PURE__*/ jsx(ActionList.Divider, {});
407
+ $[7] = hideDivider;
408
+ $[8] = t2;
409
+ } else t2 = $[8];
425
410
  let t3;
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;
433
- let 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, {
411
+ if ($[9] !== groupHeadingAs || $[10] !== title) {
412
+ t3 = title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
449
413
  as: groupHeadingAs,
450
414
  "data-component": "ActionList.GroupHeading",
451
415
  children: title
452
416
  }) : null;
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, {
417
+ $[9] = groupHeadingAs;
418
+ $[10] = title;
419
+ $[11] = t3;
420
+ } else t3 = $[11];
421
+ let t4;
422
+ if ($[12] !== children || $[13] !== props || $[14] !== t3) {
423
+ t4 = /*#__PURE__*/ jsxs(ActionList.Group, {
461
424
  ...props,
462
- children: [t6, childrenWithoutHeading]
425
+ children: [t3, children]
463
426
  });
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;
427
+ $[12] = children;
428
+ $[13] = props;
429
+ $[14] = t3;
430
+ $[15] = t4;
431
+ } else t4 = $[15];
432
+ let t5;
433
+ if ($[16] !== t2 || $[17] !== t4) {
434
+ t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
435
+ $[16] = t2;
436
+ $[17] = t4;
437
+ $[18] = t5;
438
+ } else t5 = $[18];
439
+ return t5;
477
440
  };
478
441
  const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
479
442
  const $ = c(23);
@@ -571,7 +534,7 @@ const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
571
534
  * This is an alternative to the `title` prop on `NavList.Group`.
572
535
  * It was primarily added to allow links in group headings.
573
536
  */
574
- const GroupHeadingImpl = (t0) => {
537
+ const GroupHeading = (t0) => {
575
538
  const $ = c(13);
576
539
  let as;
577
540
  let className;
@@ -619,7 +582,6 @@ const GroupHeadingImpl = (t0) => {
619
582
  } else t3 = $[12];
620
583
  return t3;
621
584
  };
622
- const GroupHeading = asSlot(GroupHeadingImpl, ActionList.GroupHeading);
623
585
  const NavList = Object.assign(Root, {
624
586
  Description: ActionList.Description,
625
587
  Heading,
@@ -0,0 +1,20 @@
1
+ import { ColorMode, ColorModeWithAuto, Theme } from "./ThemeProvider.js";
2
+ import React from "react";
3
+
4
+ //#region src/ThemeContext.d.ts
5
+ interface ThemeContextValue {
6
+ /** @deprecated Use `ThemeProvider` and `useTheme` from `@primer/react/next` to migrate away from JavaScript theme values. */
7
+ theme?: Theme;
8
+ colorScheme?: string;
9
+ colorMode?: ColorModeWithAuto;
10
+ resolvedColorMode?: ColorMode;
11
+ /** @deprecated Use `ThemeProvider` and `useTheme` from `@primer/react/next` to migrate away from JavaScript theme values. */
12
+ resolvedColorScheme?: string;
13
+ dayScheme?: string;
14
+ nightScheme?: string;
15
+ setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
16
+ setDayScheme: React.Dispatch<React.SetStateAction<string>>;
17
+ setNightScheme: React.Dispatch<React.SetStateAction<string>>;
18
+ }
19
+ //#endregion
20
+ export { ThemeContextValue };
@@ -21,6 +21,9 @@ type ThemeProviderProps = {
21
21
  */
22
22
  contextOnly?: boolean;
23
23
  };
24
+ /**
25
+ * @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values.
26
+ */
24
27
  declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
25
28
  //#endregion
26
29
  export { ColorMode, ColorModeWithAuto, Theme, ThemeProvider, ThemeProvider as default, ThemeProviderProps };
@@ -8,6 +8,9 @@ import React from "react";
8
8
  import deepmerge from "deepmerge";
9
9
  const defaultDayScheme = "light";
10
10
  const defaultNightScheme = "dark";
11
+ /**
12
+ * @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values.
13
+ */
11
14
  const ThemeProvider = (t0) => {
12
15
  var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
13
16
  const $ = c(34);