@primer/react 38.46.1-rc.41e2a6837 → 38.47.0-rc.200a948c2

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,12 @@
1
1
  # @primer/react
2
2
 
3
- ## 38.46.1
3
+ ## 38.47.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8688](https://github.com/primer/react/pull/8688) [`92a1fca`](https://github.com/primer/react/commit/92a1fca80cd63c2b729141a38a4a93ec27c47a43) Thanks [@rickyzhangca](https://github.com/rickyzhangca)! - DataTable: Describe group selection checkboxes with the member count. Add count-label formatters for localizing checkbox and disclosure descriptions in DataTable and Table.Group.
8
+
9
+ - [#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.
4
10
 
5
11
  ### Patch Changes
6
12
 
@@ -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 };
@@ -90,6 +90,7 @@ type DataTableBaseProps<Data extends UniqueRow> = {
90
90
  * Whether groups have disclosure controls. Groups are expanded by default.
91
91
  */
92
92
  collapsibleGroups?: boolean;
93
+ getGroupRowCountLabel?: (rowCount: number) => string;
93
94
  /**
94
95
  * Controls the expanded group IDs.
95
96
  */
@@ -12,8 +12,8 @@ function defaultGetRowId(row) {
12
12
  return row.id;
13
13
  }
14
14
  function DataTableImplementation(t0) {
15
- const $ = c(72);
16
- const { "aria-labelledby": labelledby, "aria-describedby": describedby, cellPadding, columns, data, initialSortColumn, initialSortDirection, externalSorting, getRowId: t1, onToggleSort, rowSelection: t2, selectedRows, defaultSelectedRows, onSelectionChange, isRowSelectable, collapsibleGroups: t3, expandedGroups, defaultExpandedGroups, onExpandedGroupsChange, renderBulkActions, bulkActionsProps, bulkActionsReturnFocusRef } = t0;
15
+ const $ = c(74);
16
+ const { "aria-labelledby": labelledby, "aria-describedby": describedby, cellPadding, columns, data, initialSortColumn, initialSortDirection, externalSorting, getRowId: t1, onToggleSort, rowSelection: t2, selectedRows, defaultSelectedRows, onSelectionChange, isRowSelectable, collapsibleGroups: t3, getGroupRowCountLabel, expandedGroups, defaultExpandedGroups, onExpandedGroupsChange, renderBulkActions, bulkActionsProps, bulkActionsReturnFocusRef } = t0;
17
17
  const getRowId = t1 === void 0 ? defaultGetRowId : t1;
18
18
  const rowSelection = t2 === void 0 ? false : t2;
19
19
  const collapsibleGroups = t3 === void 0 ? false : t3;
@@ -215,13 +215,14 @@ function DataTableImplementation(t0) {
215
215
  $[50] = t12;
216
216
  } else t12 = $[50];
217
217
  let t13;
218
- if ($[51] !== actions || $[52] !== bodies || $[53] !== collapsibleGroups || $[54] !== headers.length || $[55] !== renderRow || $[56] !== rowSelection) {
218
+ if ($[51] !== actions || $[52] !== bodies || $[53] !== collapsibleGroups || $[54] !== getGroupRowCountLabel || $[55] !== headers.length || $[56] !== renderRow || $[57] !== rowSelection) {
219
219
  let t14;
220
- if ($[58] !== actions || $[59] !== collapsibleGroups || $[60] !== headers.length || $[61] !== renderRow || $[62] !== rowSelection) {
220
+ if ($[59] !== actions || $[60] !== collapsibleGroups || $[61] !== getGroupRowCountLabel || $[62] !== headers.length || $[63] !== renderRow || $[64] !== rowSelection) {
221
221
  t14 = (body) => body.type === "row-group" ? /* @__PURE__ */ jsx(TableGroup, {
222
222
  id: body.id,
223
223
  label: body.label,
224
224
  rowCount: body.rows.length,
225
+ getRowCountLabel: getGroupRowCountLabel,
225
226
  colSpan: headers.length + (rowSelection ? 1 : 0),
226
227
  "aria-label": body["aria-label"],
227
228
  collapsible: collapsibleGroups,
@@ -236,24 +237,26 @@ function DataTableImplementation(t0) {
236
237
  },
237
238
  children: body.rows.map(renderRow)
238
239
  }, body.key) : /* @__PURE__ */ jsx(TableBody, { children: body.rows.map(renderRow) }, body.key);
239
- $[58] = actions;
240
- $[59] = collapsibleGroups;
241
- $[60] = headers.length;
242
- $[61] = renderRow;
243
- $[62] = rowSelection;
244
- $[63] = t14;
245
- } else t14 = $[63];
240
+ $[59] = actions;
241
+ $[60] = collapsibleGroups;
242
+ $[61] = getGroupRowCountLabel;
243
+ $[62] = headers.length;
244
+ $[63] = renderRow;
245
+ $[64] = rowSelection;
246
+ $[65] = t14;
247
+ } else t14 = $[65];
246
248
  t13 = bodies.map(t14);
247
249
  $[51] = actions;
248
250
  $[52] = bodies;
249
251
  $[53] = collapsibleGroups;
250
- $[54] = headers.length;
251
- $[55] = renderRow;
252
- $[56] = rowSelection;
253
- $[57] = t13;
254
- } else t13 = $[57];
252
+ $[54] = getGroupRowCountLabel;
253
+ $[55] = headers.length;
254
+ $[56] = renderRow;
255
+ $[57] = rowSelection;
256
+ $[58] = t13;
257
+ } else t13 = $[58];
255
258
  let t14;
256
- if ($[64] !== cellPadding || $[65] !== describedby || $[66] !== gridTemplateColumns || $[67] !== labelledby || $[68] !== t12 || $[69] !== t13 || $[70] !== t6) {
259
+ if ($[66] !== cellPadding || $[67] !== describedby || $[68] !== gridTemplateColumns || $[69] !== labelledby || $[70] !== t12 || $[71] !== t13 || $[72] !== t6) {
257
260
  t14 = /* @__PURE__ */ jsxs(Table, {
258
261
  ref: tableRef,
259
262
  tabIndex: t6,
@@ -263,15 +266,15 @@ function DataTableImplementation(t0) {
263
266
  gridTemplateColumns,
264
267
  children: [t12, t13]
265
268
  });
266
- $[64] = cellPadding;
267
- $[65] = describedby;
268
- $[66] = gridTemplateColumns;
269
- $[67] = labelledby;
270
- $[68] = t12;
271
- $[69] = t13;
272
- $[70] = t6;
273
- $[71] = t14;
274
- } else t14 = $[71];
269
+ $[66] = cellPadding;
270
+ $[67] = describedby;
271
+ $[68] = gridTemplateColumns;
272
+ $[69] = labelledby;
273
+ $[70] = t12;
274
+ $[71] = t13;
275
+ $[72] = t6;
276
+ $[73] = t14;
277
+ } else t14 = $[73];
275
278
  return t14;
276
279
  }
277
280
  const DataTable = DataTableImplementation;
@@ -18,6 +18,7 @@ type TableGroupProps = {
18
18
  * Specify the number of member rows in the group
19
19
  */
20
20
  rowCount: number;
21
+ getRowCountLabel?: (rowCount: number) => string;
21
22
  /**
22
23
  * Provide an accessible name for the group header
23
24
  */
@@ -56,6 +57,7 @@ declare function TableGroup({
56
57
  id,
57
58
  label,
58
59
  rowCount,
60
+ getRowCountLabel,
59
61
  colSpan,
60
62
  children,
61
63
  'aria-label': ariaLabel,
@@ -11,90 +11,97 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { clsx } from "clsx";
12
12
  import { ChevronRightIcon } from "@primer/octicons-react";
13
13
  //#region src/DataTable/TableGroup.tsx
14
+ function defaultRowCountLabel(rowCount) {
15
+ return `${rowCount} ${rowCount === 1 ? "row" : "rows"}`;
16
+ }
14
17
  function TableGroup(t0) {
15
- const $ = c(71);
16
- const { className, id, label, rowCount, colSpan, children, "aria-label": ariaLabel, collapsible: t1, expanded: controlledExpanded, defaultExpanded: t2, onExpandedChange, selection, selectionDisabled, onToggleSelect } = t0;
17
- const collapsible = t1 === void 0 ? false : t1;
18
- const defaultExpanded = t2 === void 0 ? true : t2;
18
+ const $ = c(79);
19
+ const { className, id, label, rowCount, getRowCountLabel: t1, colSpan, children, "aria-label": ariaLabel, collapsible: t2, expanded: controlledExpanded, defaultExpanded: t3, onExpandedChange, selection, selectionDisabled, onToggleSelect } = t0;
20
+ const getRowCountLabel = t1 === void 0 ? defaultRowCountLabel : t1;
21
+ const collapsible = t2 === void 0 ? false : t2;
22
+ const defaultExpanded = t3 === void 0 ? true : t3;
19
23
  const headerId = useId();
20
24
  const bodyId = useId();
25
+ const countId = useId();
21
26
  const headerRef = useRef(null);
22
- let t3;
27
+ let t4;
23
28
  if ($[0] !== onExpandedChange) {
24
- t3 = (value) => onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange({ expanded: value });
29
+ t4 = (value) => onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange({ expanded: value });
25
30
  $[0] = onExpandedChange;
26
- $[1] = t3;
27
- } else t3 = $[1];
28
- let t4;
29
- if ($[2] !== controlledExpanded || $[3] !== defaultExpanded || $[4] !== t3) {
30
- t4 = {
31
+ $[1] = t4;
32
+ } else t4 = $[1];
33
+ let t5;
34
+ if ($[2] !== controlledExpanded || $[3] !== defaultExpanded || $[4] !== t4) {
35
+ t5 = {
31
36
  name: "Table.Group expanded",
32
37
  value: controlledExpanded,
33
38
  defaultValue: defaultExpanded,
34
- onChange: t3
39
+ onChange: t4
35
40
  };
36
41
  $[2] = controlledExpanded;
37
42
  $[3] = defaultExpanded;
38
- $[4] = t3;
39
- $[5] = t4;
40
- } else t4 = $[5];
41
- const [expanded, setExpanded] = useControllableState(t4);
43
+ $[4] = t4;
44
+ $[5] = t5;
45
+ } else t5 = $[5];
46
+ const [expanded, setExpanded] = useControllableState(t5);
42
47
  const isExpanded = !collapsible || expanded;
43
- let t5;
48
+ let t6;
44
49
  if ($[6] !== headerId) {
45
- t5 = { headerId };
50
+ t6 = { headerId };
46
51
  $[6] = headerId;
47
- $[7] = t5;
48
- } else t5 = $[7];
49
- const contextValue = t5;
50
- let t6;
52
+ $[7] = t6;
53
+ } else t6 = $[7];
54
+ const contextValue = t6;
55
+ let t7;
51
56
  if ($[8] !== isExpanded) {
52
- t6 = (body) => {
57
+ t7 = (body) => {
53
58
  if (!isExpanded && body !== null && body !== void 0 && body.contains(body.ownerDocument.activeElement)) {
54
59
  var _headerRef$current;
55
60
  (_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 || (_headerRef$current = _headerRef$current.querySelector("button")) === null || _headerRef$current === void 0 || _headerRef$current.focus();
56
61
  }
57
62
  };
58
63
  $[8] = isExpanded;
59
- $[9] = t6;
60
- } else t6 = $[9];
61
- const bodyRef = t6;
62
- let t7;
64
+ $[9] = t7;
65
+ } else t7 = $[9];
66
+ const bodyRef = t7;
67
+ let t8;
63
68
  if ($[10] !== className) {
64
- t7 = clsx("TableGroupHeaderBody", Table_module_css_default.TableGroupHeaderBody, className);
69
+ t8 = clsx("TableGroupHeaderBody", Table_module_css_default.TableGroupHeaderBody, className);
65
70
  $[10] = className;
66
- $[11] = t7;
67
- } else t7 = $[11];
68
- let t8;
71
+ $[11] = t8;
72
+ } else t8 = $[11];
73
+ let t9;
69
74
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
70
- t8 = clsx("TableGroupHeaderCell", Table_module_css_default.TableGroupHeaderCell);
71
- $[12] = t8;
72
- } else t8 = $[12];
73
- const t9 = collapsible || selection !== void 0 ? ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label : ariaLabel;
74
- let t10;
75
- if ($[13] !== ariaLabel || $[14] !== label || $[15] !== onToggleSelect || $[16] !== selection || $[17] !== selectionDisabled) {
76
- t10 = selection !== void 0 ? /* @__PURE__ */ jsx(Checkbox, {
75
+ t9 = clsx("TableGroupHeaderCell", Table_module_css_default.TableGroupHeaderCell);
76
+ $[12] = t9;
77
+ } else t9 = $[12];
78
+ const t10 = collapsible || selection !== void 0 ? ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label : ariaLabel;
79
+ let t11;
80
+ if ($[13] !== ariaLabel || $[14] !== countId || $[15] !== label || $[16] !== onToggleSelect || $[17] !== selection || $[18] !== selectionDisabled) {
81
+ t11 = selection !== void 0 ? /* @__PURE__ */ jsx(Checkbox, {
77
82
  className: Table_module_css_default.TableGroupSelection,
78
83
  checked: selection === "all",
79
84
  indeterminate: selection === "some",
80
85
  disabled: selectionDisabled || !onToggleSelect,
81
86
  "aria-label": `Select ${ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label}`,
87
+ "aria-describedby": countId,
82
88
  onChange: () => onToggleSelect === null || onToggleSelect === void 0 ? void 0 : onToggleSelect()
83
89
  }) : null;
84
90
  $[13] = ariaLabel;
85
- $[14] = label;
86
- $[15] = onToggleSelect;
87
- $[16] = selection;
88
- $[17] = selectionDisabled;
89
- $[18] = t10;
90
- } else t10 = $[18];
91
- let t11;
92
- if ($[19] !== ariaLabel || $[20] !== bodyId || $[21] !== collapsible || $[22] !== expanded || $[23] !== isExpanded || $[24] !== label || $[25] !== rowCount || $[26] !== setExpanded) {
93
- t11 = collapsible ? /* @__PURE__ */ jsx(Button, {
91
+ $[14] = countId;
92
+ $[15] = label;
93
+ $[16] = onToggleSelect;
94
+ $[17] = selection;
95
+ $[18] = selectionDisabled;
96
+ $[19] = t11;
97
+ } else t11 = $[19];
98
+ let t12;
99
+ if ($[20] !== ariaLabel || $[21] !== bodyId || $[22] !== collapsible || $[23] !== countId || $[24] !== expanded || $[25] !== isExpanded || $[26] !== label || $[27] !== setExpanded) {
100
+ t12 = collapsible ? /* @__PURE__ */ jsx(Button, {
94
101
  className: Table_module_css_default.TableGroupToggle,
95
102
  "data-component": "Table.Group.Toggle",
96
103
  "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label,
97
- "aria-description": `${rowCount} ${rowCount === 1 ? "row" : "rows"}`,
104
+ "aria-describedby": countId,
98
105
  "aria-expanded": isExpanded,
99
106
  "aria-controls": bodyId,
100
107
  onClick: () => {
@@ -102,167 +109,185 @@ function TableGroup(t0) {
102
109
  },
103
110
  children: /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" })
104
111
  }) : null;
105
- $[19] = ariaLabel;
106
- $[20] = bodyId;
107
- $[21] = collapsible;
108
- $[22] = expanded;
109
- $[23] = isExpanded;
110
- $[24] = label;
111
- $[25] = rowCount;
112
- $[26] = setExpanded;
113
- $[27] = t11;
114
- } else t11 = $[27];
115
- let t12;
116
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
117
- t12 = clsx("TableGroupHeaderContent", Table_module_css_default.TableGroupHeaderContent);
112
+ $[20] = ariaLabel;
113
+ $[21] = bodyId;
114
+ $[22] = collapsible;
115
+ $[23] = countId;
116
+ $[24] = expanded;
117
+ $[25] = isExpanded;
118
+ $[26] = label;
119
+ $[27] = setExpanded;
118
120
  $[28] = t12;
119
121
  } else t12 = $[28];
120
- const t13 = collapsible || void 0;
121
- let t14;
122
+ let t13;
122
123
  if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
123
- t14 = clsx("TableGroupHeaderLabel", Table_module_css_default.TableGroupHeaderLabel);
124
- $[29] = t14;
125
- } else t14 = $[29];
124
+ t13 = clsx("TableGroupHeaderContent", Table_module_css_default.TableGroupHeaderContent);
125
+ $[29] = t13;
126
+ } else t13 = $[29];
127
+ const t14 = collapsible || void 0;
126
128
  let t15;
127
129
  if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
128
- t15 = /* @__PURE__ */ jsx(VisuallyHidden, { children: "," });
130
+ t15 = clsx("TableGroupHeaderLabel", Table_module_css_default.TableGroupHeaderLabel);
129
131
  $[30] = t15;
130
132
  } else t15 = $[30];
131
133
  let t16;
132
- if ($[31] !== label) {
133
- t16 = /* @__PURE__ */ jsxs("span", {
134
- className: t14,
135
- children: [label, t15]
136
- });
137
- $[31] = label;
138
- $[32] = t16;
139
- } else t16 = $[32];
134
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
135
+ t16 = /* @__PURE__ */ jsx(VisuallyHidden, { children: "," });
136
+ $[31] = t16;
137
+ } else t16 = $[31];
140
138
  let t17;
141
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
142
- t17 = clsx("TableGroupHeaderCount", Table_module_css_default.TableGroupHeaderCount);
139
+ if ($[32] !== label) {
140
+ t17 = /* @__PURE__ */ jsxs("span", {
141
+ className: t15,
142
+ children: [label, t16]
143
+ });
144
+ $[32] = label;
143
145
  $[33] = t17;
144
146
  } else t17 = $[33];
145
- const t18 = rowCount === 1 ? " row" : " rows";
146
- let t19;
147
- if ($[34] !== t18) {
148
- t19 = /* @__PURE__ */ jsx(VisuallyHidden, { children: t18 });
147
+ let t18;
148
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
149
+ t18 = clsx("TableGroupHeaderCount", Table_module_css_default.TableGroupHeaderCount);
149
150
  $[34] = t18;
150
- $[35] = t19;
151
- } else t19 = $[35];
151
+ } else t18 = $[34];
152
+ const t19 = rowCount === 1 ? " row" : " rows";
152
153
  let t20;
153
- if ($[36] !== rowCount || $[37] !== t19) {
154
- t20 = /* @__PURE__ */ jsxs("span", {
155
- className: t17,
156
- children: [rowCount, t19]
157
- });
158
- $[36] = rowCount;
159
- $[37] = t19;
160
- $[38] = t20;
161
- } else t20 = $[38];
154
+ if ($[35] !== t19) {
155
+ t20 = /* @__PURE__ */ jsx(VisuallyHidden, { children: t19 });
156
+ $[35] = t19;
157
+ $[36] = t20;
158
+ } else t20 = $[36];
162
159
  let t21;
163
- if ($[39] !== t13 || $[40] !== t16 || $[41] !== t20) {
160
+ if ($[37] !== rowCount || $[38] !== t20) {
164
161
  t21 = /* @__PURE__ */ jsxs("span", {
165
- className: t12,
166
- "aria-hidden": t13,
167
- children: [t16, t20]
162
+ className: t18,
163
+ children: [rowCount, t20]
168
164
  });
169
- $[39] = t13;
170
- $[40] = t16;
171
- $[41] = t20;
172
- $[42] = t21;
173
- } else t21 = $[42];
165
+ $[37] = rowCount;
166
+ $[38] = t20;
167
+ $[39] = t21;
168
+ } else t21 = $[39];
174
169
  let t22;
175
- if ($[43] !== selection || $[44] !== t11 || $[45] !== t21) {
170
+ if ($[40] !== t14 || $[41] !== t17 || $[42] !== t21) {
176
171
  t22 = /* @__PURE__ */ jsxs("span", {
172
+ className: t13,
173
+ "aria-hidden": t14,
174
+ children: [t17, t21]
175
+ });
176
+ $[40] = t14;
177
+ $[41] = t17;
178
+ $[42] = t21;
179
+ $[43] = t22;
180
+ } else t22 = $[43];
181
+ let t23;
182
+ if ($[44] !== selection || $[45] !== t12 || $[46] !== t22) {
183
+ t23 = /* @__PURE__ */ jsxs("span", {
177
184
  className: Table_module_css_default.TableGroupHeaderTitle,
178
185
  "data-selection": selection,
179
- children: [t11, t21]
186
+ children: [t12, t22]
180
187
  });
181
- $[43] = selection;
182
- $[44] = t11;
183
- $[45] = t21;
188
+ $[44] = selection;
189
+ $[45] = t12;
184
190
  $[46] = t22;
185
- } else t22 = $[46];
186
- let t23;
187
- if ($[47] !== colSpan || $[48] !== headerId || $[49] !== t10 || $[50] !== t22 || $[51] !== t9) {
188
- t23 = /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs("th", {
191
+ $[47] = t23;
192
+ } else t23 = $[47];
193
+ let t24;
194
+ if ($[48] !== collapsible || $[49] !== countId || $[50] !== getRowCountLabel || $[51] !== rowCount || $[52] !== selection) {
195
+ t24 = collapsible || selection !== void 0 ? /* @__PURE__ */ jsx(VisuallyHidden, {
196
+ id: countId,
197
+ children: getRowCountLabel(rowCount)
198
+ }) : null;
199
+ $[48] = collapsible;
200
+ $[49] = countId;
201
+ $[50] = getRowCountLabel;
202
+ $[51] = rowCount;
203
+ $[52] = selection;
204
+ $[53] = t24;
205
+ } else t24 = $[53];
206
+ let t25;
207
+ if ($[54] !== colSpan || $[55] !== headerId || $[56] !== t10 || $[57] !== t11 || $[58] !== t23 || $[59] !== t24) {
208
+ t25 = /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs("th", {
189
209
  id: headerId,
190
210
  ref: headerRef,
191
- className: t8,
211
+ className: t9,
192
212
  scope: "colgroup",
193
213
  colSpan,
194
214
  role: "columnheader",
195
- "aria-label": t9,
215
+ "aria-label": t10,
196
216
  "data-component": "Table.Group.Header",
197
- children: [t10, t22]
217
+ children: [
218
+ t11,
219
+ t23,
220
+ t24
221
+ ]
198
222
  }) });
199
- $[47] = colSpan;
200
- $[48] = headerId;
201
- $[49] = t10;
202
- $[50] = t22;
203
- $[51] = t9;
204
- $[52] = t23;
205
- } else t23 = $[52];
206
- let t24;
207
- if ($[53] !== id || $[54] !== t23 || $[55] !== t7) {
208
- t24 = /* @__PURE__ */ jsx("tbody", {
209
- className: t7,
223
+ $[54] = colSpan;
224
+ $[55] = headerId;
225
+ $[56] = t10;
226
+ $[57] = t11;
227
+ $[58] = t23;
228
+ $[59] = t24;
229
+ $[60] = t25;
230
+ } else t25 = $[60];
231
+ let t26;
232
+ if ($[61] !== id || $[62] !== t25 || $[63] !== t8) {
233
+ t26 = /* @__PURE__ */ jsx("tbody", {
234
+ className: t8,
210
235
  role: "rowgroup",
211
236
  "data-component": "Table.Group",
212
237
  "data-group-id": id,
213
- children: t23
238
+ children: t25
214
239
  });
215
- $[53] = id;
216
- $[54] = t23;
217
- $[55] = t7;
218
- $[56] = t24;
219
- } else t24 = $[56];
220
- const t25 = !isExpanded;
221
- let t26;
222
- if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
223
- t26 = clsx("TableBody", Table_module_css_default.TableBody);
224
- $[57] = t26;
225
- } else t26 = $[57];
226
- const t27 = collapsible ? selection : void 0;
240
+ $[61] = id;
241
+ $[62] = t25;
242
+ $[63] = t8;
243
+ $[64] = t26;
244
+ } else t26 = $[64];
245
+ const t27 = !isExpanded;
227
246
  let t28;
228
- if ($[58] !== children || $[59] !== contextValue) {
229
- t28 = /* @__PURE__ */ jsx(TableGroupContext.Provider, {
247
+ if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
248
+ t28 = clsx("TableBody", Table_module_css_default.TableBody);
249
+ $[65] = t28;
250
+ } else t28 = $[65];
251
+ const t29 = collapsible ? selection : void 0;
252
+ let t30;
253
+ if ($[66] !== children || $[67] !== contextValue) {
254
+ t30 = /* @__PURE__ */ jsx(TableGroupContext.Provider, {
230
255
  value: contextValue,
231
256
  children
232
257
  });
233
- $[58] = children;
234
- $[59] = contextValue;
235
- $[60] = t28;
236
- } else t28 = $[60];
237
- let t29;
238
- if ($[61] !== bodyId || $[62] !== bodyRef || $[63] !== id || $[64] !== t25 || $[65] !== t27 || $[66] !== t28) {
239
- t29 = /* @__PURE__ */ jsx("tbody", {
258
+ $[66] = children;
259
+ $[67] = contextValue;
260
+ $[68] = t30;
261
+ } else t30 = $[68];
262
+ let t31;
263
+ if ($[69] !== bodyId || $[70] !== bodyRef || $[71] !== id || $[72] !== t27 || $[73] !== t29 || $[74] !== t30) {
264
+ t31 = /* @__PURE__ */ jsx("tbody", {
240
265
  id: bodyId,
241
266
  ref: bodyRef,
242
- hidden: t25,
243
- className: t26,
267
+ hidden: t27,
268
+ className: t28,
244
269
  role: "rowgroup",
245
270
  "data-component": "Table.Group.Body",
246
271
  "data-group-id": id,
247
- "data-selection": t27,
248
- children: t28
272
+ "data-selection": t29,
273
+ children: t30
249
274
  });
250
- $[61] = bodyId;
251
- $[62] = bodyRef;
252
- $[63] = id;
253
- $[64] = t25;
254
- $[65] = t27;
255
- $[66] = t28;
256
- $[67] = t29;
257
- } else t29 = $[67];
258
- let t30;
259
- if ($[68] !== t24 || $[69] !== t29) {
260
- t30 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t24, t29] });
261
- $[68] = t24;
262
- $[69] = t29;
263
- $[70] = t30;
264
- } else t30 = $[70];
265
- return t30;
275
+ $[69] = bodyId;
276
+ $[70] = bodyRef;
277
+ $[71] = id;
278
+ $[72] = t27;
279
+ $[73] = t29;
280
+ $[74] = t30;
281
+ $[75] = t31;
282
+ } else t31 = $[75];
283
+ let t32;
284
+ if ($[76] !== t26 || $[77] !== t31) {
285
+ t32 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t26, t31] });
286
+ $[76] = t26;
287
+ $[77] = t31;
288
+ $[78] = t32;
289
+ } else t32 = $[78];
290
+ return t32;
266
291
  }
267
292
  //#endregion
268
293
  export { TableGroup };
@@ -2941,6 +2941,11 @@
2941
2941
  "defaultValue": "false",
2942
2942
  "description": "Enable group disclosures. Collapsing only hides members; selection and select-all still include them."
2943
2943
  },
2944
+ {
2945
+ "name": "getGroupRowCountLabel",
2946
+ "type": "(rowCount: number) => string",
2947
+ "description": "Localize the description shared by each group checkbox and disclosure. The count includes all members, including non-selectable rows, and defaults to 1 row or N rows."
2948
+ },
2944
2949
  {
2945
2950
  "name": "expandedGroups",
2946
2951
  "type": "ReadonlySet<DataTableRowId>",
@@ -3156,12 +3161,17 @@
3156
3161
  {
3157
3162
  "name": "rowCount",
3158
3163
  "type": "number",
3159
- "description": "The number of member rows in the group. Combined with `label` to build the group header's accessible name, for example \"Admins, 2 rows\"."
3164
+ "description": "The total number of member rows, including non-selectable rows. Shown in the header and described separately on the checkbox and disclosure."
3165
+ },
3166
+ {
3167
+ "name": "getRowCountLabel",
3168
+ "type": "(rowCount: number) => string",
3169
+ "description": "Localize the count description shared by the checkbox and disclosure. Defaults to 1 row or N rows."
3160
3170
  },
3161
3171
  {
3162
3172
  "name": "aria-label",
3163
3173
  "type": "string",
3164
- "description": "Override the group header's accessible name, for example to localize its row count description."
3174
+ "description": "Override the group name used by the header, checkbox, and disclosure. Use getRowCountLabel to localize the controls' separate count description."
3165
3175
  },
3166
3176
  {
3167
3177
  "name": "colSpan",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.46.1-rc.41e2a6837",
4
+ "version": "38.47.0-rc.200a948c2",
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",