@primer/react 38.32.0-rc.57a990042 → 38.32.0-rc.68e0ffa22
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 +0 -10
- package/dist/ActionBar/ActionBar.js +424 -130
- package/dist/ActionList/{ActionList-1ff5220c.css → ActionList-65f7daac.css} +2 -2
- package/dist/ActionList/ActionList-65f7daac.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/Breadcrumbs/{Breadcrumbs-16d81430.css → Breadcrumbs-54395fc6.css} +2 -2
- package/dist/Breadcrumbs/{Breadcrumbs-16d81430.css.map → Breadcrumbs-54395fc6.css.map} +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +0 -1
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +2 -2
- package/dist/FilteredActionList/FilteredActionList.js +155 -66
- package/dist/FilteredActionList/useAnnouncements.js +138 -66
- package/dist/LabelGroup/LabelGroup.js +110 -76
- package/dist/Overlay/Overlay.js +169 -45
- package/dist/PageHeader/PageHeader-5e969745.css +2 -0
- package/dist/PageHeader/PageHeader-5e969745.css.map +1 -0
- package/dist/PageHeader/PageHeader.js +23 -64
- package/dist/PageHeader/PageHeader.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/TextInput/TextInput.js +7 -7
- package/dist/ToggleSwitch/ToggleSwitch.js +186 -167
- package/dist/TreeView/TreeView.js +814 -309
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-917fdaef.css.map → SelectPanel-608e207e.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +95 -38
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useMedia.js +43 -44
- package/dist/internal/components/ValidationAnimationContainer.js +34 -40
- package/package.json +1 -3
- package/dist/ActionList/ActionList-1ff5220c.css.map +0 -1
- package/dist/PageHeader/PageHeader-b12247c8.css +0 -2
- package/dist/PageHeader/PageHeader-b12247c8.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-a004561f.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-a004561f.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-917fdaef.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -17,18 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
### Patch Changes
|
|
19
19
|
|
|
20
|
-
- [#7901](https://github.com/primer/react/pull/7901) [`8288ed9`](https://github.com/primer/react/commit/8288ed9d88668f93cf3b1eb70ee61edac6217367) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageHeader: improve rendering performance by removing expensive `:has()` selectors. No visual or API changes.
|
|
21
|
-
|
|
22
|
-
- [#8115](https://github.com/primer/react/pull/8115) [`07c530a`](https://github.com/primer/react/commit/07c530a1686ef16b68b2f2fe692b7a3327bdc02b) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve rendering performance in Safari by removing expensive `:has()` selectors from ActionList/NavList, Breadcrumbs, SelectPanel, and SegmentedControl. No visual or API changes.
|
|
23
|
-
|
|
24
|
-
- [#8024](https://github.com/primer/react/pull/8024) [`18e3b7d`](https://github.com/primer/react/commit/18e3b7d7a7b54275b99d2562eb279722f5cdd60e) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ToggleSwitch: Fire `onChange` from the user interaction instead of an effect, so it no longer fires on mount or when a controlled `checked` value changes externally.
|
|
25
|
-
|
|
26
20
|
- [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
|
|
27
21
|
|
|
28
|
-
- [#8001](https://github.com/primer/react/pull/8001) [`4edc824`](https://github.com/primer/react/commit/4edc8242da557eedd41d71b242674b33254029ec) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useMedia` now reads the live `matchMedia` value on the first client render instead of after an effect, removing a redundant render pass. `defaultState` is only used for the SSR/hydration snapshot (no public API changes).
|
|
29
|
-
|
|
30
|
-
- [#8023](https://github.com/primer/react/pull/8023) [`71fa75c`](https://github.com/primer/react/commit/71fa75c861c55bf29dd30ddf4a83549bf81369f8) Thanks [@mattcosta7](https://github.com/mattcosta7)! - FormControl: Avoid an extra re-render when showing a validation message.
|
|
31
|
-
|
|
32
22
|
## 38.31.0
|
|
33
23
|
|
|
34
24
|
### Minor Changes
|
|
@@ -8,6 +8,7 @@ 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
14
|
import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
@@ -40,81 +41,188 @@ const renderMenuItem = (item, index) => {
|
|
|
40
41
|
}, label);
|
|
41
42
|
};
|
|
42
43
|
renderMenuItem.displayName = "renderMenuItem";
|
|
43
|
-
const ActionBar = (
|
|
44
|
+
const ActionBar = (t0) => {
|
|
45
|
+
const $ = c(43);
|
|
46
|
+
const { size: t1, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush: t2, className, gap: t3 } = t0;
|
|
47
|
+
const size = t1 === void 0 ? "medium" : t1;
|
|
48
|
+
const flush = t2 === void 0 ? false : t2;
|
|
49
|
+
const gap = t3 === void 0 ? "condensed" : t3;
|
|
44
50
|
const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[0] !== childRegistry) {
|
|
53
|
+
t4 = childRegistry && Array.from(childRegistry.entries()).filter(_temp);
|
|
54
|
+
$[0] = childRegistry;
|
|
55
|
+
$[1] = t4;
|
|
56
|
+
} else t4 = $[1];
|
|
57
|
+
const overflowItems = t4;
|
|
58
|
+
let t5;
|
|
59
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
60
|
+
t5 = {
|
|
61
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
62
|
+
focusOutBehavior: "wrap",
|
|
63
|
+
focusableElementFilter: _temp2
|
|
64
|
+
};
|
|
65
|
+
$[2] = t5;
|
|
66
|
+
} else t5 = $[2];
|
|
67
|
+
let t6;
|
|
68
|
+
if ($[3] !== overflowItems) {
|
|
69
|
+
t6 = [overflowItems];
|
|
70
|
+
$[3] = overflowItems;
|
|
71
|
+
$[4] = t6;
|
|
72
|
+
} else t6 = $[4];
|
|
73
|
+
const { containerRef } = useFocusZone(t5, t6);
|
|
74
|
+
let t7;
|
|
75
|
+
if ($[5] !== size) {
|
|
76
|
+
t7 = { size };
|
|
77
|
+
$[5] = size;
|
|
78
|
+
$[6] = t7;
|
|
79
|
+
} else t7 = $[6];
|
|
80
|
+
let t8;
|
|
81
|
+
if ($[7] !== className) {
|
|
82
|
+
t8 = clsx(className, ActionBar_module_css_default.Nav);
|
|
83
|
+
$[7] = className;
|
|
84
|
+
$[8] = t8;
|
|
85
|
+
} else t8 = $[8];
|
|
86
|
+
const t9 = containerRef;
|
|
87
|
+
const t10 = overflowItems ? overflowItems.length > 0 : void 0;
|
|
88
|
+
let t11;
|
|
89
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t11 = /*#__PURE__*/ jsx("div", { className: ActionBar_module_css_default.OverflowSpacer });
|
|
91
|
+
$[9] = t11;
|
|
92
|
+
} else t11 = $[9];
|
|
93
|
+
let t12;
|
|
94
|
+
if ($[10] !== children || $[11] !== setChildRegistry) {
|
|
95
|
+
t12 = /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
|
|
96
|
+
setRegistry: setChildRegistry,
|
|
97
|
+
children
|
|
98
|
+
});
|
|
99
|
+
$[10] = children;
|
|
100
|
+
$[11] = setChildRegistry;
|
|
101
|
+
$[12] = t12;
|
|
102
|
+
} else t12 = $[12];
|
|
103
|
+
let t13;
|
|
104
|
+
if ($[13] !== containerRef || $[14] !== t12) {
|
|
105
|
+
t13 = /*#__PURE__*/ jsxs("div", {
|
|
106
|
+
className: ActionBar_module_css_default.OverflowContainer,
|
|
107
|
+
children: [t11, /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
108
|
+
rootRef: containerRef,
|
|
109
|
+
children: t12
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
$[13] = containerRef;
|
|
113
|
+
$[14] = t12;
|
|
114
|
+
$[15] = t13;
|
|
115
|
+
} else t13 = $[15];
|
|
116
|
+
const t14 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
|
|
117
|
+
const t15 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true;
|
|
118
|
+
let t16;
|
|
119
|
+
if ($[16] !== size || $[17] !== t14 || $[18] !== t15) {
|
|
120
|
+
t16 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
121
|
+
variant: "invisible",
|
|
122
|
+
"aria-label": t14,
|
|
123
|
+
icon: KebabHorizontalIcon,
|
|
124
|
+
className: ActionBar_module_css_default.MoreButton,
|
|
125
|
+
"data-more-button-inactive": t15,
|
|
126
|
+
size
|
|
127
|
+
}) });
|
|
128
|
+
$[16] = size;
|
|
129
|
+
$[17] = t14;
|
|
130
|
+
$[18] = t15;
|
|
131
|
+
$[19] = t16;
|
|
132
|
+
} else t16 = $[19];
|
|
133
|
+
let t17;
|
|
134
|
+
if ($[20] !== overflowItems) {
|
|
135
|
+
t17 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
|
|
136
|
+
$[20] = overflowItems;
|
|
137
|
+
$[21] = t17;
|
|
138
|
+
} else t17 = $[21];
|
|
139
|
+
let t18;
|
|
140
|
+
if ($[22] !== t17) {
|
|
141
|
+
t18 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t17 }) });
|
|
142
|
+
$[22] = t17;
|
|
143
|
+
$[23] = t18;
|
|
144
|
+
} else t18 = $[23];
|
|
145
|
+
let t19;
|
|
146
|
+
if ($[24] !== t16 || $[25] !== t18) {
|
|
147
|
+
t19 = /*#__PURE__*/ jsxs(ActionMenu, { children: [t16, t18] });
|
|
148
|
+
$[24] = t16;
|
|
149
|
+
$[25] = t18;
|
|
150
|
+
$[26] = t19;
|
|
151
|
+
} else t19 = $[26];
|
|
152
|
+
let t20;
|
|
153
|
+
if ($[27] !== ariaLabel || $[28] !== ariaLabelledBy || $[29] !== gap || $[30] !== size || $[31] !== t10 || $[32] !== t13 || $[33] !== t19 || $[34] !== t9) {
|
|
154
|
+
t20 = /*#__PURE__*/ jsxs("div", {
|
|
155
|
+
ref: t9,
|
|
156
|
+
role: "toolbar",
|
|
157
|
+
className: ActionBar_module_css_default.List,
|
|
158
|
+
"aria-label": ariaLabel,
|
|
159
|
+
"aria-labelledby": ariaLabelledBy,
|
|
160
|
+
"data-gap": gap,
|
|
161
|
+
"data-size": size,
|
|
162
|
+
"data-has-overflow": t10,
|
|
163
|
+
children: [t13, t19]
|
|
164
|
+
});
|
|
165
|
+
$[27] = ariaLabel;
|
|
166
|
+
$[28] = ariaLabelledBy;
|
|
167
|
+
$[29] = gap;
|
|
168
|
+
$[30] = size;
|
|
169
|
+
$[31] = t10;
|
|
170
|
+
$[32] = t13;
|
|
171
|
+
$[33] = t19;
|
|
172
|
+
$[34] = t9;
|
|
173
|
+
$[35] = t20;
|
|
174
|
+
} else t20 = $[35];
|
|
175
|
+
let t21;
|
|
176
|
+
if ($[36] !== flush || $[37] !== t20 || $[38] !== t8) {
|
|
177
|
+
t21 = /*#__PURE__*/ jsx("div", {
|
|
178
|
+
className: t8,
|
|
55
179
|
"data-component": "ActionBar",
|
|
56
180
|
"data-flush": flush,
|
|
57
|
-
children:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
76
|
-
variant: "invisible",
|
|
77
|
-
"aria-label": `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`,
|
|
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
|
-
});
|
|
181
|
+
children: t20
|
|
182
|
+
});
|
|
183
|
+
$[36] = flush;
|
|
184
|
+
$[37] = t20;
|
|
185
|
+
$[38] = t8;
|
|
186
|
+
$[39] = t21;
|
|
187
|
+
} else t21 = $[39];
|
|
188
|
+
let t22;
|
|
189
|
+
if ($[40] !== t21 || $[41] !== t7) {
|
|
190
|
+
t22 = /*#__PURE__*/ jsx(ActionBarContext.Provider, {
|
|
191
|
+
value: t7,
|
|
192
|
+
children: t21
|
|
193
|
+
});
|
|
194
|
+
$[40] = t21;
|
|
195
|
+
$[41] = t7;
|
|
196
|
+
$[42] = t22;
|
|
197
|
+
} else t22 = $[42];
|
|
198
|
+
return t22;
|
|
106
199
|
};
|
|
107
|
-
ActionBar.displayName = "ActionBar";
|
|
108
200
|
function useActionBarItem(ref, registryProps) {
|
|
109
201
|
var _useContext;
|
|
202
|
+
const $ = c(5);
|
|
110
203
|
const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
|
|
111
|
-
const
|
|
204
|
+
const isInGroup = isGroupOverflowing !== void 0;
|
|
205
|
+
let t0;
|
|
206
|
+
if ($[0] !== isInGroup) {
|
|
207
|
+
t0 = { disabled: isInGroup };
|
|
208
|
+
$[0] = isInGroup;
|
|
209
|
+
$[1] = t0;
|
|
210
|
+
} else t0 = $[1];
|
|
211
|
+
const isItemOverflowing = useIsClipped(ref, t0);
|
|
112
212
|
const isOverflowing = isGroupOverflowing || isItemOverflowing;
|
|
113
213
|
ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
214
|
+
const t1 = isOverflowing ? "" : void 0;
|
|
215
|
+
let t2;
|
|
216
|
+
if ($[2] !== isOverflowing || $[3] !== t1) {
|
|
217
|
+
t2 = {
|
|
218
|
+
isOverflowing,
|
|
219
|
+
dataOverflowingAttr: t1
|
|
220
|
+
};
|
|
221
|
+
$[2] = isOverflowing;
|
|
222
|
+
$[3] = t1;
|
|
223
|
+
$[4] = t2;
|
|
224
|
+
} else t2 = $[4];
|
|
225
|
+
return t2;
|
|
118
226
|
}
|
|
119
227
|
const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
|
|
120
228
|
const ref = useRef(null);
|
|
@@ -146,97 +254,283 @@ const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...pr
|
|
|
146
254
|
"data-overflowing": dataOverflowingAttr
|
|
147
255
|
});
|
|
148
256
|
});
|
|
149
|
-
const ActionBarButton = /*#__PURE__*/ forwardRef((
|
|
257
|
+
const ActionBarButton = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
258
|
+
const $ = c(19);
|
|
259
|
+
let disabled;
|
|
260
|
+
let onClick;
|
|
261
|
+
let props;
|
|
262
|
+
if ($[0] !== t0) {
|
|
263
|
+
({disabled, onClick, ...props} = t0);
|
|
264
|
+
$[0] = t0;
|
|
265
|
+
$[1] = disabled;
|
|
266
|
+
$[2] = onClick;
|
|
267
|
+
$[3] = props;
|
|
268
|
+
} else {
|
|
269
|
+
disabled = $[1];
|
|
270
|
+
onClick = $[2];
|
|
271
|
+
props = $[3];
|
|
272
|
+
}
|
|
150
273
|
const ref = useRef(null);
|
|
151
274
|
const mergedRef = useMergedRefs(forwardedRef, ref);
|
|
152
275
|
const { size } = React.useContext(ActionBarContext);
|
|
153
276
|
const { children, leadingVisual } = props;
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
277
|
+
const t1 = typeof leadingVisual === "function" ? leadingVisual : void 0;
|
|
278
|
+
const t2 = !!disabled;
|
|
279
|
+
const t3 = onClick;
|
|
280
|
+
let t4;
|
|
281
|
+
if ($[4] !== children || $[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
|
|
282
|
+
t4 = {
|
|
283
|
+
type: "action",
|
|
284
|
+
label: children,
|
|
285
|
+
icon: t1,
|
|
286
|
+
disabled: t2,
|
|
287
|
+
onClick: t3
|
|
288
|
+
};
|
|
289
|
+
$[4] = children;
|
|
290
|
+
$[5] = t1;
|
|
291
|
+
$[6] = t2;
|
|
292
|
+
$[7] = t3;
|
|
293
|
+
$[8] = t4;
|
|
294
|
+
} else t4 = $[8];
|
|
295
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, t4);
|
|
296
|
+
let t5;
|
|
297
|
+
if ($[9] !== disabled || $[10] !== onClick) {
|
|
298
|
+
t5 = (event) => {
|
|
299
|
+
var _onClick;
|
|
171
300
|
if (disabled) return;
|
|
172
|
-
onClick === null ||
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
301
|
+
(_onClick = onClick) === null || _onClick === void 0 || _onClick(event);
|
|
302
|
+
};
|
|
303
|
+
$[9] = disabled;
|
|
304
|
+
$[10] = onClick;
|
|
305
|
+
$[11] = t5;
|
|
306
|
+
} else t5 = $[11];
|
|
307
|
+
const clickHandler = t5;
|
|
308
|
+
let t6;
|
|
309
|
+
if ($[12] !== clickHandler || $[13] !== dataOverflowingAttr || $[14] !== disabled || $[15] !== mergedRef || $[16] !== props || $[17] !== size) {
|
|
310
|
+
t6 = /*#__PURE__*/ jsx(ButtonComponent, {
|
|
311
|
+
"aria-disabled": disabled,
|
|
312
|
+
ref: mergedRef,
|
|
313
|
+
size,
|
|
314
|
+
onClick: clickHandler,
|
|
315
|
+
...props,
|
|
316
|
+
variant: "invisible",
|
|
317
|
+
"data-overflowing": dataOverflowingAttr
|
|
318
|
+
});
|
|
319
|
+
$[12] = clickHandler;
|
|
320
|
+
$[13] = dataOverflowingAttr;
|
|
321
|
+
$[14] = disabled;
|
|
322
|
+
$[15] = mergedRef;
|
|
323
|
+
$[16] = props;
|
|
324
|
+
$[17] = size;
|
|
325
|
+
$[18] = t6;
|
|
326
|
+
} else t6 = $[18];
|
|
327
|
+
return t6;
|
|
178
328
|
});
|
|
179
329
|
const ActionBarGroupContext = /*#__PURE__*/ React.createContext(null);
|
|
180
|
-
const ActionBarGroup = /*#__PURE__*/ forwardRef((
|
|
330
|
+
const ActionBarGroup = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
331
|
+
const $ = c(10);
|
|
332
|
+
const { children } = t0;
|
|
181
333
|
const backupRef = useRef(null);
|
|
182
334
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
335
|
+
let t1;
|
|
336
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
337
|
+
t1 = { type: "group" };
|
|
338
|
+
$[0] = t1;
|
|
339
|
+
} else t1 = $[0];
|
|
340
|
+
const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, t1);
|
|
341
|
+
let t2;
|
|
342
|
+
if ($[1] !== isOverflowing) {
|
|
343
|
+
t2 = { isOverflowing };
|
|
344
|
+
$[1] = isOverflowing;
|
|
345
|
+
$[2] = t2;
|
|
346
|
+
} else t2 = $[2];
|
|
347
|
+
let t3;
|
|
348
|
+
if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
|
|
349
|
+
t3 = /*#__PURE__*/ jsx("div", {
|
|
187
350
|
className: ActionBar_module_css_default.Group,
|
|
188
351
|
"data-component": "ActionBar.Group",
|
|
189
352
|
ref,
|
|
190
353
|
"data-overflowing": dataOverflowingAttr,
|
|
191
354
|
children
|
|
192
|
-
})
|
|
193
|
-
|
|
355
|
+
});
|
|
356
|
+
$[3] = children;
|
|
357
|
+
$[4] = dataOverflowingAttr;
|
|
358
|
+
$[5] = ref;
|
|
359
|
+
$[6] = t3;
|
|
360
|
+
} else t3 = $[6];
|
|
361
|
+
let t4;
|
|
362
|
+
if ($[7] !== t2 || $[8] !== t3) {
|
|
363
|
+
t4 = /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
|
|
364
|
+
value: t2,
|
|
365
|
+
children: t3
|
|
366
|
+
});
|
|
367
|
+
$[7] = t2;
|
|
368
|
+
$[8] = t3;
|
|
369
|
+
$[9] = t4;
|
|
370
|
+
} else t4 = $[9];
|
|
371
|
+
return t4;
|
|
194
372
|
});
|
|
195
|
-
const ActionBarMenu = /*#__PURE__*/ forwardRef((
|
|
373
|
+
const ActionBarMenu = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
374
|
+
const $ = c(31);
|
|
375
|
+
let ariaLabel;
|
|
376
|
+
let icon;
|
|
377
|
+
let items;
|
|
378
|
+
let overflowIcon;
|
|
379
|
+
let props;
|
|
380
|
+
let returnFocusRef;
|
|
381
|
+
if ($[0] !== t0) {
|
|
382
|
+
({"aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props} = t0);
|
|
383
|
+
$[0] = t0;
|
|
384
|
+
$[1] = ariaLabel;
|
|
385
|
+
$[2] = icon;
|
|
386
|
+
$[3] = items;
|
|
387
|
+
$[4] = overflowIcon;
|
|
388
|
+
$[5] = props;
|
|
389
|
+
$[6] = returnFocusRef;
|
|
390
|
+
} else {
|
|
391
|
+
ariaLabel = $[1];
|
|
392
|
+
icon = $[2];
|
|
393
|
+
items = $[3];
|
|
394
|
+
overflowIcon = $[4];
|
|
395
|
+
props = $[5];
|
|
396
|
+
returnFocusRef = $[6];
|
|
397
|
+
}
|
|
196
398
|
const backupRef = useRef(null);
|
|
197
399
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
198
400
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
401
|
+
const t1 = overflowIcon ? overflowIcon : icon;
|
|
402
|
+
let t2;
|
|
403
|
+
if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1) {
|
|
404
|
+
t2 = {
|
|
405
|
+
type: "menu",
|
|
406
|
+
label: ariaLabel,
|
|
407
|
+
icon: t1,
|
|
408
|
+
returnFocusRef,
|
|
409
|
+
items
|
|
410
|
+
};
|
|
411
|
+
$[7] = ariaLabel;
|
|
412
|
+
$[8] = items;
|
|
413
|
+
$[9] = returnFocusRef;
|
|
414
|
+
$[10] = t1;
|
|
415
|
+
$[11] = t2;
|
|
416
|
+
} else t2 = $[11];
|
|
417
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, t2);
|
|
418
|
+
let t3;
|
|
419
|
+
if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
|
|
420
|
+
t3 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
217
421
|
variant: "invisible",
|
|
218
422
|
"aria-label": ariaLabel,
|
|
219
423
|
icon,
|
|
220
424
|
...props,
|
|
221
425
|
"data-overflowing": dataOverflowingAttr,
|
|
222
426
|
"data-component": "ActionBar.Menu.IconButton"
|
|
223
|
-
}) })
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
427
|
+
}) });
|
|
428
|
+
$[12] = ariaLabel;
|
|
429
|
+
$[13] = dataOverflowingAttr;
|
|
430
|
+
$[14] = icon;
|
|
431
|
+
$[15] = props;
|
|
432
|
+
$[16] = t3;
|
|
433
|
+
} else t3 = $[16];
|
|
434
|
+
let t4;
|
|
435
|
+
if ($[17] !== returnFocusRef) {
|
|
436
|
+
t4 = returnFocusRef && { returnFocusRef };
|
|
437
|
+
$[17] = returnFocusRef;
|
|
438
|
+
$[18] = t4;
|
|
439
|
+
} else t4 = $[18];
|
|
440
|
+
let t5;
|
|
441
|
+
if ($[19] !== items) {
|
|
442
|
+
t5 = items.map(_temp5);
|
|
443
|
+
$[19] = items;
|
|
444
|
+
$[20] = t5;
|
|
445
|
+
} else t5 = $[20];
|
|
446
|
+
let t6;
|
|
447
|
+
if ($[21] !== t5) {
|
|
448
|
+
t6 = /*#__PURE__*/ jsx(ActionList, { children: t5 });
|
|
449
|
+
$[21] = t5;
|
|
450
|
+
$[22] = t6;
|
|
451
|
+
} else t6 = $[22];
|
|
452
|
+
let t7;
|
|
453
|
+
if ($[23] !== t4 || $[24] !== t6) {
|
|
454
|
+
t7 = /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
455
|
+
...t4,
|
|
456
|
+
children: t6
|
|
457
|
+
});
|
|
458
|
+
$[23] = t4;
|
|
459
|
+
$[24] = t6;
|
|
460
|
+
$[25] = t7;
|
|
461
|
+
} else t7 = $[25];
|
|
462
|
+
let t8;
|
|
463
|
+
if ($[26] !== menuOpen || $[27] !== ref || $[28] !== t3 || $[29] !== t7) {
|
|
464
|
+
t8 = /*#__PURE__*/ jsxs(ActionMenu, {
|
|
465
|
+
anchorRef: ref,
|
|
466
|
+
open: menuOpen,
|
|
467
|
+
onOpenChange: setMenuOpen,
|
|
468
|
+
children: [t3, t7]
|
|
469
|
+
});
|
|
470
|
+
$[26] = menuOpen;
|
|
471
|
+
$[27] = ref;
|
|
472
|
+
$[28] = t3;
|
|
473
|
+
$[29] = t7;
|
|
474
|
+
$[30] = t8;
|
|
475
|
+
} else t8 = $[30];
|
|
476
|
+
return t8;
|
|
228
477
|
});
|
|
229
478
|
const VerticalDivider = () => {
|
|
479
|
+
const $ = c(3);
|
|
230
480
|
const ref = useRef(null);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
481
|
+
let t0;
|
|
482
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
483
|
+
t0 = { type: "divider" };
|
|
484
|
+
$[0] = t0;
|
|
485
|
+
} else t0 = $[0];
|
|
486
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, t0);
|
|
487
|
+
let t1;
|
|
488
|
+
if ($[1] !== dataOverflowingAttr) {
|
|
489
|
+
t1 = /*#__PURE__*/ jsx("div", {
|
|
490
|
+
ref,
|
|
491
|
+
"data-component": "ActionBar.VerticalDivider",
|
|
492
|
+
"aria-hidden": "true",
|
|
493
|
+
className: ActionBar_module_css_default.Divider,
|
|
494
|
+
"data-overflowing": dataOverflowingAttr
|
|
495
|
+
});
|
|
496
|
+
$[1] = dataOverflowingAttr;
|
|
497
|
+
$[2] = t1;
|
|
498
|
+
} else t1 = $[2];
|
|
499
|
+
return t1;
|
|
239
500
|
};
|
|
240
|
-
|
|
501
|
+
function _temp(entry) {
|
|
502
|
+
return entry[1] !== null;
|
|
503
|
+
}
|
|
504
|
+
function _temp2(element) {
|
|
505
|
+
return element.matches(FOCUSABLE_ITEM_SELECTOR);
|
|
506
|
+
}
|
|
507
|
+
function _temp3(item, index) {
|
|
508
|
+
return renderMenuItem(item, index);
|
|
509
|
+
}
|
|
510
|
+
function _temp4(t0) {
|
|
511
|
+
const [id, menuItem] = t0;
|
|
512
|
+
if (menuItem.type === "divider") return /*#__PURE__*/ jsx(ActionList.Divider, {}, id);
|
|
513
|
+
if (menuItem.type === "action") {
|
|
514
|
+
const { onClick, icon: Icon, label, disabled } = menuItem;
|
|
515
|
+
return /*#__PURE__*/ jsxs(ActionList.Item, {
|
|
516
|
+
onSelect: (event) => {
|
|
517
|
+
typeof onClick === "function" && onClick(event);
|
|
518
|
+
},
|
|
519
|
+
disabled,
|
|
520
|
+
children: [Icon ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label]
|
|
521
|
+
}, id);
|
|
522
|
+
}
|
|
523
|
+
if (menuItem.type === "menu") {
|
|
524
|
+
const menuItems = menuItem.items;
|
|
525
|
+
const { icon: Icon_0, label: label_0, returnFocusRef } = menuItem;
|
|
526
|
+
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, {
|
|
527
|
+
...returnFocusRef && { returnFocusRef },
|
|
528
|
+
children: /*#__PURE__*/ jsx(ActionList, { children: menuItems.map(_temp3) })
|
|
529
|
+
})] }, id);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function _temp5(item, index) {
|
|
533
|
+
return renderMenuItem(item, index);
|
|
534
|
+
}
|
|
241
535
|
//#endregion
|
|
242
536
|
export { ActionBar, ActionBarButton, ActionBarGroup, ActionBarIconButton, ActionBarMenu, VerticalDivider };
|