@primer/react 38.44.0 → 38.44.1-rc.16baf912a

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,5 +1,15 @@
1
1
  # @primer/react
2
2
 
3
+ ## 38.44.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#8612](https://github.com/primer/react/pull/8612) [`9cd1f8a`](https://github.com/primer/react/commit/9cd1f8ae897b8db44434474b937fda39f57f15f9) Thanks [@alexus37](https://github.com/alexus37)! - ActionBar, UnderlineNav: Batch descendant registry updates to reduce cascading renders during rapid item changes
8
+
9
+ - [#8638](https://github.com/primer/react/pull/8638) [`4b1cc1d`](https://github.com/primer/react/commit/4b1cc1d863209aa9aaf9f6ab47ae25b86de5c1e1) Thanks [@joshblack](https://github.com/joshblack)! - Polymorphic components: Fix TypeScript inference for component-specific props while preserving `as` support.
10
+
11
+ - [#8611](https://github.com/primer/react/pull/8611) [`68a5c0b`](https://github.com/primer/react/commit/68a5c0b18c800b8f6f6555f9d4d327c48389ae06) Thanks [@alexus37](https://github.com/alexus37)! - ActionMenu: Avoid an extra render when closed menus mount while preserving accessible trigger labeling
12
+
3
13
  ## 38.44.0
4
14
 
5
15
  ### Minor Changes
@@ -7,15 +7,15 @@ import { ActionListGroupHeadingTrailingActionProps } from "./GroupHeadingTrailin
7
7
  import { ActionListItemProps, ActionListProps } from "./shared.js";
8
8
  import { ActionListHeadingProps } from "./Heading.js";
9
9
  import { ActionListGroupHeadingProps, ActionListGroupProps } from "./Group.js";
10
+ import { ActionListLinkItemProps } from "./LinkItem.js";
10
11
  import { ActionListDividerProps } from "./Divider.js";
11
12
  import { ActionListDescriptionProps } from "./Description.js";
12
13
  import { ActionListLeadingVisualProps, ActionListTrailingVisualProps, VisualProps } from "./Visuals.js";
13
- import { ActionListLinkItemProps } from "./LinkItem.js";
14
14
  //#region src/ActionList/index.d.ts
15
15
  /**
16
16
  * Collection of list-related components.
17
17
  */
18
- declare const ActionList: (<As extends React.ElementType = "ul">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As> & {
18
+ declare const ActionList: (<As extends React.ElementType = "ul">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As>, "as"> & Omit<import("react").PropsWithChildren<{
19
19
  variant?: "inset" | "horizontal-inset" | "full";
20
20
  selectionVariant?: "single" | "radio" | "multiple";
21
21
  showDividers?: boolean;
@@ -23,9 +23,7 @@ declare const ActionList: (<As extends React.ElementType = "ul">(props: Distribu
23
23
  disableFocusZone?: boolean;
24
24
  className?: string;
25
25
  disableItemGap?: boolean;
26
- } & {
27
- children?: import("react").ReactNode | undefined;
28
- }, "as"> & {
26
+ }>, "as"> & {
29
27
  as?: As | undefined;
30
28
  } & import("react").RefAttributes<unknown>) => React.ReactNode) & {
31
29
  /** Context for the `ActionList` container. */ContainerContext: import("react").Context<{
@@ -89,18 +87,7 @@ declare const ActionList: (<As extends React.ElementType = "ul">(props: Distribu
89
87
  displayName: string;
90
88
  __SLOT__: symbol;
91
89
  }; /** A `Item` that renders a full-size anchor inside ListItem */
92
- LinkItem: WithSlotMarker<(<As extends React.ElementType = "a">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<ActionListItemProps, "active" | "children" | "inactiveText" | "size" | "variant"> & {
93
- download?: string;
94
- href?: string;
95
- hrefLang?: string;
96
- media?: string;
97
- ping?: string;
98
- rel?: string;
99
- target?: string;
100
- type?: string;
101
- referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
102
- className?: string;
103
- }, "as"> & {
90
+ LinkItem: WithSlotMarker<(<As extends React.ElementType = "a">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As>, "as"> & Omit<ActionListLinkItemProps, "as"> & {
104
91
  as?: As | undefined;
105
92
  } & {
106
93
  _PrivateTooltipText?: string;
@@ -1,4 +1,5 @@
1
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
+ import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
2
3
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
3
4
  import { useMenuKeyboardNavigation } from "../hooks/useMenuKeyboardNavigation.js";
4
5
  import { useId as useId$1 } from "../hooks/useId.js";
@@ -11,7 +12,7 @@ import { ActionListContainerContext } from "../ActionList/ActionListContainerCon
11
12
  import { Divider } from "../ActionList/Divider.js";
12
13
  import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
13
14
  import ActionMenu_module_css_default from "./ActionMenu.module.css.js";
14
- import React, { useCallback, useContext, useEffect, useMemo, useState } from "react";
15
+ import React, { useCallback, useContext, useMemo, useState } from "react";
15
16
  import { jsx } from "react/jsx-runtime";
16
17
  import { clsx } from "clsx";
17
18
  import { ChevronRightIcon, TriangleDownIcon } from "@primer/octicons-react";
@@ -183,18 +184,21 @@ const Overlay = ({ children, align = "start", side, onPositionChange, displayInV
183
184
  if (isNarrowFullscreen && gesture === "tab") return;
184
185
  onClose === null || onClose === void 0 || onClose(gesture);
185
186
  }, [isNarrowFullscreen, onClose]);
186
- useMenuKeyboardNavigation(open, handleClose, containerRef, anchorRef, isSubmenu);
187
+ const [anchorLabelReady, setAnchorLabelReady] = useState(false);
188
+ if (!open && anchorLabelReady) setAnchorLabelReady(false);
189
+ useMenuKeyboardNavigation(open && anchorLabelReady, handleClose, containerRef, anchorRef, isSubmenu);
187
190
  const responsiveVariant = useResponsiveValue(variant, {
188
191
  regular: "anchored",
189
192
  narrow: "anchored"
190
193
  });
191
194
  const [anchorAriaLabelledby, setAnchorAriaLabelledby] = useState(null);
192
- useEffect(() => {
193
- if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
194
- const ariaLabelledby = anchorRef.current.getAttribute("aria-labelledby");
195
- if (ariaLabelledby) setAnchorAriaLabelledby(ariaLabelledby);
195
+ useIsomorphicLayoutEffect(() => {
196
+ if (open) {
197
+ var _anchorRef$current$ge, _anchorRef$current;
198
+ setAnchorAriaLabelledby((_anchorRef$current$ge = (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.getAttribute("aria-labelledby")) !== null && _anchorRef$current$ge !== void 0 ? _anchorRef$current$ge : null);
199
+ setAnchorLabelReady(true);
196
200
  }
197
- }, [anchorRef]);
201
+ }, [anchorRef, open]);
198
202
  const afterSelect = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("item-select"), [onClose]);
199
203
  const overlayContextValue = useMemo(() => ({
200
204
  container: "ActionMenu",
@@ -215,7 +219,7 @@ const Overlay = ({ children, align = "start", side, onPositionChange, displayInV
215
219
  anchorRef,
216
220
  renderAnchor,
217
221
  anchorId,
218
- open,
222
+ open: open && anchorLabelReady,
219
223
  onOpen,
220
224
  onClose: handleClose,
221
225
  align,
@@ -5,7 +5,7 @@ import React from "react";
5
5
  type BranchNameProps<As extends React.ElementType> = PolymorphicProps<As, 'a', {
6
6
  className?: string;
7
7
  }>;
8
- declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
8
+ declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
9
9
  className?: string;
10
10
  }, "as"> & {
11
11
  as?: As | undefined;
@@ -42,7 +42,7 @@ type StyledBreadcrumbsItemProps<As extends React.ElementType = 'a'> = Polymorphi
42
42
  }>;
43
43
  type BreadcrumbsItemProps<As extends React.ElementType = 'a'> = StyledBreadcrumbsItemProps<As>;
44
44
  declare const _default: typeof Breadcrumbs & {
45
- Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
45
+ Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
46
46
  to?: To;
47
47
  selected?: boolean;
48
48
  }, "as"> & {
@@ -55,7 +55,7 @@ declare const _default: typeof Breadcrumbs & {
55
55
  * @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
56
56
  */
57
57
  declare const Breadcrumb: typeof Breadcrumbs & {
58
- Item: <As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
58
+ Item: <As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
59
59
  to?: To;
60
60
  selected?: boolean;
61
61
  }, "as"> & {
@@ -2,7 +2,7 @@ import { DistributiveOmit } from "../utils/modern-polymorphic.js";
2
2
  import { CardAction, CardActionProps as ActionProps, CardDescriptionProps as DescriptionProps, CardHeadingProps as HeadingProps, CardIcon, CardIconProps as IconProps, CardImage, CardImageProps as ImageProps, CardMetadataProps as MetadataProps, CardProps } from "./Card.js";
3
3
 
4
4
  //#region src/Card/index.d.ts
5
- declare const Card: (<As extends "div" | "section">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
5
+ declare const Card: (<As extends "div" | "section">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As>, "as"> & Omit<{
6
6
  className?: string;
7
7
  padding?: "none" | "condensed" | "normal";
8
8
  borderRadius?: "medium" | "large";
@@ -9,7 +9,7 @@ type StyledLinkProps<As extends React.ElementType = 'a'> = {
9
9
  muted?: boolean;
10
10
  inline?: boolean;
11
11
  };
12
- declare const Link: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & StyledLinkProps<"a">, "as"> & {
12
+ declare const Link: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<StyledLinkProps<"a">, "as"> & {
13
13
  as?: As | undefined;
14
14
  } & React.RefAttributes<unknown>) => React.ReactNode) & {
15
15
  displayName: string;
@@ -55,7 +55,7 @@ type NavListGroupHeadingProps = ActionListGroupHeadingProps;
55
55
  declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref"> & React.RefAttributes<HTMLElement>> & {
56
56
  Description: FCWithSlotMarker<React.PropsWithChildren<ActionListDescriptionProps>>;
57
57
  Heading: FCWithSlotMarker<NavListHeadingProps>;
58
- Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
58
+ Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
59
59
  children: React.ReactNode;
60
60
  defaultOpen?: boolean;
61
61
  href?: string;
@@ -8,7 +8,7 @@ type TextProps<As extends React.ElementType = 'span'> = PolymorphicProps<As, 'sp
8
8
  whiteSpace?: 'pre' | 'normal' | 'nowrap' | 'pre-wrap' | 'pre-line';
9
9
  className?: string;
10
10
  }>;
11
- declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As> & {
11
+ declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As>, "as"> & Omit<{
12
12
  size?: "large" | "medium" | "small";
13
13
  weight?: "light" | "normal" | "medium" | "semibold";
14
14
  whiteSpace?: "pre" | "normal" | "nowrap" | "pre-wrap" | "pre-line";
@@ -11,7 +11,7 @@ type TruncateOwnProps = {
11
11
  style?: React.CSSProperties;
12
12
  };
13
13
  type TruncateProps<As extends React.ElementType = 'div'> = PolymorphicProps<As, 'div', TruncateOwnProps>;
14
- declare const _default: <As extends React.ElementType = "div">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & TruncateOwnProps, "as"> & {
14
+ declare const _default: <As extends React.ElementType = "div">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As>, "as"> & Omit<TruncateOwnProps, "as"> & {
15
15
  as?: As | undefined;
16
16
  } & React.RefAttributes<any>) => React.ReactNode;
17
17
  //#endregion
package/dist/index.d.ts CHANGED
@@ -44,10 +44,10 @@ import { ActionListTrailingActionProps } from "./ActionList/TrailingAction.js";
44
44
  import { ActionListGroupHeadingTrailingActionProps } from "./ActionList/GroupHeadingTrailingAction.js";
45
45
  import { ActionListItemProps, ActionListProps } from "./ActionList/shared.js";
46
46
  import { ActionListGroupHeadingProps, ActionListGroupProps } from "./ActionList/Group.js";
47
+ import { ActionListLinkItemProps } from "./ActionList/LinkItem.js";
47
48
  import { ActionListDividerProps } from "./ActionList/Divider.js";
48
49
  import { ActionListDescriptionProps } from "./ActionList/Description.js";
49
50
  import { ActionListLeadingVisualProps, ActionListTrailingVisualProps } from "./ActionList/Visuals.js";
50
- import { ActionListLinkItemProps } from "./ActionList/LinkItem.js";
51
51
  import { ActionList } from "./ActionList/index.js";
52
52
  import { AnchoredOverlay, AnchoredOverlayProps } from "./AnchoredOverlay/AnchoredOverlay.js";
53
53
  import { AutocompleteMenuProps } from "./Autocomplete/AutocompleteMenu.js";
@@ -19,9 +19,9 @@ import { jsx } from "react/jsx-runtime";
19
19
  * the string key is a unique and stable identifier for each component which can be used as a `key` if necessary.
20
20
  *
21
21
  * @note Note that this pattern is not SSR compatible. It won't raise errors or hydration mismatches, but the
22
- * registry will not be available during SSR. The registry is built during the effect phase, so it will be populated
23
- * after hydration on the client. The initial `undefined` value can be used to safely show loading UI during SSR/initial
24
- * render if necessary.
22
+ * registry will not be available during SSR. Registrations are collected and published during the effect phase,
23
+ * so the registry will be populated after hydration on the client. The initial `undefined` value
24
+ * can be used to safely show loading UI during SSR/initial render if necessary.
25
25
  */
26
26
  function createDescendantRegistry() {
27
27
  const Context = /*#__PURE__*/ createContext({
@@ -83,118 +83,136 @@ function createDescendantRegistry() {
83
83
  }
84
84
  const unsetValue = Symbol("unset");
85
85
  function Provider(t0) {
86
- const $ = c(17);
86
+ const $ = c(21);
87
87
  const { children, setRegistry } = t0;
88
88
  const workingRegistryRef = useRef("queued");
89
- const [key, rebuildRegistry] = useReducer(_temp, 0);
90
- const pendingRebuildRef = useRef(false);
91
- const isMountedRef = useRef(true);
92
89
  let t1;
93
90
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
94
- t1 = () => {
95
- if (pendingRebuildRef.current) return;
96
- pendingRebuildRef.current = true;
97
- scheduleMicrotask(() => {
98
- pendingRebuildRef.current = false;
99
- if (isMountedRef.current) rebuildRegistry();
100
- });
101
- };
91
+ t1 = /* @__PURE__ */ new Map();
102
92
  $[0] = t1;
103
93
  } else t1 = $[0];
104
- const scheduleRebuild = t1;
94
+ const registryRef = useRef(t1);
95
+ const [key, rebuildRegistry] = useReducer(_temp, 0);
96
+ const pendingRegistryUpdateRef = useRef(false);
97
+ const isMountedRef = useRef(true);
105
98
  let t2;
106
- let t3;
107
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
99
+ if ($[1] !== setRegistry) {
108
100
  t2 = () => {
101
+ if (pendingRegistryUpdateRef.current) return;
102
+ pendingRegistryUpdateRef.current = true;
103
+ scheduleMicrotask(() => {
104
+ pendingRegistryUpdateRef.current = false;
105
+ if (!isMountedRef.current) return;
106
+ if (workingRegistryRef.current === "queued") rebuildRegistry();
107
+ else if (workingRegistryRef.current === "idle") setRegistry(new Map(registryRef.current));
108
+ });
109
+ };
110
+ $[1] = setRegistry;
111
+ $[2] = t2;
112
+ } else t2 = $[2];
113
+ const scheduleRegistryUpdate = t2;
114
+ let t3;
115
+ let t4;
116
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
117
+ t3 = () => {
109
118
  isMountedRef.current = true;
110
119
  return () => {
111
120
  isMountedRef.current = false;
112
121
  };
113
122
  };
114
- t3 = [];
115
- $[1] = t2;
116
- $[2] = t3;
123
+ t4 = [];
124
+ $[3] = t3;
125
+ $[4] = t4;
117
126
  } else {
118
- t2 = $[1];
119
- t3 = $[2];
127
+ t3 = $[3];
128
+ t4 = $[4];
120
129
  }
121
- useEffect(t2, t3);
122
- let t4;
123
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
124
- t4 = function instantiateNewRegistry() {
130
+ useEffect(t3, t4);
131
+ let t5;
132
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
133
+ t5 = function instantiateNewRegistry() {
125
134
  if (workingRegistryRef.current === "queued") workingRegistryRef.current = /* @__PURE__ */ new Map();
126
135
  };
127
- $[3] = t4;
128
- } else t4 = $[3];
129
- useIsomorphicLayoutEffect(t4);
130
- let t5;
131
- if ($[4] !== setRegistry) {
132
- t5 = (id) => {
136
+ $[5] = t5;
137
+ } else t5 = $[5];
138
+ let t6;
139
+ if ($[6] !== key) {
140
+ t6 = [key];
141
+ $[6] = key;
142
+ $[7] = t6;
143
+ } else t6 = $[7];
144
+ useIsomorphicLayoutEffect(t5, t6);
145
+ let t7;
146
+ if ($[8] !== scheduleRegistryUpdate) {
147
+ t7 = (id) => {
133
148
  if (workingRegistryRef.current instanceof Map) workingRegistryRef.current.set(id, unsetValue);
134
149
  else if (workingRegistryRef.current === "idle") {
135
150
  workingRegistryRef.current = "queued";
136
- scheduleRebuild();
151
+ scheduleRegistryUpdate();
137
152
  }
138
153
  return function unregister() {
139
154
  if (workingRegistryRef.current instanceof Map) workingRegistryRef.current.delete(id);
140
- else if (workingRegistryRef.current === "idle") setRegistry((prev_0) => {
141
- const copy = new Map(prev_0);
142
- copy.delete(id);
143
- return copy;
144
- });
155
+ else if (workingRegistryRef.current === "idle") {
156
+ registryRef.current.delete(id);
157
+ scheduleRegistryUpdate();
158
+ }
145
159
  };
146
160
  };
147
- $[4] = setRegistry;
148
- $[5] = t5;
149
- } else t5 = $[5];
150
- const register = t5;
151
- let t6;
152
- if ($[6] !== setRegistry) {
153
- t6 = (id_0, value) => {
161
+ $[8] = scheduleRegistryUpdate;
162
+ $[9] = t7;
163
+ } else t7 = $[9];
164
+ const register = t7;
165
+ let t8;
166
+ if ($[10] !== scheduleRegistryUpdate) {
167
+ t8 = (id_0, value) => {
154
168
  if (workingRegistryRef.current instanceof Map) workingRegistryRef.current.set(id_0, value);
155
- else if (workingRegistryRef.current === "idle") setRegistry((prev_1) => new Map(prev_1).set(id_0, value));
169
+ else if (workingRegistryRef.current === "idle") {
170
+ registryRef.current.set(id_0, value);
171
+ scheduleRegistryUpdate();
172
+ }
156
173
  };
157
- $[6] = setRegistry;
158
- $[7] = t6;
159
- } else t6 = $[7];
160
- const updateValue = t6;
161
- let t7;
162
- if ($[8] !== setRegistry) {
163
- t7 = function commitWorkingRegistry() {
174
+ $[10] = scheduleRegistryUpdate;
175
+ $[11] = t8;
176
+ } else t8 = $[11];
177
+ const updateValue = t8;
178
+ let t9;
179
+ if ($[12] !== setRegistry) {
180
+ t9 = function commitWorkingRegistry() {
164
181
  if (workingRegistryRef.current instanceof Map) {
165
182
  const setEntries = Array.from(workingRegistryRef.current.entries()).filter(_temp2);
166
- setRegistry(new Map(setEntries));
183
+ registryRef.current = new Map(setEntries);
167
184
  workingRegistryRef.current = "idle";
185
+ setRegistry(new Map(setEntries));
168
186
  }
169
187
  };
170
- $[8] = setRegistry;
171
- $[9] = t7;
172
- } else t7 = $[9];
173
- useEffect(t7);
174
- let t8;
175
- if ($[10] !== key || $[11] !== register || $[12] !== updateValue) {
176
- t8 = {
188
+ $[12] = setRegistry;
189
+ $[13] = t9;
190
+ } else t9 = $[13];
191
+ useEffect(t9);
192
+ let t10;
193
+ if ($[14] !== key || $[15] !== register || $[16] !== updateValue) {
194
+ t10 = {
177
195
  register,
178
196
  updateValue,
179
197
  key
180
198
  };
181
- $[10] = key;
182
- $[11] = register;
183
- $[12] = updateValue;
184
- $[13] = t8;
185
- } else t8 = $[13];
186
- const contextValue = t8;
187
- let t9;
188
- if ($[14] !== children || $[15] !== contextValue) {
189
- t9 = /* @__PURE__ */ jsx(Context.Provider, {
199
+ $[14] = key;
200
+ $[15] = register;
201
+ $[16] = updateValue;
202
+ $[17] = t10;
203
+ } else t10 = $[17];
204
+ const contextValue = t10;
205
+ let t11;
206
+ if ($[18] !== children || $[19] !== contextValue) {
207
+ t11 = /* @__PURE__ */ jsx(Context.Provider, {
190
208
  value: contextValue,
191
209
  children
192
210
  });
193
- $[14] = children;
194
- $[15] = contextValue;
195
- $[16] = t9;
196
- } else t9 = $[16];
197
- return t9;
211
+ $[18] = children;
212
+ $[19] = contextValue;
213
+ $[20] = t11;
214
+ } else t11 = $[20];
215
+ return t11;
198
216
  }
199
217
  function _temp2(entry) {
200
218
  return entry[1] !== unsetValue;
@@ -8,8 +8,9 @@ type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omi
8
8
  /**
9
9
  * Simplified polymorphic props type that handles the common pattern of
10
10
  * `DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? DefaultElement : As>, 'as'>`
11
+ * Keep own props separate so their types remain available in generic components.
11
12
  */
12
- type PolymorphicProps<TAs extends ElementType, TDefaultElement extends ElementType = 'div', Props = object> = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs> & Props, 'as'> & {
13
+ type PolymorphicProps<TAs extends ElementType, TDefaultElement extends ElementType = 'div', Props = object> = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs>, 'as'> & DistributiveOmit<Props, 'as'> & {
13
14
  as?: TAs;
14
15
  };
15
16
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.44.0",
4
+ "version": "38.44.1-rc.16baf912a",
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",
@@ -156,7 +156,7 @@
156
156
  "mdast-util-to-string": "4.0.0",
157
157
  "micromark-extension-frontmatter": "2.0.0",
158
158
  "micromark-extension-mdxjs": "3.0.0",
159
- "oxc-transform-react": "^0.154.0",
159
+ "oxc-transform-react": "^0.155.0",
160
160
  "postcss-preset-primer": "^0.0.0",
161
161
  "publint": "^0.3.15",
162
162
  "react": "18.3.1",