@primer/react 0.0.0-20260819151913 → 0.0.0-20260824175215
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 +12 -4
- package/dist/ActionBar/ActionBar.d.ts +5 -9
- package/dist/ActionBar/ActionBar.js +164 -551
- package/dist/ActionBar/index.d.ts +2 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.js +61 -84
- package/dist/Button/ButtonBase-b44e29d1.css +2 -0
- package/dist/Button/ButtonBase-b44e29d1.css.map +1 -0
- package/dist/Button/ButtonBase.d.ts +5 -2
- package/dist/Button/ButtonBase.js +4 -2
- package/dist/Button/ButtonBase.module.css.js +3 -2
- package/dist/Button/types.d.ts +15 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/Flash/Flash.d.ts +6 -0
- package/dist/Flash/Flash.js +6 -0
- package/dist/SelectPanel/SelectPanel.d.ts +1 -0
- package/dist/SelectPanel/SelectPanel.js +2 -2
- package/dist/deprecated/ActionMenu.js +2 -2
- package/dist/deprecated/index.d.ts +2 -1
- package/dist/deprecated/index.js +2 -1
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -0
- package/dist/experimental/Tabs/Tabs.js +33 -19
- package/dist/experimental/Tabs/types.d.ts +6 -0
- package/dist/experimental/Tabs/useTab.js +6 -1
- package/dist/experimental/Tabs/useTabList.js +29 -22
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts +38 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +69 -18
- package/dist/hooks/useOpenAndCloseFocus.js +2 -5
- package/generated/components.json +66 -25
- package/package.json +1 -1
- package/dist/Button/ButtonBase-311501b9.css +0 -2
- package/dist/Button/ButtonBase-311501b9.css.map +0 -1
|
@@ -8,16 +8,12 @@ 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";
|
|
12
11
|
import { clsx } from "clsx";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import React, { forwardRef, useContext, useRef, useState } from "react";
|
|
13
|
+
import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
15
14
|
import { KebabHorizontalIcon } from "@primer/octicons-react";
|
|
16
15
|
//#region src/ActionBar/ActionBar.tsx
|
|
17
|
-
const ActionBarContext = /*#__PURE__*/ React.createContext({
|
|
18
|
-
size: "medium",
|
|
19
|
-
overflowButtonRef: { current: null }
|
|
20
|
-
});
|
|
16
|
+
const ActionBarContext = /*#__PURE__*/ React.createContext({ size: "medium" });
|
|
21
17
|
const ActionBarItemsRegistry = createDescendantRegistry();
|
|
22
18
|
const FOCUSABLE_ITEM_SELECTOR = ":is(button, a, input, [tabindex]):not(:disabled):not([data-overflowing]):not([data-more-button-inactive])";
|
|
23
19
|
const renderMenuItem = (item, index) => {
|
|
@@ -44,588 +40,205 @@ const renderMenuItem = (item, index) => {
|
|
|
44
40
|
}, label);
|
|
45
41
|
};
|
|
46
42
|
renderMenuItem.displayName = "renderMenuItem";
|
|
47
|
-
const ActionBar = (
|
|
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;
|
|
43
|
+
const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush = false, className, gap = "condensed" }) => {
|
|
53
44
|
const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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,
|
|
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),
|
|
214
55
|
"data-component": "ActionBar",
|
|
215
56
|
"data-flush": flush,
|
|
216
|
-
children:
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
+
});
|
|
234
106
|
};
|
|
235
|
-
|
|
107
|
+
ActionBar.displayName = "ActionBar";
|
|
108
|
+
function useActionBarItem(ref, registryProps) {
|
|
236
109
|
var _useContext;
|
|
237
|
-
const $ = c(11);
|
|
238
110
|
const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
|
|
239
|
-
const {
|
|
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);
|
|
111
|
+
const isItemOverflowing = useIsClipped(ref, { disabled: isGroupOverflowing !== void 0 });
|
|
248
112
|
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;
|
|
263
113
|
ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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;
|
|
114
|
+
return {
|
|
115
|
+
isOverflowing,
|
|
116
|
+
dataOverflowingAttr: isOverflowing ? "" : void 0
|
|
117
|
+
};
|
|
278
118
|
}
|
|
279
|
-
const ActionBarIconButton = /*#__PURE__*/ forwardRef((
|
|
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
|
-
}
|
|
119
|
+
const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
|
|
298
120
|
const ref = useRef(null);
|
|
299
|
-
const
|
|
121
|
+
const mergedRef = useMergedRefs(forwardedRef, ref);
|
|
300
122
|
const { size } = React.useContext(ActionBarContext);
|
|
301
|
-
const
|
|
302
|
-
const {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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;
|
|
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
|
+
});
|
|
362
149
|
});
|
|
363
|
-
const ActionBarButton = /*#__PURE__*/ forwardRef((
|
|
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
|
-
}
|
|
150
|
+
const ActionBarButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
|
|
382
151
|
const ref = useRef(null);
|
|
383
|
-
const
|
|
152
|
+
const mergedRef = useMergedRefs(forwardedRef, ref);
|
|
384
153
|
const { size } = React.useContext(ActionBarContext);
|
|
385
154
|
const { children, leadingVisual } = props;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}
|
|
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;
|
|
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
|
+
});
|
|
445
180
|
});
|
|
446
181
|
const ActionBarGroupContext = /*#__PURE__*/ React.createContext(null);
|
|
447
|
-
const ActionBarGroup = /*#__PURE__*/ forwardRef((
|
|
448
|
-
const $ = c(10);
|
|
449
|
-
const { children } = t0;
|
|
182
|
+
const ActionBarGroup = /*#__PURE__*/ forwardRef(({ children }, forwardedRef) => {
|
|
450
183
|
const backupRef = useRef(null);
|
|
451
184
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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", {
|
|
185
|
+
const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, useMemo(() => ({ type: "group" }), []));
|
|
186
|
+
return /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
|
|
187
|
+
value: { isOverflowing },
|
|
188
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
467
189
|
className: ActionBar_module_css_default.Group,
|
|
468
190
|
"data-component": "ActionBar.Group",
|
|
469
191
|
ref,
|
|
470
192
|
"data-overflowing": dataOverflowingAttr,
|
|
471
193
|
children
|
|
472
|
-
})
|
|
473
|
-
|
|
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;
|
|
194
|
+
})
|
|
195
|
+
});
|
|
489
196
|
});
|
|
490
|
-
const ActionBarMenu = /*#__PURE__*/ forwardRef((
|
|
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
|
-
}
|
|
197
|
+
const ActionBarMenu = /*#__PURE__*/ forwardRef(({ "aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props }, forwardedRef) => {
|
|
515
198
|
const backupRef = useRef(null);
|
|
516
199
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
517
200
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
|
|
537
|
-
t3 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
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, {
|
|
538
219
|
variant: "invisible",
|
|
539
220
|
"aria-label": ariaLabel,
|
|
540
221
|
icon,
|
|
541
222
|
...props,
|
|
542
223
|
"data-overflowing": dataOverflowingAttr,
|
|
543
224
|
"data-component": "ActionBar.Menu.IconButton"
|
|
544
|
-
}) })
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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;
|
|
225
|
+
}) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
226
|
+
...returnFocusRef && { returnFocusRef },
|
|
227
|
+
children: /*#__PURE__*/ jsx(ActionList, { children: items.map((item, index) => renderMenuItem(item, index)) })
|
|
228
|
+
})]
|
|
229
|
+
});
|
|
594
230
|
});
|
|
595
231
|
const VerticalDivider = () => {
|
|
596
|
-
const $ = c(3);
|
|
597
232
|
const ref = useRef(null);
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
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;
|
|
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
|
+
});
|
|
617
241
|
};
|
|
618
|
-
|
|
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
|
-
}
|
|
242
|
+
VerticalDivider.displayName = "VerticalDivider";
|
|
630
243
|
//#endregion
|
|
631
244
|
export { ActionBar, ActionBarButton, ActionBarGroup, ActionBarIconButton, ActionBarMenu, VerticalDivider };
|