@primer/react 0.0.0-20260814135639 → 0.0.0-20260819123220

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.
@@ -8,12 +8,16 @@ import { useIsClipped } from "../internal/hooks/useOverflowObserver.js";
8
8
  import { OverflowObserverProvider } from "../internal/components/OverflowObserverProvider.js";
9
9
  import { createDescendantRegistry } from "../utils/descendant-registry.js";
10
10
  import ActionBar_module_css_default from "./ActionBar.module.css.js";
11
+ import { c } from "react-compiler-runtime";
11
12
  import { clsx } from "clsx";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
13
- import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
14
+ import React, { forwardRef, useContext, useRef, useState } from "react";
14
15
  import { KebabHorizontalIcon } from "@primer/octicons-react";
15
16
  //#region src/ActionBar/ActionBar.tsx
16
- const ActionBarContext = /*#__PURE__*/ React.createContext({ size: "medium" });
17
+ const ActionBarContext = /*#__PURE__*/ React.createContext({
18
+ size: "medium",
19
+ overflowButtonRef: { current: null }
20
+ });
17
21
  const ActionBarItemsRegistry = createDescendantRegistry();
18
22
  const FOCUSABLE_ITEM_SELECTOR = ":is(button, a, input, [tabindex]):not(:disabled):not([data-overflowing]):not([data-more-button-inactive])";
19
23
  const renderMenuItem = (item, index) => {
@@ -40,205 +44,588 @@ const renderMenuItem = (item, index) => {
40
44
  }, label);
41
45
  };
42
46
  renderMenuItem.displayName = "renderMenuItem";
43
- const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush = false, className, gap = "condensed" }) => {
47
+ const ActionBar = (t0) => {
48
+ const $ = c(43);
49
+ const { size: t1, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush: t2, className, gap: t3 } = t0;
50
+ const size = t1 === void 0 ? "medium" : t1;
51
+ const flush = t2 === void 0 ? false : t2;
52
+ const gap = t3 === void 0 ? "condensed" : t3;
44
53
  const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
45
- const overflowItems = useMemo(() => childRegistry && Array.from(childRegistry.entries()).filter((entry) => entry[1] !== null), [childRegistry]);
46
- const { containerRef } = useFocusZone({
47
- bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
48
- focusOutBehavior: "wrap",
49
- focusableElementFilter: (element) => element.matches(FOCUSABLE_ITEM_SELECTOR)
50
- }, [overflowItems]);
51
- return /*#__PURE__*/ jsx(ActionBarContext.Provider, {
52
- value: { size },
53
- children: /*#__PURE__*/ jsx("div", {
54
- className: clsx(className, ActionBar_module_css_default.Nav),
54
+ const [overflowMenuOpen, setOverflowMenuOpen] = useState(false);
55
+ const overflowButtonRef = useRef(null);
56
+ let t4;
57
+ if ($[0] !== childRegistry) {
58
+ t4 = childRegistry && Array.from(childRegistry.entries()).filter(_temp);
59
+ $[0] = childRegistry;
60
+ $[1] = t4;
61
+ } else t4 = $[1];
62
+ const overflowItems = t4;
63
+ let t5;
64
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
65
+ t5 = {
66
+ bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
67
+ focusOutBehavior: "wrap",
68
+ focusableElementFilter: _temp2
69
+ };
70
+ $[2] = t5;
71
+ } else t5 = $[2];
72
+ let t6;
73
+ if ($[3] !== overflowItems) {
74
+ t6 = [overflowItems];
75
+ $[3] = overflowItems;
76
+ $[4] = t6;
77
+ } else t6 = $[4];
78
+ const { containerRef } = useFocusZone(t5, t6);
79
+ let t7;
80
+ if ($[5] !== size) {
81
+ t7 = {
82
+ size,
83
+ overflowButtonRef
84
+ };
85
+ $[5] = size;
86
+ $[6] = t7;
87
+ } else t7 = $[6];
88
+ let t8;
89
+ if ($[7] !== className) {
90
+ t8 = clsx(className, ActionBar_module_css_default.Nav);
91
+ $[7] = className;
92
+ $[8] = t8;
93
+ } else t8 = $[8];
94
+ const t9 = containerRef;
95
+ const t10 = overflowItems ? overflowItems.length > 0 : void 0;
96
+ let t11;
97
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
98
+ t11 = /*#__PURE__*/ jsx("div", { className: ActionBar_module_css_default.OverflowSpacer });
99
+ $[9] = t11;
100
+ } else t11 = $[9];
101
+ let t12;
102
+ if ($[10] !== children || $[11] !== setChildRegistry) {
103
+ t12 = /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
104
+ setRegistry: setChildRegistry,
105
+ children
106
+ });
107
+ $[10] = children;
108
+ $[11] = setChildRegistry;
109
+ $[12] = t12;
110
+ } else t12 = $[12];
111
+ let t13;
112
+ if ($[13] !== containerRef || $[14] !== t12) {
113
+ t13 = /*#__PURE__*/ jsxs("div", {
114
+ className: ActionBar_module_css_default.OverflowContainer,
115
+ children: [t11, /*#__PURE__*/ jsx(OverflowObserverProvider, {
116
+ rootRef: containerRef,
117
+ children: t12
118
+ })]
119
+ });
120
+ $[13] = containerRef;
121
+ $[14] = t12;
122
+ $[15] = t13;
123
+ } else t13 = $[15];
124
+ const t14 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true;
125
+ let t15;
126
+ if ($[16] !== size || $[17] !== t14) {
127
+ t15 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
128
+ variant: "invisible",
129
+ "aria-label": "More items",
130
+ icon: KebabHorizontalIcon,
131
+ className: ActionBar_module_css_default.MoreButton,
132
+ "data-more-button-inactive": t14,
133
+ size
134
+ }) });
135
+ $[16] = size;
136
+ $[17] = t14;
137
+ $[18] = t15;
138
+ } else t15 = $[18];
139
+ let t16;
140
+ if ($[19] !== overflowItems) {
141
+ t16 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map((t17) => {
142
+ const [id, menuItem] = t17;
143
+ if (menuItem.type === "divider") return /*#__PURE__*/ jsx(ActionList.Divider, {}, id);
144
+ if (menuItem.type === "action") {
145
+ const { onActivate, icon: Icon, label, disabled } = menuItem;
146
+ return /*#__PURE__*/ jsxs(ActionList.Item, {
147
+ onSelect: (event) => {
148
+ event.preventDefault();
149
+ setOverflowMenuOpen(false);
150
+ onActivate();
151
+ },
152
+ disabled,
153
+ children: [Icon ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label]
154
+ }, id);
155
+ }
156
+ if (menuItem.type === "menu") {
157
+ const menuItems = menuItem.items;
158
+ const { icon: Icon_0, label: label_0, returnFocusRef } = menuItem;
159
+ return /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsxs(ActionList.Item, { children: [Icon_0 !== "none" ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon_0, {}) }) : null, label_0] }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
160
+ ...returnFocusRef && { returnFocusRef },
161
+ children: /*#__PURE__*/ jsx(ActionList, { children: menuItems.map(_temp3) })
162
+ })] }, id);
163
+ }
164
+ });
165
+ $[19] = overflowItems;
166
+ $[20] = t16;
167
+ } else t16 = $[20];
168
+ let t17;
169
+ if ($[21] !== t16) {
170
+ t17 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t16 }) });
171
+ $[21] = t16;
172
+ $[22] = t17;
173
+ } else t17 = $[22];
174
+ let t18;
175
+ if ($[23] !== overflowMenuOpen || $[24] !== t15 || $[25] !== t17) {
176
+ t18 = /*#__PURE__*/ jsxs(ActionMenu, {
177
+ anchorRef: overflowButtonRef,
178
+ open: overflowMenuOpen,
179
+ onOpenChange: setOverflowMenuOpen,
180
+ children: [t15, t17]
181
+ });
182
+ $[23] = overflowMenuOpen;
183
+ $[24] = t15;
184
+ $[25] = t17;
185
+ $[26] = t18;
186
+ } else t18 = $[26];
187
+ let t19;
188
+ if ($[27] !== ariaLabel || $[28] !== ariaLabelledBy || $[29] !== gap || $[30] !== size || $[31] !== t10 || $[32] !== t13 || $[33] !== t18 || $[34] !== t9) {
189
+ t19 = /*#__PURE__*/ jsxs("div", {
190
+ ref: t9,
191
+ role: "toolbar",
192
+ className: ActionBar_module_css_default.List,
193
+ "aria-label": ariaLabel,
194
+ "aria-labelledby": ariaLabelledBy,
195
+ "data-gap": gap,
196
+ "data-size": size,
197
+ "data-has-overflow": t10,
198
+ children: [t13, t18]
199
+ });
200
+ $[27] = ariaLabel;
201
+ $[28] = ariaLabelledBy;
202
+ $[29] = gap;
203
+ $[30] = size;
204
+ $[31] = t10;
205
+ $[32] = t13;
206
+ $[33] = t18;
207
+ $[34] = t9;
208
+ $[35] = t19;
209
+ } else t19 = $[35];
210
+ let t20;
211
+ if ($[36] !== flush || $[37] !== t19 || $[38] !== t8) {
212
+ t20 = /*#__PURE__*/ jsx("div", {
213
+ className: t8,
55
214
  "data-component": "ActionBar",
56
215
  "data-flush": flush,
57
- children: /*#__PURE__*/ jsxs("div", {
58
- ref: containerRef,
59
- role: "toolbar",
60
- className: ActionBar_module_css_default.List,
61
- "aria-label": ariaLabel,
62
- "aria-labelledby": ariaLabelledBy,
63
- "data-gap": gap,
64
- "data-size": size,
65
- "data-has-overflow": overflowItems ? overflowItems.length > 0 : void 0,
66
- children: [/*#__PURE__*/ jsxs("div", {
67
- className: ActionBar_module_css_default.OverflowContainer,
68
- children: [/*#__PURE__*/ jsx("div", { className: ActionBar_module_css_default.OverflowSpacer }), /*#__PURE__*/ jsx(OverflowObserverProvider, {
69
- rootRef: containerRef,
70
- children: /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
71
- setRegistry: setChildRegistry,
72
- children
73
- })
74
- })]
75
- }), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
76
- variant: "invisible",
77
- "aria-label": "More items",
78
- icon: KebabHorizontalIcon,
79
- className: ActionBar_module_css_default.MoreButton,
80
- "data-more-button-inactive": overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true,
81
- size
82
- }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(([id, menuItem]) => {
83
- if (menuItem.type === "divider") return /*#__PURE__*/ jsx(ActionList.Divider, {}, id);
84
- if (menuItem.type === "action") {
85
- const { onClick, icon: Icon, label, disabled } = menuItem;
86
- return /*#__PURE__*/ jsxs(ActionList.Item, {
87
- onSelect: (event) => {
88
- typeof onClick === "function" && onClick(event);
89
- },
90
- disabled,
91
- children: [Icon ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label]
92
- }, id);
93
- }
94
- if (menuItem.type === "menu") {
95
- const menuItems = menuItem.items;
96
- const { icon: Icon, label, returnFocusRef } = menuItem;
97
- return /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsxs(ActionList.Item, { children: [Icon !== "none" ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label] }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
98
- ...returnFocusRef && { returnFocusRef },
99
- children: /*#__PURE__*/ jsx(ActionList, { children: menuItems.map((item, index) => renderMenuItem(item, index)) })
100
- })] }, id);
101
- }
102
- }) }) })] })]
103
- })
104
- })
105
- });
216
+ children: t19
217
+ });
218
+ $[36] = flush;
219
+ $[37] = t19;
220
+ $[38] = t8;
221
+ $[39] = t20;
222
+ } else t20 = $[39];
223
+ let t21;
224
+ if ($[40] !== t20 || $[41] !== t7) {
225
+ t21 = /*#__PURE__*/ jsx(ActionBarContext.Provider, {
226
+ value: t7,
227
+ children: t20
228
+ });
229
+ $[40] = t20;
230
+ $[41] = t7;
231
+ $[42] = t21;
232
+ } else t21 = $[42];
233
+ return t21;
106
234
  };
107
- ActionBar.displayName = "ActionBar";
108
- function useActionBarItem(ref, registryProps) {
235
+ function useActionBarItem(ref, registryProps, activeAnchorRef) {
109
236
  var _useContext;
237
+ const $ = c(11);
110
238
  const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
111
- const isItemOverflowing = useIsClipped(ref, { disabled: isGroupOverflowing !== void 0 });
239
+ const { overflowButtonRef } = useContext(ActionBarContext);
240
+ const isInGroup = isGroupOverflowing !== void 0;
241
+ let t0;
242
+ if ($[0] !== isInGroup) {
243
+ t0 = { disabled: isInGroup };
244
+ $[0] = isInGroup;
245
+ $[1] = t0;
246
+ } else t0 = $[1];
247
+ const isItemOverflowing = useIsClipped(ref, t0);
112
248
  const isOverflowing = isGroupOverflowing || isItemOverflowing;
249
+ const setActiveAnchorRef = useMergedRefs(activeAnchorRef, void 0);
250
+ let t1;
251
+ if ($[2] !== activeAnchorRef || $[3] !== isOverflowing || $[4] !== overflowButtonRef || $[5] !== setActiveAnchorRef) {
252
+ t1 = (button) => {
253
+ if (!activeAnchorRef || button === null) return setActiveAnchorRef(null);
254
+ return setActiveAnchorRef(isOverflowing ? overflowButtonRef.current : button);
255
+ };
256
+ $[2] = activeAnchorRef;
257
+ $[3] = isOverflowing;
258
+ $[4] = overflowButtonRef;
259
+ $[5] = setActiveAnchorRef;
260
+ $[6] = t1;
261
+ } else t1 = $[6];
262
+ const publishActiveAnchor = t1;
113
263
  ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
114
- return {
115
- isOverflowing,
116
- dataOverflowingAttr: isOverflowing ? "" : void 0
117
- };
264
+ const t2 = isOverflowing ? "" : void 0;
265
+ let t3;
266
+ if ($[7] !== isOverflowing || $[8] !== publishActiveAnchor || $[9] !== t2) {
267
+ t3 = {
268
+ isOverflowing,
269
+ dataOverflowingAttr: t2,
270
+ publishActiveAnchor
271
+ };
272
+ $[7] = isOverflowing;
273
+ $[8] = publishActiveAnchor;
274
+ $[9] = t2;
275
+ $[10] = t3;
276
+ } else t3 = $[10];
277
+ return t3;
118
278
  }
119
- const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
279
+ const ActionBarIconButton = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
280
+ const $ = c(20);
281
+ let activeAnchorRef;
282
+ let disabled;
283
+ let onClick;
284
+ let props;
285
+ if ($[0] !== t0) {
286
+ ({disabled, onClick, activeAnchorRef, ...props} = t0);
287
+ $[0] = t0;
288
+ $[1] = activeAnchorRef;
289
+ $[2] = disabled;
290
+ $[3] = onClick;
291
+ $[4] = props;
292
+ } else {
293
+ activeAnchorRef = $[1];
294
+ disabled = $[2];
295
+ onClick = $[3];
296
+ props = $[4];
297
+ }
120
298
  const ref = useRef(null);
121
- const mergedRef = useMergedRefs(forwardedRef, ref);
299
+ const forwardedAndInternalRef = useMergedRefs(forwardedRef, ref);
122
300
  const { size } = React.useContext(ActionBarContext);
123
- const { ["aria-label"]: ariaLabel, icon } = props;
124
- const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({
125
- type: "action",
126
- label: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "",
127
- icon,
128
- disabled: !!disabled,
129
- onClick
130
- }), [
131
- ariaLabel,
132
- icon,
133
- disabled,
134
- onClick
135
- ]));
136
- const clickHandler = useCallback((event) => {
137
- if (disabled) return;
138
- onClick === null || onClick === void 0 || onClick(event);
139
- }, [disabled, onClick]);
140
- return /*#__PURE__*/ jsx(IconButton, {
141
- "aria-disabled": disabled,
142
- ref: mergedRef,
143
- size,
144
- onClick: clickHandler,
145
- ...props,
146
- variant: "invisible",
147
- "data-overflowing": dataOverflowingAttr
148
- });
301
+ const ariaLabel = props["aria-label"];
302
+ const { icon } = props;
303
+ let t1;
304
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
305
+ t1 = () => {
306
+ var _ref$current;
307
+ return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
308
+ };
309
+ $[5] = t1;
310
+ } else t1 = $[5];
311
+ const activate = t1;
312
+ const t2 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "";
313
+ const t3 = !!disabled;
314
+ let t4;
315
+ if ($[6] !== icon || $[7] !== t2 || $[8] !== t3) {
316
+ t4 = {
317
+ type: "action",
318
+ label: t2,
319
+ icon,
320
+ disabled: t3,
321
+ onActivate: activate
322
+ };
323
+ $[6] = icon;
324
+ $[7] = t2;
325
+ $[8] = t3;
326
+ $[9] = t4;
327
+ } else t4 = $[9];
328
+ const { dataOverflowingAttr, publishActiveAnchor } = useActionBarItem(ref, t4, activeAnchorRef);
329
+ const mergedRef = useMergedRefs(forwardedAndInternalRef, publishActiveAnchor);
330
+ let t5;
331
+ if ($[10] !== disabled || $[11] !== onClick) {
332
+ t5 = (event) => {
333
+ var _onClick;
334
+ if (disabled) return;
335
+ (_onClick = onClick) === null || _onClick === void 0 || _onClick(event);
336
+ };
337
+ $[10] = disabled;
338
+ $[11] = onClick;
339
+ $[12] = t5;
340
+ } else t5 = $[12];
341
+ const clickHandler = t5;
342
+ let t6;
343
+ if ($[13] !== clickHandler || $[14] !== dataOverflowingAttr || $[15] !== disabled || $[16] !== mergedRef || $[17] !== props || $[18] !== size) {
344
+ t6 = /*#__PURE__*/ jsx(IconButton, {
345
+ "aria-disabled": disabled,
346
+ ref: mergedRef,
347
+ size,
348
+ onClick: clickHandler,
349
+ ...props,
350
+ variant: "invisible",
351
+ "data-overflowing": dataOverflowingAttr
352
+ });
353
+ $[13] = clickHandler;
354
+ $[14] = dataOverflowingAttr;
355
+ $[15] = disabled;
356
+ $[16] = mergedRef;
357
+ $[17] = props;
358
+ $[18] = size;
359
+ $[19] = t6;
360
+ } else t6 = $[19];
361
+ return t6;
149
362
  });
150
- const ActionBarButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
363
+ const ActionBarButton = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
364
+ const $ = c(20);
365
+ let activeAnchorRef;
366
+ let disabled;
367
+ let onClick;
368
+ let props;
369
+ if ($[0] !== t0) {
370
+ ({disabled, onClick, activeAnchorRef, ...props} = t0);
371
+ $[0] = t0;
372
+ $[1] = activeAnchorRef;
373
+ $[2] = disabled;
374
+ $[3] = onClick;
375
+ $[4] = props;
376
+ } else {
377
+ activeAnchorRef = $[1];
378
+ disabled = $[2];
379
+ onClick = $[3];
380
+ props = $[4];
381
+ }
151
382
  const ref = useRef(null);
152
- const mergedRef = useMergedRefs(forwardedRef, ref);
383
+ const forwardedAndInternalRef = useMergedRefs(forwardedRef, ref);
153
384
  const { size } = React.useContext(ActionBarContext);
154
385
  const { children, leadingVisual } = props;
155
- const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({
156
- type: "action",
157
- label: children,
158
- icon: typeof leadingVisual === "function" ? leadingVisual : void 0,
159
- disabled: !!disabled,
160
- onClick
161
- }), [
162
- children,
163
- leadingVisual,
164
- disabled,
165
- onClick
166
- ]));
167
- const clickHandler = useCallback((event) => {
168
- if (disabled) return;
169
- onClick === null || onClick === void 0 || onClick(event);
170
- }, [disabled, onClick]);
171
- return /*#__PURE__*/ jsx(ButtonComponent, {
172
- "aria-disabled": disabled,
173
- ref: mergedRef,
174
- size,
175
- onClick: clickHandler,
176
- ...props,
177
- variant: "invisible",
178
- "data-overflowing": dataOverflowingAttr
179
- });
386
+ let t1;
387
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
388
+ t1 = () => {
389
+ var _ref$current2;
390
+ return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.click();
391
+ };
392
+ $[5] = t1;
393
+ } else t1 = $[5];
394
+ const activate = t1;
395
+ const t2 = typeof leadingVisual === "function" ? leadingVisual : void 0;
396
+ const t3 = !!disabled;
397
+ let t4;
398
+ if ($[6] !== children || $[7] !== t2 || $[8] !== t3) {
399
+ t4 = {
400
+ type: "action",
401
+ label: children,
402
+ icon: t2,
403
+ disabled: t3,
404
+ onActivate: activate
405
+ };
406
+ $[6] = children;
407
+ $[7] = t2;
408
+ $[8] = t3;
409
+ $[9] = t4;
410
+ } else t4 = $[9];
411
+ const { dataOverflowingAttr, publishActiveAnchor } = useActionBarItem(ref, t4, activeAnchorRef);
412
+ const mergedRef = useMergedRefs(forwardedAndInternalRef, publishActiveAnchor);
413
+ let t5;
414
+ if ($[10] !== disabled || $[11] !== onClick) {
415
+ t5 = (event) => {
416
+ var _onClick2;
417
+ if (disabled) return;
418
+ (_onClick2 = onClick) === null || _onClick2 === void 0 || _onClick2(event);
419
+ };
420
+ $[10] = disabled;
421
+ $[11] = onClick;
422
+ $[12] = t5;
423
+ } else t5 = $[12];
424
+ const clickHandler = t5;
425
+ let t6;
426
+ if ($[13] !== clickHandler || $[14] !== dataOverflowingAttr || $[15] !== disabled || $[16] !== mergedRef || $[17] !== props || $[18] !== size) {
427
+ t6 = /*#__PURE__*/ jsx(ButtonComponent, {
428
+ "aria-disabled": disabled,
429
+ ref: mergedRef,
430
+ size,
431
+ onClick: clickHandler,
432
+ ...props,
433
+ variant: "invisible",
434
+ "data-overflowing": dataOverflowingAttr
435
+ });
436
+ $[13] = clickHandler;
437
+ $[14] = dataOverflowingAttr;
438
+ $[15] = disabled;
439
+ $[16] = mergedRef;
440
+ $[17] = props;
441
+ $[18] = size;
442
+ $[19] = t6;
443
+ } else t6 = $[19];
444
+ return t6;
180
445
  });
181
446
  const ActionBarGroupContext = /*#__PURE__*/ React.createContext(null);
182
- const ActionBarGroup = /*#__PURE__*/ forwardRef(({ children }, forwardedRef) => {
447
+ const ActionBarGroup = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
448
+ const $ = c(10);
449
+ const { children } = t0;
183
450
  const backupRef = useRef(null);
184
451
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
185
- const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, useMemo(() => ({ type: "group" }), []));
186
- return /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
187
- value: { isOverflowing },
188
- children: /*#__PURE__*/ jsx("div", {
452
+ let t1;
453
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
454
+ t1 = { type: "group" };
455
+ $[0] = t1;
456
+ } else t1 = $[0];
457
+ const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, t1);
458
+ let t2;
459
+ if ($[1] !== isOverflowing) {
460
+ t2 = { isOverflowing };
461
+ $[1] = isOverflowing;
462
+ $[2] = t2;
463
+ } else t2 = $[2];
464
+ let t3;
465
+ if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
466
+ t3 = /*#__PURE__*/ jsx("div", {
189
467
  className: ActionBar_module_css_default.Group,
190
468
  "data-component": "ActionBar.Group",
191
469
  ref,
192
470
  "data-overflowing": dataOverflowingAttr,
193
471
  children
194
- })
195
- });
472
+ });
473
+ $[3] = children;
474
+ $[4] = dataOverflowingAttr;
475
+ $[5] = ref;
476
+ $[6] = t3;
477
+ } else t3 = $[6];
478
+ let t4;
479
+ if ($[7] !== t2 || $[8] !== t3) {
480
+ t4 = /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
481
+ value: t2,
482
+ children: t3
483
+ });
484
+ $[7] = t2;
485
+ $[8] = t3;
486
+ $[9] = t4;
487
+ } else t4 = $[9];
488
+ return t4;
196
489
  });
197
- const ActionBarMenu = /*#__PURE__*/ forwardRef(({ "aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props }, forwardedRef) => {
490
+ const ActionBarMenu = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
491
+ const $ = c(31);
492
+ let ariaLabel;
493
+ let icon;
494
+ let items;
495
+ let overflowIcon;
496
+ let props;
497
+ let returnFocusRef;
498
+ if ($[0] !== t0) {
499
+ ({"aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props} = t0);
500
+ $[0] = t0;
501
+ $[1] = ariaLabel;
502
+ $[2] = icon;
503
+ $[3] = items;
504
+ $[4] = overflowIcon;
505
+ $[5] = props;
506
+ $[6] = returnFocusRef;
507
+ } else {
508
+ ariaLabel = $[1];
509
+ icon = $[2];
510
+ items = $[3];
511
+ overflowIcon = $[4];
512
+ props = $[5];
513
+ returnFocusRef = $[6];
514
+ }
198
515
  const backupRef = useRef(null);
199
516
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
200
517
  const [menuOpen, setMenuOpen] = useState(false);
201
- const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({
202
- type: "menu",
203
- label: ariaLabel,
204
- icon: overflowIcon ? overflowIcon : icon,
205
- returnFocusRef,
206
- items
207
- }), [
208
- ariaLabel,
209
- overflowIcon,
210
- icon,
211
- items,
212
- returnFocusRef
213
- ]));
214
- return /*#__PURE__*/ jsxs(ActionMenu, {
215
- anchorRef: ref,
216
- open: menuOpen,
217
- onOpenChange: setMenuOpen,
218
- children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
518
+ const t1 = overflowIcon ? overflowIcon : icon;
519
+ let t2;
520
+ if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1) {
521
+ t2 = {
522
+ type: "menu",
523
+ label: ariaLabel,
524
+ icon: t1,
525
+ returnFocusRef,
526
+ items
527
+ };
528
+ $[7] = ariaLabel;
529
+ $[8] = items;
530
+ $[9] = returnFocusRef;
531
+ $[10] = t1;
532
+ $[11] = t2;
533
+ } else t2 = $[11];
534
+ const { dataOverflowingAttr } = useActionBarItem(ref, t2);
535
+ let t3;
536
+ if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
537
+ t3 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
219
538
  variant: "invisible",
220
539
  "aria-label": ariaLabel,
221
540
  icon,
222
541
  ...props,
223
542
  "data-overflowing": dataOverflowingAttr,
224
543
  "data-component": "ActionBar.Menu.IconButton"
225
- }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
226
- ...returnFocusRef && { returnFocusRef },
227
- children: /*#__PURE__*/ jsx(ActionList, { children: items.map((item, index) => renderMenuItem(item, index)) })
228
- })]
229
- });
544
+ }) });
545
+ $[12] = ariaLabel;
546
+ $[13] = dataOverflowingAttr;
547
+ $[14] = icon;
548
+ $[15] = props;
549
+ $[16] = t3;
550
+ } else t3 = $[16];
551
+ let t4;
552
+ if ($[17] !== returnFocusRef) {
553
+ t4 = returnFocusRef && { returnFocusRef };
554
+ $[17] = returnFocusRef;
555
+ $[18] = t4;
556
+ } else t4 = $[18];
557
+ let t5;
558
+ if ($[19] !== items) {
559
+ t5 = items.map(_temp4);
560
+ $[19] = items;
561
+ $[20] = t5;
562
+ } else t5 = $[20];
563
+ let t6;
564
+ if ($[21] !== t5) {
565
+ t6 = /*#__PURE__*/ jsx(ActionList, { children: t5 });
566
+ $[21] = t5;
567
+ $[22] = t6;
568
+ } else t6 = $[22];
569
+ let t7;
570
+ if ($[23] !== t4 || $[24] !== t6) {
571
+ t7 = /*#__PURE__*/ jsx(ActionMenu.Overlay, {
572
+ ...t4,
573
+ children: t6
574
+ });
575
+ $[23] = t4;
576
+ $[24] = t6;
577
+ $[25] = t7;
578
+ } else t7 = $[25];
579
+ let t8;
580
+ if ($[26] !== menuOpen || $[27] !== ref || $[28] !== t3 || $[29] !== t7) {
581
+ t8 = /*#__PURE__*/ jsxs(ActionMenu, {
582
+ anchorRef: ref,
583
+ open: menuOpen,
584
+ onOpenChange: setMenuOpen,
585
+ children: [t3, t7]
586
+ });
587
+ $[26] = menuOpen;
588
+ $[27] = ref;
589
+ $[28] = t3;
590
+ $[29] = t7;
591
+ $[30] = t8;
592
+ } else t8 = $[30];
593
+ return t8;
230
594
  });
231
595
  const VerticalDivider = () => {
596
+ const $ = c(3);
232
597
  const ref = useRef(null);
233
- const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({ type: "divider" }), []));
234
- return /*#__PURE__*/ jsx("div", {
235
- ref,
236
- "data-component": "ActionBar.VerticalDivider",
237
- "aria-hidden": "true",
238
- className: ActionBar_module_css_default.Divider,
239
- "data-overflowing": dataOverflowingAttr
240
- });
598
+ let t0;
599
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
600
+ t0 = { type: "divider" };
601
+ $[0] = t0;
602
+ } else t0 = $[0];
603
+ const { dataOverflowingAttr } = useActionBarItem(ref, t0);
604
+ let t1;
605
+ if ($[1] !== dataOverflowingAttr) {
606
+ t1 = /*#__PURE__*/ jsx("div", {
607
+ ref,
608
+ "data-component": "ActionBar.VerticalDivider",
609
+ "aria-hidden": "true",
610
+ className: ActionBar_module_css_default.Divider,
611
+ "data-overflowing": dataOverflowingAttr
612
+ });
613
+ $[1] = dataOverflowingAttr;
614
+ $[2] = t1;
615
+ } else t1 = $[2];
616
+ return t1;
241
617
  };
242
- VerticalDivider.displayName = "VerticalDivider";
618
+ function _temp(entry) {
619
+ return entry[1] !== null;
620
+ }
621
+ function _temp2(element) {
622
+ return element.matches(FOCUSABLE_ITEM_SELECTOR);
623
+ }
624
+ function _temp3(item, index) {
625
+ return renderMenuItem(item, index);
626
+ }
627
+ function _temp4(item, index) {
628
+ return renderMenuItem(item, index);
629
+ }
243
630
  //#endregion
244
631
  export { ActionBar, ActionBarButton, ActionBarGroup, ActionBarIconButton, ActionBarMenu, VerticalDivider };