@primer/react 38.42.0-rc.ebd425836 → 38.42.0

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