@primer/react 38.46.0 → 38.47.0-rc.6f1dd6463

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.47.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8563](https://github.com/primer/react/pull/8563) [`998b471`](https://github.com/primer/react/commit/998b471a4ad78c7c23426038ef0c4a5261fc41cf) Thanks [@joshblack](https://github.com/joshblack)! - ActionMenu: Improve rendering performance with React Compiler support.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#8708](https://github.com/primer/react/pull/8708) [`16c41d3`](https://github.com/primer/react/commit/16c41d3e57bb7358d887c613aaeb22aaea3a0d97) Thanks [@vivanvv](https://github.com/vivanvv)! - Pagination: Disable Next for empty results when page numbers are hidden.
12
+
3
13
  ## 38.46.0
4
14
 
5
15
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ import { c } from "../utils/react-compiler-runtime.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
4
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
@@ -12,7 +13,7 @@ import { ActionListContainerContext } from "../ActionList/ActionListContainerCon
12
13
  import { Divider } from "../ActionList/Divider.js";
13
14
  import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
14
15
  import ActionMenu_module_css_default from "./ActionMenu.module.css.js";
15
- import React, { useCallback, useContext, useMemo, useState } from "react";
16
+ import React, { useContext, useState } from "react";
16
17
  import { jsx } from "react/jsx-runtime";
17
18
  import { clsx } from "clsx";
18
19
  import { ChevronRightIcon, TriangleDownIcon } from "@primer/octicons-react";
@@ -44,206 +45,441 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
44
45
  if (buttonProps.className) mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
45
46
  return mergedAnchorProps;
46
47
  };
47
- const Menu = ({ anchorRef: externalAnchorRef, open, onOpenChange, children }) => {
48
+ const Menu = (t0) => {
49
+ const $ = c(25);
50
+ const { anchorRef: externalAnchorRef, open, onOpenChange, children } = t0;
48
51
  const parentMenuContext = useContext(MenuContext);
49
52
  const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate(open, onOpenChange, false);
50
- const onOpen = React.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
51
- const isNarrow = useResponsiveValue({ narrow: true }, false);
52
- const onClose = React.useCallback((gesture) => {
53
- var _parentMenuContext$on;
54
- if (isNarrow && open && gesture === "tab") return;
55
- setCombinedOpenState(false);
56
- switch (gesture) {
57
- case "tab":
58
- case "item-select": (_parentMenuContext$on = parentMenuContext.onClose) === null || _parentMenuContext$on === void 0 || _parentMenuContext$on.call(parentMenuContext, gesture);
59
- }
60
- }, [
61
- setCombinedOpenState,
62
- parentMenuContext,
63
- open,
64
- isNarrow
65
- ]);
66
- const menuButtonChild = React.Children.toArray(children).find((child) => /*#__PURE__*/ React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton)));
67
- const menuButtonChildId = /*#__PURE__*/ React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : void 0;
53
+ let t1;
54
+ if ($[0] !== setCombinedOpenState) {
55
+ t1 = () => setCombinedOpenState(true);
56
+ $[0] = setCombinedOpenState;
57
+ $[1] = t1;
58
+ } else t1 = $[1];
59
+ const onOpen = t1;
60
+ let t2;
61
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
62
+ t2 = { narrow: true };
63
+ $[2] = t2;
64
+ } else t2 = $[2];
65
+ const isNarrow = useResponsiveValue(t2, false);
66
+ let t3;
67
+ if ($[3] !== isNarrow || $[4] !== open || $[5] !== parentMenuContext || $[6] !== setCombinedOpenState) {
68
+ t3 = (gesture) => {
69
+ if (isNarrow && open && gesture === "tab") return;
70
+ setCombinedOpenState(false);
71
+ switch (gesture) {
72
+ case "tab":
73
+ case "item-select":
74
+ var _parentMenuContext$on;
75
+ (_parentMenuContext$on = parentMenuContext.onClose) === null || _parentMenuContext$on === void 0 || _parentMenuContext$on.call(parentMenuContext, gesture);
76
+ }
77
+ };
78
+ $[3] = isNarrow;
79
+ $[4] = open;
80
+ $[5] = parentMenuContext;
81
+ $[6] = setCombinedOpenState;
82
+ $[7] = t3;
83
+ } else t3 = $[7];
84
+ const onClose = t3;
85
+ let t4;
86
+ if ($[8] !== children) {
87
+ const menuButtonChild = React.Children.toArray(children).find(_temp);
88
+ t4 = /*#__PURE__*/ React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : void 0;
89
+ $[8] = children;
90
+ $[9] = t4;
91
+ } else t4 = $[9];
92
+ const menuButtonChildId = t4;
68
93
  const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
69
94
  const anchorId = useId$1(menuButtonChildId);
70
- let renderAnchor = null;
71
- const contents = React.Children.map(children, (child) => {
72
- if (child.type === Tooltip || isSlot(child, Tooltip)) {
73
- const anchorChildren = child.props.children;
74
- if (anchorChildren.type === MenuButton || isSlot(anchorChildren, MenuButton)) renderAnchor = (anchorProps) => {
75
- const triggerButton = /*#__PURE__*/ React.cloneElement(anchorChildren, mergeAnchorHandlers({ ...anchorProps }, anchorChildren.props));
76
- return /*#__PURE__*/ React.cloneElement(child, {
77
- children: triggerButton,
78
- ref: anchorRef
79
- });
80
- };
81
- return null;
82
- } else if (child.type === Anchor || isSlot(child, Anchor)) {
83
- const anchorChildren = child.props.children;
84
- if (anchorChildren !== void 0 ? anchorChildren.type === Tooltip || isSlot(anchorChildren, Tooltip) : false) {
85
- if (anchorChildren.props.children !== null) renderAnchor = (anchorProps) => {
86
- const tooltipTrigger = anchorChildren.props.children;
87
- const tooltipTriggerEl = /*#__PURE__*/ React.cloneElement(tooltipTrigger, mergeAnchorHandlers({ ...anchorProps }, tooltipTrigger.props));
88
- const tooltip = /*#__PURE__*/ React.cloneElement(anchorChildren, { children: tooltipTriggerEl });
89
- return /*#__PURE__*/ React.cloneElement(child, {
90
- children: tooltip,
95
+ let anchor;
96
+ let t5;
97
+ if ($[10] !== anchorRef || $[11] !== children) {
98
+ anchor = { renderAnchor: null };
99
+ t5 = React.Children.map(children, (child_0) => {
100
+ if (child_0.type === Tooltip || isSlot(child_0, Tooltip)) {
101
+ const anchorChildren = child_0.props.children;
102
+ if (anchorChildren.type === MenuButton || isSlot(anchorChildren, MenuButton)) anchor.renderAnchor = (anchorProps) => {
103
+ const triggerButton = /*#__PURE__*/ React.cloneElement(anchorChildren, mergeAnchorHandlers({ ...anchorProps }, anchorChildren.props));
104
+ return /*#__PURE__*/ React.cloneElement(child_0, {
105
+ children: triggerButton,
91
106
  ref: anchorRef
92
107
  });
93
108
  };
94
- } else renderAnchor = (anchorProps) => /*#__PURE__*/ React.cloneElement(child, {
95
- ...anchorProps,
96
- className: clsx(anchorProps.className, child.props.className)
97
- });
98
- return null;
99
- } else if (child.type === MenuButton || isSlot(child, MenuButton)) {
100
- renderAnchor = (anchorProps) => /*#__PURE__*/ React.cloneElement(child, mergeAnchorHandlers(anchorProps, child.props));
101
- return null;
102
- } else return child;
103
- });
109
+ return null;
110
+ } else if (child_0.type === Anchor || isSlot(child_0, Anchor)) {
111
+ const anchorChildren_0 = child_0.props.children;
112
+ if (anchorChildren_0 !== void 0 ? anchorChildren_0.type === Tooltip || isSlot(anchorChildren_0, Tooltip) : false) {
113
+ if (anchorChildren_0.props.children !== null) anchor.renderAnchor = (anchorProps_0) => {
114
+ const tooltipTrigger = anchorChildren_0.props.children;
115
+ const tooltipTriggerEl = /*#__PURE__*/ React.cloneElement(tooltipTrigger, mergeAnchorHandlers({ ...anchorProps_0 }, tooltipTrigger.props));
116
+ const tooltip = /*#__PURE__*/ React.cloneElement(anchorChildren_0, { children: tooltipTriggerEl });
117
+ return /*#__PURE__*/ React.cloneElement(child_0, {
118
+ children: tooltip,
119
+ ref: anchorRef
120
+ });
121
+ };
122
+ } else anchor.renderAnchor = (anchorProps_1) => /*#__PURE__*/ React.cloneElement(child_0, {
123
+ ...anchorProps_1,
124
+ className: clsx(anchorProps_1.className, child_0.props.className)
125
+ });
126
+ return null;
127
+ } else if (child_0.type === MenuButton || isSlot(child_0, MenuButton)) {
128
+ anchor.renderAnchor = (anchorProps_2) => /*#__PURE__*/ React.cloneElement(child_0, mergeAnchorHandlers(anchorProps_2, child_0.props));
129
+ return null;
130
+ } else return child_0;
131
+ });
132
+ $[10] = anchorRef;
133
+ $[11] = children;
134
+ $[12] = anchor;
135
+ $[13] = t5;
136
+ } else {
137
+ anchor = $[12];
138
+ t5 = $[13];
139
+ }
140
+ const contents = t5;
104
141
  const isSubmenu = parentMenuContext.isSubmenu !== void 0;
105
- const menuContextValue = useMemo(() => ({
106
- anchorRef,
107
- renderAnchor,
108
- anchorId,
109
- open: combinedOpenState,
110
- onOpen,
111
- onClose,
112
- isSubmenu
113
- }), [
114
- anchorRef,
115
- renderAnchor,
116
- anchorId,
117
- combinedOpenState,
118
- onOpen,
119
- onClose,
120
- isSubmenu
121
- ]);
122
- return /* @__PURE__ */ jsx(MenuContext.Provider, {
123
- value: menuContextValue,
124
- children: contents
125
- });
142
+ let t6;
143
+ if ($[14] !== anchor.renderAnchor || $[15] !== anchorId || $[16] !== anchorRef || $[17] !== combinedOpenState || $[18] !== isSubmenu || $[19] !== onClose || $[20] !== onOpen) {
144
+ t6 = {
145
+ anchorRef,
146
+ renderAnchor: anchor.renderAnchor,
147
+ anchorId,
148
+ open: combinedOpenState,
149
+ onOpen,
150
+ onClose,
151
+ isSubmenu
152
+ };
153
+ $[14] = anchor.renderAnchor;
154
+ $[15] = anchorId;
155
+ $[16] = anchorRef;
156
+ $[17] = combinedOpenState;
157
+ $[18] = isSubmenu;
158
+ $[19] = onClose;
159
+ $[20] = onOpen;
160
+ $[21] = t6;
161
+ } else t6 = $[21];
162
+ const menuContextValue = t6;
163
+ let t7;
164
+ if ($[22] !== contents || $[23] !== menuContextValue) {
165
+ t7 = /* @__PURE__ */ jsx(MenuContext.Provider, {
166
+ value: menuContextValue,
167
+ children: contents
168
+ });
169
+ $[22] = contents;
170
+ $[23] = menuContextValue;
171
+ $[24] = t7;
172
+ } else t7 = $[24];
173
+ return t7;
126
174
  };
127
- const Anchor = /*#__PURE__*/ React.forwardRef(({ children: child, ...anchorProps }, anchorRef) => {
175
+ const Anchor = /*#__PURE__*/ React.forwardRef((t0, anchorRef) => {
176
+ const $ = c(17);
177
+ const { children: child, ...anchorProps } = t0;
128
178
  const { onOpen, isSubmenu } = React.useContext(MenuContext);
129
- const openSubmenuOnRightArrow = useCallback((event) => {
130
- if (isSubmenu && event.key === "ArrowRight" && !event.defaultPrevented) onOpen === null || onOpen === void 0 || onOpen("anchor-key-press");
131
- }, [isSubmenu, onOpen]);
132
- const onButtonClick = (event) => {
179
+ let t1;
180
+ if ($[0] !== isSubmenu || $[1] !== onOpen) {
181
+ t1 = (event) => {
182
+ if (isSubmenu && event.key === "ArrowRight" && !event.defaultPrevented) onOpen === null || onOpen === void 0 || onOpen("anchor-key-press");
183
+ };
184
+ $[0] = isSubmenu;
185
+ $[1] = onOpen;
186
+ $[2] = t1;
187
+ } else t1 = $[2];
188
+ const openSubmenuOnRightArrow = t1;
189
+ const onButtonClick = (event_0) => {
133
190
  var _child$props$onClick, _child$props, _anchorProps$onClick;
134
- (_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 || _child$props$onClick.call(_child$props, event);
135
- (_anchorProps$onClick = anchorProps.onClick) === null || _anchorProps$onClick === void 0 || _anchorProps$onClick.call(anchorProps, event);
191
+ (_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 || _child$props$onClick.call(_child$props, event_0);
192
+ (_anchorProps$onClick = anchorProps.onClick) === null || _anchorProps$onClick === void 0 || _anchorProps$onClick.call(anchorProps, event_0);
136
193
  };
137
- const onButtonKeyDown = (event) => {
194
+ const onButtonKeyDown = (event_1) => {
138
195
  var _child$props$onKeyDow, _child$props2, _anchorProps$onKeyDow;
139
- (_child$props$onKeyDow = (_child$props2 = child.props).onKeyDown) === null || _child$props$onKeyDow === void 0 || _child$props$onKeyDow.call(_child$props2, event);
140
- openSubmenuOnRightArrow(event);
141
- (_anchorProps$onKeyDow = anchorProps.onKeyDown) === null || _anchorProps$onKeyDow === void 0 || _anchorProps$onKeyDow.call(anchorProps, event);
196
+ (_child$props$onKeyDow = (_child$props2 = child.props).onKeyDown) === null || _child$props$onKeyDow === void 0 || _child$props$onKeyDow.call(_child$props2, event_1);
197
+ openSubmenuOnRightArrow(event_1);
198
+ (_anchorProps$onKeyDow = anchorProps.onKeyDown) === null || _anchorProps$onKeyDow === void 0 || _anchorProps$onKeyDow.call(anchorProps, event_1);
142
199
  };
143
200
  const parentActionListContext = useContext(ActionListContainerContext);
144
- const thisActionListContext = useMemo(() => isSubmenu ? {
145
- ...parentActionListContext,
146
- defaultTrailingVisual: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
147
- afterSelect: () => onOpen === null || onOpen === void 0 ? void 0 : onOpen("anchor-click")
148
- } : parentActionListContext, [
149
- isSubmenu,
150
- onOpen,
151
- parentActionListContext
152
- ]);
153
- return /* @__PURE__ */ jsx(ActionListContainerContext.Provider, {
154
- value: thisActionListContext,
155
- children: /*#__PURE__*/ React.cloneElement(child, {
201
+ let t2;
202
+ if ($[3] !== isSubmenu || $[4] !== onOpen || $[5] !== parentActionListContext) {
203
+ t2 = isSubmenu ? {
204
+ ...parentActionListContext,
205
+ defaultTrailingVisual: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
206
+ afterSelect: () => onOpen === null || onOpen === void 0 ? void 0 : onOpen("anchor-click")
207
+ } : parentActionListContext;
208
+ $[3] = isSubmenu;
209
+ $[4] = onOpen;
210
+ $[5] = parentActionListContext;
211
+ $[6] = t2;
212
+ } else t2 = $[6];
213
+ const thisActionListContext = t2;
214
+ const t3 = ActionListContainerContext;
215
+ const t4 = clsx(anchorProps.className, child.props.className);
216
+ let t5;
217
+ if ($[7] !== anchorProps || $[8] !== anchorRef || $[9] !== onButtonClick || $[10] !== onButtonKeyDown || $[11] !== t4) {
218
+ t5 = {
156
219
  ...anchorProps,
157
220
  ref: anchorRef,
158
- className: clsx(anchorProps.className, child.props.className),
221
+ className: t4,
159
222
  onClick: onButtonClick,
160
223
  onKeyDown: onButtonKeyDown
161
- })
162
- });
224
+ };
225
+ $[7] = anchorProps;
226
+ $[8] = anchorRef;
227
+ $[9] = onButtonClick;
228
+ $[10] = onButtonKeyDown;
229
+ $[11] = t4;
230
+ $[12] = t5;
231
+ } else t5 = $[12];
232
+ const t6 = /*#__PURE__*/ React.cloneElement(child, t5);
233
+ let t7;
234
+ if ($[13] !== t3.Provider || $[14] !== t6 || $[15] !== thisActionListContext) {
235
+ t7 = /* @__PURE__ */ jsx(t3.Provider, {
236
+ value: thisActionListContext,
237
+ children: t6
238
+ });
239
+ $[13] = t3.Provider;
240
+ $[14] = t6;
241
+ $[15] = thisActionListContext;
242
+ $[16] = t7;
243
+ } else t7 = $[16];
244
+ return t7;
163
245
  });
164
- const MenuButton = /*#__PURE__*/ React.forwardRef(({ ...props }, anchorRef) => {
165
- return /* @__PURE__ */ jsx(Anchor, {
166
- ref: anchorRef,
167
- children: /* @__PURE__ */ jsx(ButtonComponent, {
246
+ const MenuButton = /*#__PURE__*/ React.forwardRef((t0, anchorRef) => {
247
+ const $ = c(7);
248
+ let props;
249
+ if ($[0] !== t0) {
250
+ ({...props} = t0);
251
+ $[0] = t0;
252
+ $[1] = props;
253
+ } else props = $[1];
254
+ let t1;
255
+ if ($[2] !== props) {
256
+ t1 = /* @__PURE__ */ jsx(ButtonComponent, {
168
257
  "data-component": "ActionMenu.Button",
169
258
  type: "button",
170
259
  trailingAction: TriangleDownIcon,
171
260
  ...props
172
- })
173
- });
261
+ });
262
+ $[2] = props;
263
+ $[3] = t1;
264
+ } else t1 = $[3];
265
+ let t2;
266
+ if ($[4] !== anchorRef || $[5] !== t1) {
267
+ t2 = /* @__PURE__ */ jsx(Anchor, {
268
+ ref: anchorRef,
269
+ children: t1
270
+ });
271
+ $[4] = anchorRef;
272
+ $[5] = t1;
273
+ $[6] = t2;
274
+ } else t2 = $[6];
275
+ return t2;
174
276
  });
175
277
  const defaultVariant = {
176
278
  regular: "anchored",
177
279
  narrow: "anchored"
178
280
  };
179
- const Overlay = ({ children, align = "start", side, onPositionChange, displayInViewport, "aria-labelledby": ariaLabelledby, variant = defaultVariant, ...overlayProps }) => {
180
- const { anchorRef, renderAnchor, anchorId, open, onOpen, onClose, isSubmenu = false } = React.useContext(MenuContext);
281
+ const Overlay = (t0) => {
282
+ const $ = c(55);
283
+ let ariaLabelledby;
284
+ let children;
285
+ let displayInViewport;
286
+ let onPositionChange;
287
+ let overlayProps;
288
+ let side;
289
+ let t1;
290
+ let t2;
291
+ if ($[0] !== t0) {
292
+ ({children, align: t1, side, onPositionChange, displayInViewport, "aria-labelledby": ariaLabelledby, variant: t2, ...overlayProps} = t0);
293
+ $[0] = t0;
294
+ $[1] = ariaLabelledby;
295
+ $[2] = children;
296
+ $[3] = displayInViewport;
297
+ $[4] = onPositionChange;
298
+ $[5] = overlayProps;
299
+ $[6] = side;
300
+ $[7] = t1;
301
+ $[8] = t2;
302
+ } else {
303
+ ariaLabelledby = $[1];
304
+ children = $[2];
305
+ displayInViewport = $[3];
306
+ onPositionChange = $[4];
307
+ overlayProps = $[5];
308
+ side = $[6];
309
+ t1 = $[7];
310
+ t2 = $[8];
311
+ }
312
+ const align = t1 === void 0 ? "start" : t1;
313
+ const variant = t2 === void 0 ? defaultVariant : t2;
314
+ const { anchorRef, renderAnchor, anchorId, open, onOpen, onClose, isSubmenu: t3 } = React.useContext(MenuContext);
315
+ const isSubmenu = t3 === void 0 ? false : t3;
181
316
  const containerRef = React.useRef(null);
182
- const isNarrowFullscreen = !!useResponsiveValue({ narrow: true }, false) && variant.narrow === "fullscreen";
183
- const handleClose = React.useCallback((gesture) => {
184
- if (isNarrowFullscreen && gesture === "tab") return;
185
- onClose === null || onClose === void 0 || onClose(gesture);
186
- }, [isNarrowFullscreen, onClose]);
317
+ let t4;
318
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
319
+ t4 = { narrow: true };
320
+ $[9] = t4;
321
+ } else t4 = $[9];
322
+ const isNarrowFullscreen = !!useResponsiveValue(t4, false) && variant.narrow === "fullscreen";
323
+ let t5;
324
+ if ($[10] !== isNarrowFullscreen || $[11] !== onClose) {
325
+ t5 = (gesture) => {
326
+ if (isNarrowFullscreen && gesture === "tab") return;
327
+ onClose === null || onClose === void 0 || onClose(gesture);
328
+ };
329
+ $[10] = isNarrowFullscreen;
330
+ $[11] = onClose;
331
+ $[12] = t5;
332
+ } else t5 = $[12];
333
+ const handleClose = t5;
187
334
  const [anchorLabelReady, setAnchorLabelReady] = useState(false);
188
335
  if (!open && anchorLabelReady) setAnchorLabelReady(false);
189
336
  useMenuKeyboardNavigation(open && anchorLabelReady, handleClose, containerRef, anchorRef, isSubmenu);
190
- const responsiveVariant = useResponsiveValue(variant, {
191
- regular: "anchored",
192
- narrow: "anchored"
193
- });
337
+ let t6;
338
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
339
+ t6 = {
340
+ regular: "anchored",
341
+ narrow: "anchored"
342
+ };
343
+ $[13] = t6;
344
+ } else t6 = $[13];
345
+ const responsiveVariant = useResponsiveValue(variant, t6);
194
346
  const [anchorAriaLabelledby, setAnchorAriaLabelledby] = useState(null);
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);
200
- }
201
- }, [anchorRef, open]);
202
- const afterSelect = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("item-select"), [onClose]);
203
- const overlayContextValue = useMemo(() => ({
204
- container: "ActionMenu",
205
- listRole: "menu",
206
- listLabelledBy: ariaLabelledby || anchorAriaLabelledby || anchorId,
207
- selectionAttribute: "aria-checked",
208
- afterSelect,
209
- enableFocusZone: isNarrowFullscreen
210
- }), [
211
- ariaLabelledby,
212
- anchorAriaLabelledby,
213
- anchorId,
214
- afterSelect,
215
- isNarrowFullscreen
216
- ]);
347
+ let t7;
348
+ let t8;
349
+ if ($[14] !== anchorRef || $[15] !== open) {
350
+ t7 = () => {
351
+ if (open) {
352
+ var _anchorRef$current$ge, _anchorRef$current;
353
+ 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);
354
+ setAnchorLabelReady(true);
355
+ }
356
+ };
357
+ t8 = [anchorRef, open];
358
+ $[14] = anchorRef;
359
+ $[15] = open;
360
+ $[16] = t7;
361
+ $[17] = t8;
362
+ } else {
363
+ t7 = $[16];
364
+ t8 = $[17];
365
+ }
366
+ useIsomorphicLayoutEffect(t7, t8);
367
+ let t9;
368
+ if ($[18] !== onClose) {
369
+ t9 = () => onClose === null || onClose === void 0 ? void 0 : onClose("item-select");
370
+ $[18] = onClose;
371
+ $[19] = t9;
372
+ } else t9 = $[19];
373
+ const afterSelect = t9;
374
+ const t10 = ariaLabelledby || anchorAriaLabelledby || anchorId;
375
+ let t11;
376
+ if ($[20] !== afterSelect || $[21] !== isNarrowFullscreen || $[22] !== t10) {
377
+ t11 = {
378
+ container: "ActionMenu",
379
+ listRole: "menu",
380
+ listLabelledBy: t10,
381
+ selectionAttribute: "aria-checked",
382
+ afterSelect,
383
+ enableFocusZone: isNarrowFullscreen
384
+ };
385
+ $[20] = afterSelect;
386
+ $[21] = isNarrowFullscreen;
387
+ $[22] = t10;
388
+ $[23] = t11;
389
+ } else t11 = $[23];
390
+ const overlayContextValue = t11;
217
391
  const isInsideDialog = useContext(DialogContext) !== void 0;
218
- return /* @__PURE__ */ jsx(AnchoredOverlay, {
219
- anchorRef,
220
- renderAnchor,
221
- anchorId,
222
- open: open && anchorLabelReady,
223
- onOpen,
224
- onClose: handleClose,
225
- align,
226
- side: side !== null && side !== void 0 ? side : isSubmenu ? "outside-right" : "outside-bottom",
227
- overlayProps: {
392
+ const t12 = open && anchorLabelReady;
393
+ const t13 = side !== null && side !== void 0 ? side : isSubmenu ? "outside-right" : "outside-bottom";
394
+ let t14;
395
+ if ($[24] !== overlayProps) {
396
+ t14 = {
228
397
  ...overlayProps,
229
398
  "data-component": "ActionMenu.Overlay"
230
- },
231
- focusZoneSettings: isNarrowFullscreen ? { disabled: true } : { focusOutBehavior: "wrap" },
232
- onPositionChange,
233
- variant,
234
- displayInViewport: displayInViewport !== void 0 ? displayInViewport : isInsideDialog,
235
- children: /* @__PURE__ */ jsx("div", {
399
+ };
400
+ $[24] = overlayProps;
401
+ $[25] = t14;
402
+ } else t14 = $[25];
403
+ let t15;
404
+ if ($[26] !== isNarrowFullscreen) {
405
+ t15 = isNarrowFullscreen ? { disabled: true } : { focusOutBehavior: "wrap" };
406
+ $[26] = isNarrowFullscreen;
407
+ $[27] = t15;
408
+ } else t15 = $[27];
409
+ const t16 = displayInViewport !== void 0 ? displayInViewport : isInsideDialog;
410
+ let t17;
411
+ if ($[28] !== overlayProps.overflow) {
412
+ t17 = overlayProps.overflow ? { [`data-overflow-${overlayProps.overflow}`]: "" } : {};
413
+ $[28] = overlayProps.overflow;
414
+ $[29] = t17;
415
+ } else t17 = $[29];
416
+ let t18;
417
+ if ($[30] !== overlayProps.maxHeight) {
418
+ t18 = overlayProps.maxHeight ? { [`data-max-height-${overlayProps.maxHeight}`]: "" } : {};
419
+ $[30] = overlayProps.maxHeight;
420
+ $[31] = t18;
421
+ } else t18 = $[31];
422
+ let t19;
423
+ if ($[32] !== children || $[33] !== overlayContextValue) {
424
+ t19 = /* @__PURE__ */ jsx(ActionListContainerContext.Provider, {
425
+ value: overlayContextValue,
426
+ children
427
+ });
428
+ $[32] = children;
429
+ $[33] = overlayContextValue;
430
+ $[34] = t19;
431
+ } else t19 = $[34];
432
+ let t20;
433
+ if ($[35] !== responsiveVariant || $[36] !== t17 || $[37] !== t18 || $[38] !== t19) {
434
+ t20 = /* @__PURE__ */ jsx("div", {
236
435
  ref: containerRef,
237
436
  className: ActionMenu_module_css_default.ActionMenuContainer,
238
437
  "data-variant": responsiveVariant,
239
- ...overlayProps.overflow ? { [`data-overflow-${overlayProps.overflow}`]: "" } : {},
240
- ...overlayProps.maxHeight ? { [`data-max-height-${overlayProps.maxHeight}`]: "" } : {},
241
- children: /* @__PURE__ */ jsx(ActionListContainerContext.Provider, {
242
- value: overlayContextValue,
243
- children
244
- })
245
- })
246
- });
438
+ ...t17,
439
+ ...t18,
440
+ children: t19
441
+ });
442
+ $[35] = responsiveVariant;
443
+ $[36] = t17;
444
+ $[37] = t18;
445
+ $[38] = t19;
446
+ $[39] = t20;
447
+ } else t20 = $[39];
448
+ let t21;
449
+ if ($[40] !== align || $[41] !== anchorId || $[42] !== anchorRef || $[43] !== handleClose || $[44] !== onOpen || $[45] !== onPositionChange || $[46] !== renderAnchor || $[47] !== t12 || $[48] !== t13 || $[49] !== t14 || $[50] !== t15 || $[51] !== t16 || $[52] !== t20 || $[53] !== variant) {
450
+ t21 = /* @__PURE__ */ jsx(AnchoredOverlay, {
451
+ anchorRef,
452
+ renderAnchor,
453
+ anchorId,
454
+ open: t12,
455
+ onOpen,
456
+ onClose: handleClose,
457
+ align,
458
+ side: t13,
459
+ overlayProps: t14,
460
+ focusZoneSettings: t15,
461
+ onPositionChange,
462
+ variant,
463
+ displayInViewport: t16,
464
+ children: t20
465
+ });
466
+ $[40] = align;
467
+ $[41] = anchorId;
468
+ $[42] = anchorRef;
469
+ $[43] = handleClose;
470
+ $[44] = onOpen;
471
+ $[45] = onPositionChange;
472
+ $[46] = renderAnchor;
473
+ $[47] = t12;
474
+ $[48] = t13;
475
+ $[49] = t14;
476
+ $[50] = t15;
477
+ $[51] = t16;
478
+ $[52] = t20;
479
+ $[53] = variant;
480
+ $[54] = t21;
481
+ } else t21 = $[54];
482
+ return t21;
247
483
  };
248
484
  Menu.displayName = "ActionMenu";
249
485
  MenuButton.__SLOT__ = Symbol("ActionMenu.Button");
@@ -255,5 +491,8 @@ const ActionMenu = Object.assign(Menu, {
255
491
  Overlay,
256
492
  Divider
257
493
  });
494
+ function _temp(child) {
495
+ return /*#__PURE__*/ React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton));
496
+ }
258
497
  //#endregion
259
498
  export { ActionMenu };
@@ -10,11 +10,11 @@ function buildPaginationModel(pageCount, currentPage, showPages, marginPageCount
10
10
  num: currentPage + 1,
11
11
  disabled: currentPage === pageCount
12
12
  };
13
- if (!showPages) return [prev, next];
14
13
  if (pageCount <= 0) return [prev, {
15
14
  ...next,
16
15
  disabled: true
17
16
  }];
17
+ if (!showPages) return [prev, next];
18
18
  const pages = [];
19
19
  const standardGap = surroundingPageCount + marginPageCount;
20
20
  if (pageCount <= standardGap + standardGap + 3) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.46.0",
4
+ "version": "38.47.0-rc.6f1dd6463",
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",