@primer/react 0.0.0-20260218182609 → 0.0.0-20260218205658
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 +4 -24
- package/dist/ActionList/Description.js +35 -113
- package/dist/ActionList/Divider.js +11 -30
- package/dist/ActionList/Group.js +117 -294
- package/dist/ActionList/Heading.js +22 -77
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +209 -679
- package/dist/ActionList/LinkItem.js +24 -80
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +33 -144
- package/dist/ActionList/Selection.js +30 -78
- package/dist/ActionList/TrailingAction.js +23 -83
- package/dist/ActionList/Visuals.js +64 -162
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +62 -72
- package/dist/Button/Button.js +11 -34
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +14 -9
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/PageLayout/PageLayout-06f4c069.css +2 -0
- package/dist/PageLayout/PageLayout-06f4c069.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +71 -2
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +498 -44
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +16 -4
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +123 -109
- package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
- package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
- package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +4 -11
- package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-f0c4b9ca.css.map → SelectPanel-1f8c23b5.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useIsMacOS.d.ts +3 -15
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +26 -24
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/live-region/Announce.d.ts.map +1 -1
- package/dist/live-region/Announce.js +4 -7
- package/dist/utils/environment.js +9 -0
- package/generated/components.json +200 -2
- package/package.json +2 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +0 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
- package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
package/dist/ActionList/Item.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { useId } from '../hooks/useId.js';
|
|
4
3
|
import { useSlots } from '../hooks/useSlots.js';
|
|
@@ -17,223 +16,81 @@ import { clsx } from 'clsx';
|
|
|
17
16
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
18
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
18
|
|
|
20
|
-
const SubItem =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if ($[0] !== children) {
|
|
27
|
-
t1 = /*#__PURE__*/jsx(Fragment, {
|
|
28
|
-
children: children
|
|
29
|
-
});
|
|
30
|
-
$[0] = children;
|
|
31
|
-
$[1] = t1;
|
|
32
|
-
} else {
|
|
33
|
-
t1 = $[1];
|
|
34
|
-
}
|
|
35
|
-
return t1;
|
|
19
|
+
const SubItem = ({
|
|
20
|
+
children
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
36
25
|
};
|
|
37
26
|
SubItem.displayName = 'ActionList.SubItem';
|
|
38
|
-
const ButtonItemContainerNoBox = /*#__PURE__*/React.forwardRef((
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
$[1] = children;
|
|
51
|
-
$[2] = props;
|
|
52
|
-
$[3] = style;
|
|
53
|
-
} else {
|
|
54
|
-
children = $[1];
|
|
55
|
-
props = $[2];
|
|
56
|
-
style = $[3];
|
|
57
|
-
}
|
|
58
|
-
const t1 = forwardedRef;
|
|
59
|
-
let t2;
|
|
60
|
-
if ($[4] !== children || $[5] !== props || $[6] !== style || $[7] !== t1) {
|
|
61
|
-
t2 = /*#__PURE__*/jsx("button", {
|
|
62
|
-
type: "button",
|
|
63
|
-
ref: t1,
|
|
64
|
-
style: style,
|
|
65
|
-
...props,
|
|
66
|
-
children: children
|
|
67
|
-
});
|
|
68
|
-
$[4] = children;
|
|
69
|
-
$[5] = props;
|
|
70
|
-
$[6] = style;
|
|
71
|
-
$[7] = t1;
|
|
72
|
-
$[8] = t2;
|
|
73
|
-
} else {
|
|
74
|
-
t2 = $[8];
|
|
75
|
-
}
|
|
76
|
-
return t2;
|
|
27
|
+
const ButtonItemContainerNoBox = /*#__PURE__*/React.forwardRef(({
|
|
28
|
+
children,
|
|
29
|
+
style,
|
|
30
|
+
...props
|
|
31
|
+
}, forwardedRef) => {
|
|
32
|
+
return /*#__PURE__*/jsx("button", {
|
|
33
|
+
type: "button",
|
|
34
|
+
ref: forwardedRef,
|
|
35
|
+
style: style,
|
|
36
|
+
...props,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
77
39
|
});
|
|
78
|
-
const DivItemContainerNoBox = /*#__PURE__*/React.forwardRef((
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
$[0] = t0;
|
|
88
|
-
$[1] = children;
|
|
89
|
-
$[2] = props;
|
|
90
|
-
} else {
|
|
91
|
-
children = $[1];
|
|
92
|
-
props = $[2];
|
|
93
|
-
}
|
|
94
|
-
const t1 = forwardedRef;
|
|
95
|
-
let t2;
|
|
96
|
-
if ($[3] !== children || $[4] !== props || $[5] !== t1) {
|
|
97
|
-
t2 = /*#__PURE__*/jsx("div", {
|
|
98
|
-
ref: t1,
|
|
99
|
-
...props,
|
|
100
|
-
children: children
|
|
101
|
-
});
|
|
102
|
-
$[3] = children;
|
|
103
|
-
$[4] = props;
|
|
104
|
-
$[5] = t1;
|
|
105
|
-
$[6] = t2;
|
|
106
|
-
} else {
|
|
107
|
-
t2 = $[6];
|
|
108
|
-
}
|
|
109
|
-
return t2;
|
|
40
|
+
const DivItemContainerNoBox = /*#__PURE__*/React.forwardRef(({
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}, forwardedRef) => {
|
|
44
|
+
return /*#__PURE__*/jsx("div", {
|
|
45
|
+
ref: forwardedRef,
|
|
46
|
+
...props,
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
110
49
|
});
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
50
|
+
const UnwrappedItem = ({
|
|
51
|
+
variant = 'default',
|
|
52
|
+
size = 'medium',
|
|
53
|
+
disabled = false,
|
|
54
|
+
inactiveText,
|
|
55
|
+
selected = undefined,
|
|
56
|
+
active = false,
|
|
57
|
+
onSelect: onSelectUser,
|
|
58
|
+
id,
|
|
59
|
+
role,
|
|
60
|
+
loading,
|
|
61
|
+
_PrivateItemWrapper,
|
|
62
|
+
className,
|
|
63
|
+
groupId: _groupId,
|
|
64
|
+
renderItem: _renderItem,
|
|
65
|
+
handleAddItem: _handleAddItem,
|
|
66
|
+
...props
|
|
67
|
+
}, forwardedRef) => {
|
|
126
68
|
var _slots$trailingVisual, _slots$description$pr, _slots$description;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if ($[0] !== t0) {
|
|
142
|
-
const {
|
|
143
|
-
variant: t6,
|
|
144
|
-
size: t7,
|
|
145
|
-
disabled: t8,
|
|
146
|
-
inactiveText: t9,
|
|
147
|
-
selected: t10,
|
|
148
|
-
active: t11,
|
|
149
|
-
onSelect: t12,
|
|
150
|
-
id: t13,
|
|
151
|
-
role: t14,
|
|
152
|
-
loading: t15,
|
|
153
|
-
_PrivateItemWrapper: t16,
|
|
154
|
-
className: t17,
|
|
155
|
-
groupId: _groupId,
|
|
156
|
-
renderItem: _renderItem,
|
|
157
|
-
handleAddItem: _handleAddItem,
|
|
158
|
-
...t18
|
|
159
|
-
} = t0;
|
|
160
|
-
t1 = t6;
|
|
161
|
-
t2 = t7;
|
|
162
|
-
t3 = t8;
|
|
163
|
-
inactiveText = t9;
|
|
164
|
-
t4 = t10;
|
|
165
|
-
t5 = t11;
|
|
166
|
-
onSelectUser = t12;
|
|
167
|
-
id = t13;
|
|
168
|
-
role = t14;
|
|
169
|
-
loading = t15;
|
|
170
|
-
_PrivateItemWrapper = t16;
|
|
171
|
-
className = t17;
|
|
172
|
-
props = t18;
|
|
173
|
-
$[0] = t0;
|
|
174
|
-
$[1] = _PrivateItemWrapper;
|
|
175
|
-
$[2] = className;
|
|
176
|
-
$[3] = id;
|
|
177
|
-
$[4] = inactiveText;
|
|
178
|
-
$[5] = loading;
|
|
179
|
-
$[6] = onSelectUser;
|
|
180
|
-
$[7] = props;
|
|
181
|
-
$[8] = role;
|
|
182
|
-
$[9] = t1;
|
|
183
|
-
$[10] = t2;
|
|
184
|
-
$[11] = t3;
|
|
185
|
-
$[12] = t4;
|
|
186
|
-
$[13] = t5;
|
|
187
|
-
} else {
|
|
188
|
-
_PrivateItemWrapper = $[1];
|
|
189
|
-
className = $[2];
|
|
190
|
-
id = $[3];
|
|
191
|
-
inactiveText = $[4];
|
|
192
|
-
loading = $[5];
|
|
193
|
-
onSelectUser = $[6];
|
|
194
|
-
props = $[7];
|
|
195
|
-
role = $[8];
|
|
196
|
-
t1 = $[9];
|
|
197
|
-
t2 = $[10];
|
|
198
|
-
t3 = $[11];
|
|
199
|
-
t4 = $[12];
|
|
200
|
-
t5 = $[13];
|
|
201
|
-
}
|
|
202
|
-
const variant = t1 === undefined ? "default" : t1;
|
|
203
|
-
const size = t2 === undefined ? "medium" : t2;
|
|
204
|
-
const disabled = t3 === undefined ? false : t3;
|
|
205
|
-
const selected = t4 === undefined ? undefined : t4;
|
|
206
|
-
const active = t5 === undefined ? false : t5;
|
|
207
|
-
const [partialSlots, childrenWithoutSlots] = useSlots(props.children, slotsConfig);
|
|
208
|
-
let t6;
|
|
209
|
-
if ($[14] !== partialSlots) {
|
|
210
|
-
t6 = {
|
|
211
|
-
description: undefined,
|
|
212
|
-
...partialSlots
|
|
213
|
-
};
|
|
214
|
-
$[14] = partialSlots;
|
|
215
|
-
$[15] = t6;
|
|
216
|
-
} else {
|
|
217
|
-
t6 = $[15];
|
|
218
|
-
}
|
|
219
|
-
const slots = t6;
|
|
69
|
+
const baseSlots = {
|
|
70
|
+
leadingVisual: LeadingVisual,
|
|
71
|
+
trailingVisual: TrailingVisual,
|
|
72
|
+
trailingAction: TrailingAction,
|
|
73
|
+
subItem: SubItem
|
|
74
|
+
};
|
|
75
|
+
const [partialSlots, childrenWithoutSlots] = useSlots(props.children, {
|
|
76
|
+
...baseSlots,
|
|
77
|
+
description: Description
|
|
78
|
+
});
|
|
79
|
+
const slots = {
|
|
80
|
+
description: undefined,
|
|
81
|
+
...partialSlots
|
|
82
|
+
};
|
|
220
83
|
const {
|
|
221
84
|
container,
|
|
222
85
|
afterSelect,
|
|
223
86
|
selectionAttribute,
|
|
224
87
|
defaultTrailingVisual
|
|
225
88
|
} = React.useContext(ActionListContainerContext);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
$[16] = defaultTrailingVisual;
|
|
232
|
-
$[17] = t7;
|
|
233
|
-
} else {
|
|
234
|
-
t7 = $[17];
|
|
235
|
-
}
|
|
236
|
-
const wrappedDefaultTrailingVisual = t7;
|
|
89
|
+
|
|
90
|
+
// Be sure to avoid rendering the container unless there is a default
|
|
91
|
+
const wrappedDefaultTrailingVisual = defaultTrailingVisual ? /*#__PURE__*/jsx(TrailingVisual, {
|
|
92
|
+
children: defaultTrailingVisual
|
|
93
|
+
}) : null;
|
|
237
94
|
const trailingVisual = (_slots$trailingVisual = slots.trailingVisual) !== null && _slots$trailingVisual !== void 0 ? _slots$trailingVisual : wrappedDefaultTrailingVisual;
|
|
238
95
|
const {
|
|
239
96
|
role: listRole,
|
|
@@ -243,127 +100,57 @@ const UnwrappedItem = (t0, forwardedRef) => {
|
|
|
243
100
|
selectionVariant: groupSelectionVariant
|
|
244
101
|
} = React.useContext(GroupContext);
|
|
245
102
|
const inactive = Boolean(inactiveText);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
const showInactiveIndicator = t8;
|
|
257
|
-
let t9;
|
|
258
|
-
if ($[21] !== onSelectUser) {
|
|
259
|
-
t9 = (event, afterSelect_0) => {
|
|
260
|
-
if (typeof onSelectUser === "function") {
|
|
261
|
-
onSelectUser(event);
|
|
262
|
-
}
|
|
263
|
-
if (event.defaultPrevented) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
if (typeof afterSelect_0 === "function") {
|
|
267
|
-
afterSelect_0(event);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
$[21] = onSelectUser;
|
|
271
|
-
$[22] = t9;
|
|
272
|
-
} else {
|
|
273
|
-
t9 = $[22];
|
|
274
|
-
}
|
|
275
|
-
const onSelect = t9;
|
|
103
|
+
// TODO change `menuContext` check to ```listRole !== undefined && ['menu', 'listbox'].includes(listRole)```
|
|
104
|
+
// once we have a better way to handle existing usage in dotcom that incorrectly use ActionList.TrailingAction
|
|
105
|
+
const menuContext = container === 'ActionMenu' || container === 'SelectPanel' || container === 'FilteredActionList';
|
|
106
|
+
// TODO: when we change `menuContext` to check `listRole` instead of `container`
|
|
107
|
+
const showInactiveIndicator = inactive && !(listRole !== undefined && ['menu', 'listbox'].includes(listRole));
|
|
108
|
+
const onSelect = React.useCallback((event, afterSelect) => {
|
|
109
|
+
if (typeof onSelectUser === 'function') onSelectUser(event);
|
|
110
|
+
if (event.defaultPrevented) return;
|
|
111
|
+
if (typeof afterSelect === 'function') afterSelect(event);
|
|
112
|
+
}, [onSelectUser]);
|
|
276
113
|
const selectionVariant = groupSelectionVariant ? groupSelectionVariant : listSelectionVariant;
|
|
114
|
+
|
|
115
|
+
/** Infer item role based on the container */
|
|
277
116
|
let inferredItemRole;
|
|
278
|
-
if (container ===
|
|
279
|
-
if (selectionVariant ===
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
} else {
|
|
285
|
-
inferredItemRole = "menuitem";
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
} else {
|
|
289
|
-
if (listRole === "listbox") {
|
|
290
|
-
if (selectionVariant !== undefined && !role) {
|
|
291
|
-
inferredItemRole = "option";
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
if (listRole === "tablist") {
|
|
295
|
-
inferredItemRole = "tab";
|
|
296
|
-
}
|
|
297
|
-
}
|
|
117
|
+
if (container === 'ActionMenu') {
|
|
118
|
+
if (selectionVariant === 'single') inferredItemRole = 'menuitemradio';else if (selectionVariant === 'multiple') inferredItemRole = 'menuitemcheckbox';else inferredItemRole = 'menuitem';
|
|
119
|
+
} else if (listRole === 'listbox') {
|
|
120
|
+
if (selectionVariant !== undefined && !role) inferredItemRole = 'option';
|
|
121
|
+
} else if (listRole === 'tablist') {
|
|
122
|
+
inferredItemRole = 'tab';
|
|
298
123
|
}
|
|
299
124
|
const itemRole = role || inferredItemRole;
|
|
300
125
|
if (slots.trailingAction) {
|
|
301
|
-
!!menuContext ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
126
|
+
!!menuContext ? process.env.NODE_ENV !== "production" ? invariant(false, `ActionList.TrailingAction can not be used within a list with an ARIA role of "menu" or "listbox".`) : invariant(false) : void 0;
|
|
302
127
|
}
|
|
128
|
+
|
|
129
|
+
/** Infer the proper selection attribute based on the item's role */
|
|
303
130
|
let inferredSelectionAttribute;
|
|
304
|
-
if (itemRole ===
|
|
305
|
-
inferredSelectionAttribute = "aria-checked";
|
|
306
|
-
} else {
|
|
307
|
-
if (itemRole === "option") {
|
|
308
|
-
inferredSelectionAttribute = "aria-selected";
|
|
309
|
-
}
|
|
310
|
-
}
|
|
131
|
+
if (itemRole === 'menuitemradio' || itemRole === 'menuitemcheckbox') inferredSelectionAttribute = 'aria-checked';else if (itemRole === 'option') inferredSelectionAttribute = 'aria-selected';
|
|
311
132
|
const itemSelectionAttribute = selectionAttribute || inferredSelectionAttribute;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
$[23] = inactive;
|
|
317
|
-
$[24] = listItemSemantics;
|
|
318
|
-
$[25] = listRole;
|
|
319
|
-
$[26] = t10;
|
|
320
|
-
} else {
|
|
321
|
-
t10 = $[26];
|
|
322
|
-
}
|
|
323
|
-
const listSemantics = t10;
|
|
133
|
+
// Ensures ActionList.Item retains list item semantics if a valid ARIA role is applied, or if item is inactive
|
|
134
|
+
const listItemSemantics = itemRole === 'option' || itemRole === 'menuitem' || itemRole === 'menuitemradio' || itemRole === 'menuitemcheckbox' || itemRole === 'tab';
|
|
135
|
+
const listRoleTypes = ['listbox', 'menu', 'list'];
|
|
136
|
+
const listSemantics = listRole && listRoleTypes.includes(listRole) || inactive || listItemSemantics;
|
|
324
137
|
const buttonSemantics = !listSemantics && !_PrivateItemWrapper;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
$[31] = onSelect;
|
|
338
|
-
$[32] = t11;
|
|
339
|
-
} else {
|
|
340
|
-
t11 = $[32];
|
|
341
|
-
}
|
|
342
|
-
const clickHandler = t11;
|
|
343
|
-
let t12;
|
|
344
|
-
if ($[33] !== afterSelect || $[34] !== disabled || $[35] !== inactive || $[36] !== loading || $[37] !== onSelect) {
|
|
345
|
-
t12 = event_1 => {
|
|
346
|
-
if (disabled || inactive || loading) {
|
|
347
|
-
return;
|
|
138
|
+
const clickHandler = React.useCallback(event => {
|
|
139
|
+
if (disabled || inactive || loading) return;
|
|
140
|
+
onSelect(event, afterSelect);
|
|
141
|
+
}, [onSelect, disabled, inactive, afterSelect, loading]);
|
|
142
|
+
const keyPressHandler = React.useCallback(event => {
|
|
143
|
+
if (disabled || inactive || loading) return;
|
|
144
|
+
if ([' ', 'Enter'].includes(event.key)) {
|
|
145
|
+
if (event.key === ' ') {
|
|
146
|
+
event.preventDefault(); // prevent scrolling on Space
|
|
147
|
+
// immediately reset defaultPrevented once its job is done
|
|
148
|
+
// so as to not disturb the functions that use that event after this
|
|
149
|
+
event.defaultPrevented = false;
|
|
348
150
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
event_1.defaultPrevented = false;
|
|
353
|
-
}
|
|
354
|
-
onSelect(event_1, afterSelect);
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
$[33] = afterSelect;
|
|
358
|
-
$[34] = disabled;
|
|
359
|
-
$[35] = inactive;
|
|
360
|
-
$[36] = loading;
|
|
361
|
-
$[37] = onSelect;
|
|
362
|
-
$[38] = t12;
|
|
363
|
-
} else {
|
|
364
|
-
t12 = $[38];
|
|
365
|
-
}
|
|
366
|
-
const keyPressHandler = t12;
|
|
151
|
+
onSelect(event, afterSelect);
|
|
152
|
+
}
|
|
153
|
+
}, [onSelect, disabled, loading, inactive, afterSelect]);
|
|
367
154
|
const itemId = useId(id);
|
|
368
155
|
const labelId = `${itemId}--label`;
|
|
369
156
|
const inlineDescriptionId = `${itemId}--inline-description`;
|
|
@@ -372,377 +159,120 @@ const UnwrappedItem = (t0, forwardedRef) => {
|
|
|
372
159
|
const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
|
|
373
160
|
const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
|
|
374
161
|
const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
t13 = $[41];
|
|
383
|
-
}
|
|
384
|
-
const includeSelectionAttribute = t13;
|
|
385
|
-
const focusable = showInactiveIndicator ? true : undefined;
|
|
386
|
-
const descriptionVariant = (_slots$description$pr = (_slots$description = slots.description) === null || _slots$description === void 0 ? void 0 : _slots$description.props.variant) !== null && _slots$description$pr !== void 0 ? _slots$description$pr : "inline";
|
|
387
|
-
const hasTrailingVisualSlot = Boolean(slots.trailingVisual);
|
|
388
|
-
const hasDescriptionSlot = Boolean(slots.description);
|
|
389
|
-
let parts;
|
|
390
|
-
if ($[42] !== descriptionVariant || $[43] !== hasDescriptionSlot || $[44] !== hasTrailingVisualSlot || $[45] !== inlineDescriptionId || $[46] !== labelId || $[47] !== trailingVisualId) {
|
|
391
|
-
parts = [labelId];
|
|
392
|
-
if (hasTrailingVisualSlot) {
|
|
393
|
-
parts.push(trailingVisualId);
|
|
394
|
-
}
|
|
395
|
-
if (hasDescriptionSlot && descriptionVariant === "inline") {
|
|
396
|
-
parts.push(inlineDescriptionId);
|
|
397
|
-
}
|
|
398
|
-
$[42] = descriptionVariant;
|
|
399
|
-
$[43] = hasDescriptionSlot;
|
|
400
|
-
$[44] = hasTrailingVisualSlot;
|
|
401
|
-
$[45] = inlineDescriptionId;
|
|
402
|
-
$[46] = labelId;
|
|
403
|
-
$[47] = trailingVisualId;
|
|
404
|
-
$[48] = parts;
|
|
405
|
-
} else {
|
|
406
|
-
parts = $[48];
|
|
407
|
-
}
|
|
408
|
-
const ariaLabelledBy = parts.join(" ");
|
|
409
|
-
let parts_0;
|
|
410
|
-
if ($[49] !== blockDescriptionId || $[50] !== descriptionVariant || $[51] !== hasDescriptionSlot || $[52] !== inactiveWarningId) {
|
|
411
|
-
parts_0 = [];
|
|
412
|
-
if (hasDescriptionSlot && descriptionVariant === "block") {
|
|
413
|
-
parts_0.push(blockDescriptionId);
|
|
414
|
-
}
|
|
415
|
-
if (inactiveWarningId) {
|
|
416
|
-
parts_0.push(inactiveWarningId);
|
|
417
|
-
}
|
|
418
|
-
$[49] = blockDescriptionId;
|
|
419
|
-
$[50] = descriptionVariant;
|
|
420
|
-
$[51] = hasDescriptionSlot;
|
|
421
|
-
$[52] = inactiveWarningId;
|
|
422
|
-
$[53] = parts_0;
|
|
423
|
-
} else {
|
|
424
|
-
parts_0 = $[53];
|
|
162
|
+
|
|
163
|
+
// only apply aria-selected and aria-checked to selectable items
|
|
164
|
+
const selectableRoles = ['menuitemradio', 'menuitemcheckbox', 'option'];
|
|
165
|
+
const includeSelectionAttribute = itemSelectionAttribute && itemRole && selectableRoles.includes(itemRole);
|
|
166
|
+
let focusable;
|
|
167
|
+
if (showInactiveIndicator) {
|
|
168
|
+
focusable = true;
|
|
425
169
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
170
|
+
|
|
171
|
+
// Extract the variant prop value from the description slot component
|
|
172
|
+
const descriptionVariant = (_slots$description$pr = (_slots$description = slots.description) === null || _slots$description === void 0 ? void 0 : _slots$description.props.variant) !== null && _slots$description$pr !== void 0 ? _slots$description$pr : 'inline';
|
|
173
|
+
const menuItemProps = {
|
|
174
|
+
onClick: clickHandler,
|
|
175
|
+
onKeyPress: !buttonSemantics ? keyPressHandler : undefined,
|
|
176
|
+
'aria-disabled': disabled ? true : undefined,
|
|
177
|
+
'data-inactive': inactive ? true : undefined,
|
|
178
|
+
'data-loading': loading && !inactive ? true : undefined,
|
|
179
|
+
tabIndex: focusable ? undefined : 0,
|
|
180
|
+
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''} ${slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : ''}`,
|
|
181
|
+
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
182
|
+
...(includeSelectionAttribute && {
|
|
435
183
|
[itemSelectionAttribute]: selected
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
id: itemId
|
|
458
|
-
};
|
|
459
|
-
$[58] = ariaDescribedBy;
|
|
460
|
-
$[59] = ariaLabelledBy;
|
|
461
|
-
$[60] = clickHandler;
|
|
462
|
-
$[61] = itemId;
|
|
463
|
-
$[62] = itemRole;
|
|
464
|
-
$[63] = t14;
|
|
465
|
-
$[64] = t15;
|
|
466
|
-
$[65] = t16;
|
|
467
|
-
$[66] = t17;
|
|
468
|
-
$[67] = t18;
|
|
469
|
-
$[68] = t19;
|
|
470
|
-
$[69] = t20;
|
|
471
|
-
} else {
|
|
472
|
-
t20 = $[69];
|
|
473
|
-
}
|
|
474
|
-
const menuItemProps = t20;
|
|
475
|
-
let t21;
|
|
476
|
-
if ($[70] !== _PrivateItemWrapper || $[71] !== forwardedRef || $[72] !== itemRole || $[73] !== listSemantics || $[74] !== menuItemProps || $[75] !== props) {
|
|
477
|
-
t21 = _PrivateItemWrapper ? {
|
|
478
|
-
role: itemRole ? "none" : undefined,
|
|
479
|
-
...props
|
|
480
|
-
} : listSemantics && {
|
|
481
|
-
...menuItemProps,
|
|
482
|
-
...props,
|
|
483
|
-
ref: forwardedRef
|
|
484
|
-
} || {};
|
|
485
|
-
$[70] = _PrivateItemWrapper;
|
|
486
|
-
$[71] = forwardedRef;
|
|
487
|
-
$[72] = itemRole;
|
|
488
|
-
$[73] = listSemantics;
|
|
489
|
-
$[74] = menuItemProps;
|
|
490
|
-
$[75] = props;
|
|
491
|
-
$[76] = t21;
|
|
492
|
-
} else {
|
|
493
|
-
t21 = $[76];
|
|
494
|
-
}
|
|
495
|
-
const containerProps = t21;
|
|
496
|
-
let t22;
|
|
497
|
-
if ($[77] !== _PrivateItemWrapper || $[78] !== forwardedRef || $[79] !== listSemantics || $[80] !== menuItemProps || $[81] !== props) {
|
|
498
|
-
t22 = _PrivateItemWrapper ? menuItemProps : !listSemantics && {
|
|
499
|
-
...menuItemProps,
|
|
500
|
-
...props,
|
|
501
|
-
ref: forwardedRef
|
|
502
|
-
};
|
|
503
|
-
$[77] = _PrivateItemWrapper;
|
|
504
|
-
$[78] = forwardedRef;
|
|
505
|
-
$[79] = listSemantics;
|
|
506
|
-
$[80] = menuItemProps;
|
|
507
|
-
$[81] = props;
|
|
508
|
-
$[82] = t22;
|
|
509
|
-
} else {
|
|
510
|
-
t22 = $[82];
|
|
511
|
-
}
|
|
512
|
-
const wrapperProps = t22;
|
|
513
|
-
const t23 = Boolean(inactiveText);
|
|
514
|
-
let t24;
|
|
515
|
-
if ($[83] !== blockDescriptionId || $[84] !== disabled || $[85] !== inlineDescriptionId || $[86] !== size || $[87] !== t23 || $[88] !== trailingVisualId || $[89] !== variant) {
|
|
516
|
-
t24 = {
|
|
184
|
+
}),
|
|
185
|
+
role: itemRole,
|
|
186
|
+
id: itemId
|
|
187
|
+
};
|
|
188
|
+
const containerProps = _PrivateItemWrapper ? {
|
|
189
|
+
role: itemRole ? 'none' : undefined,
|
|
190
|
+
...props
|
|
191
|
+
} :
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
193
|
+
listSemantics && {
|
|
194
|
+
...menuItemProps,
|
|
195
|
+
...props,
|
|
196
|
+
ref: forwardedRef
|
|
197
|
+
} || {};
|
|
198
|
+
const wrapperProps = _PrivateItemWrapper ? menuItemProps : !listSemantics && {
|
|
199
|
+
...menuItemProps,
|
|
200
|
+
...props,
|
|
201
|
+
ref: forwardedRef
|
|
202
|
+
};
|
|
203
|
+
return /*#__PURE__*/jsx(ItemContext.Provider, {
|
|
204
|
+
value: {
|
|
517
205
|
variant,
|
|
518
206
|
size,
|
|
519
207
|
disabled,
|
|
520
|
-
inactive:
|
|
208
|
+
inactive: Boolean(inactiveText),
|
|
521
209
|
inlineDescriptionId,
|
|
522
210
|
blockDescriptionId,
|
|
523
211
|
trailingVisualId
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
$[84] = disabled;
|
|
527
|
-
$[85] = inlineDescriptionId;
|
|
528
|
-
$[86] = size;
|
|
529
|
-
$[87] = t23;
|
|
530
|
-
$[88] = trailingVisualId;
|
|
531
|
-
$[89] = variant;
|
|
532
|
-
$[90] = t24;
|
|
533
|
-
} else {
|
|
534
|
-
t24 = $[90];
|
|
535
|
-
}
|
|
536
|
-
const itemContextValue = t24;
|
|
537
|
-
const t25 = listSemantics ? forwardedRef : null;
|
|
538
|
-
const t26 = variant === "danger" ? variant : undefined;
|
|
539
|
-
const t27 = active ? true : undefined;
|
|
540
|
-
const t28 = inactiveText ? true : undefined;
|
|
541
|
-
const t29 = slots.subItem ? true : undefined;
|
|
542
|
-
const t30 = slots.description ? true : false;
|
|
543
|
-
let t31;
|
|
544
|
-
if ($[91] !== className) {
|
|
545
|
-
t31 = clsx(classes.ActionListItem, className);
|
|
546
|
-
$[91] = className;
|
|
547
|
-
$[92] = t31;
|
|
548
|
-
} else {
|
|
549
|
-
t31 = $[92];
|
|
550
|
-
}
|
|
551
|
-
let t32;
|
|
552
|
-
if ($[93] === Symbol.for("react.memo_cache_sentinel")) {
|
|
553
|
-
t32 = /*#__PURE__*/jsx("span", {
|
|
554
|
-
className: classes.Spacer
|
|
555
|
-
});
|
|
556
|
-
$[93] = t32;
|
|
557
|
-
} else {
|
|
558
|
-
t32 = $[93];
|
|
559
|
-
}
|
|
560
|
-
let t33;
|
|
561
|
-
if ($[94] !== selected) {
|
|
562
|
-
t33 = /*#__PURE__*/jsx(Selection, {
|
|
563
|
-
selected: selected,
|
|
564
|
-
className: classes.LeadingAction
|
|
565
|
-
});
|
|
566
|
-
$[94] = selected;
|
|
567
|
-
$[95] = t33;
|
|
568
|
-
} else {
|
|
569
|
-
t33 = $[95];
|
|
570
|
-
}
|
|
571
|
-
const t34 = showInactiveIndicator ? inactiveText : undefined;
|
|
572
|
-
const t35 = Boolean(slots.leadingVisual);
|
|
573
|
-
let t36;
|
|
574
|
-
if ($[96] !== labelId || $[97] !== loading || $[98] !== slots.leadingVisual || $[99] !== t34 || $[100] !== t35) {
|
|
575
|
-
t36 = /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
576
|
-
inactiveText: t34,
|
|
577
|
-
itemHasLeadingVisual: t35,
|
|
578
|
-
labelId: labelId,
|
|
579
|
-
loading: loading,
|
|
580
|
-
position: "leading",
|
|
581
|
-
children: slots.leadingVisual
|
|
582
|
-
});
|
|
583
|
-
$[96] = labelId;
|
|
584
|
-
$[97] = loading;
|
|
585
|
-
$[98] = slots.leadingVisual;
|
|
586
|
-
$[99] = t34;
|
|
587
|
-
$[100] = t35;
|
|
588
|
-
$[101] = t36;
|
|
589
|
-
} else {
|
|
590
|
-
t36 = $[101];
|
|
591
|
-
}
|
|
592
|
-
const t37 = !!slots.description;
|
|
593
|
-
let t38;
|
|
594
|
-
if ($[102] !== inactive || $[103] !== loading) {
|
|
595
|
-
t38 = loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
596
|
-
children: "Loading"
|
|
597
|
-
});
|
|
598
|
-
$[102] = inactive;
|
|
599
|
-
$[103] = loading;
|
|
600
|
-
$[104] = t38;
|
|
601
|
-
} else {
|
|
602
|
-
t38 = $[104];
|
|
603
|
-
}
|
|
604
|
-
let t39;
|
|
605
|
-
if ($[105] !== childrenWithoutSlots || $[106] !== labelId || $[107] !== t38) {
|
|
606
|
-
t39 = /*#__PURE__*/jsxs("span", {
|
|
607
|
-
id: labelId,
|
|
608
|
-
className: classes.ItemLabel,
|
|
609
|
-
children: [childrenWithoutSlots, t38]
|
|
610
|
-
});
|
|
611
|
-
$[105] = childrenWithoutSlots;
|
|
612
|
-
$[106] = labelId;
|
|
613
|
-
$[107] = t38;
|
|
614
|
-
$[108] = t39;
|
|
615
|
-
} else {
|
|
616
|
-
t39 = $[108];
|
|
617
|
-
}
|
|
618
|
-
let t40;
|
|
619
|
-
if ($[109] !== descriptionVariant || $[110] !== slots.description || $[111] !== t37 || $[112] !== t39) {
|
|
620
|
-
t40 = /*#__PURE__*/jsxs(ConditionalWrapper, {
|
|
621
|
-
if: t37,
|
|
622
|
-
className: classes.ItemDescriptionWrap,
|
|
623
|
-
"data-description-variant": descriptionVariant,
|
|
624
|
-
children: [t39, slots.description]
|
|
625
|
-
});
|
|
626
|
-
$[109] = descriptionVariant;
|
|
627
|
-
$[110] = slots.description;
|
|
628
|
-
$[111] = t37;
|
|
629
|
-
$[112] = t39;
|
|
630
|
-
$[113] = t40;
|
|
631
|
-
} else {
|
|
632
|
-
t40 = $[113];
|
|
633
|
-
}
|
|
634
|
-
const t41 = showInactiveIndicator ? inactiveText : undefined;
|
|
635
|
-
const t42 = Boolean(slots.leadingVisual);
|
|
636
|
-
let t43;
|
|
637
|
-
if ($[114] !== labelId || $[115] !== loading || $[116] !== t41 || $[117] !== t42 || $[118] !== trailingVisual) {
|
|
638
|
-
t43 = /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
639
|
-
inactiveText: t41,
|
|
640
|
-
itemHasLeadingVisual: t42,
|
|
641
|
-
labelId: labelId,
|
|
642
|
-
loading: loading,
|
|
643
|
-
position: "trailing",
|
|
644
|
-
children: trailingVisual
|
|
645
|
-
});
|
|
646
|
-
$[114] = labelId;
|
|
647
|
-
$[115] = loading;
|
|
648
|
-
$[116] = t41;
|
|
649
|
-
$[117] = t42;
|
|
650
|
-
$[118] = trailingVisual;
|
|
651
|
-
$[119] = t43;
|
|
652
|
-
} else {
|
|
653
|
-
t43 = $[119];
|
|
654
|
-
}
|
|
655
|
-
let t44;
|
|
656
|
-
if ($[120] !== inactiveText || $[121] !== inactiveWarningId || $[122] !== showInactiveIndicator) {
|
|
657
|
-
t44 = !showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
|
|
658
|
-
className: classes.InactiveWarning,
|
|
659
|
-
id: inactiveWarningId,
|
|
660
|
-
children: inactiveText
|
|
661
|
-
}) : null;
|
|
662
|
-
$[120] = inactiveText;
|
|
663
|
-
$[121] = inactiveWarningId;
|
|
664
|
-
$[122] = showInactiveIndicator;
|
|
665
|
-
$[123] = t44;
|
|
666
|
-
} else {
|
|
667
|
-
t44 = $[123];
|
|
668
|
-
}
|
|
669
|
-
let t45;
|
|
670
|
-
if ($[124] !== t40 || $[125] !== t43 || $[126] !== t44) {
|
|
671
|
-
t45 = /*#__PURE__*/jsxs("span", {
|
|
672
|
-
className: classes.ActionListSubContent,
|
|
673
|
-
"data-component": "ActionList.Item--DividerContainer",
|
|
674
|
-
children: [t40, t43, t44]
|
|
675
|
-
});
|
|
676
|
-
$[124] = t40;
|
|
677
|
-
$[125] = t43;
|
|
678
|
-
$[126] = t44;
|
|
679
|
-
$[127] = t45;
|
|
680
|
-
} else {
|
|
681
|
-
t45 = $[127];
|
|
682
|
-
}
|
|
683
|
-
let t46;
|
|
684
|
-
if ($[128] !== ItemWrapper || $[129] !== forwardedRef || $[130] !== size || $[131] !== t33 || $[132] !== t36 || $[133] !== t45 || $[134] !== wrapperProps) {
|
|
685
|
-
t46 = /*#__PURE__*/jsxs(ItemWrapper, {
|
|
686
|
-
...wrapperProps,
|
|
687
|
-
className: classes.ActionListContent,
|
|
688
|
-
"data-size": size,
|
|
689
|
-
ref: forwardedRef,
|
|
690
|
-
children: [t32, t33, t36, t45]
|
|
691
|
-
});
|
|
692
|
-
$[128] = ItemWrapper;
|
|
693
|
-
$[129] = forwardedRef;
|
|
694
|
-
$[130] = size;
|
|
695
|
-
$[131] = t33;
|
|
696
|
-
$[132] = t36;
|
|
697
|
-
$[133] = t45;
|
|
698
|
-
$[134] = wrapperProps;
|
|
699
|
-
$[135] = t46;
|
|
700
|
-
} else {
|
|
701
|
-
t46 = $[135];
|
|
702
|
-
}
|
|
703
|
-
const t47 = !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction;
|
|
704
|
-
let t48;
|
|
705
|
-
if ($[136] !== containerProps || $[137] !== slots.subItem || $[138] !== t25 || $[139] !== t26 || $[140] !== t27 || $[141] !== t28 || $[142] !== t29 || $[143] !== t30 || $[144] !== t31 || $[145] !== t46 || $[146] !== t47) {
|
|
706
|
-
t48 = /*#__PURE__*/jsxs("li", {
|
|
212
|
+
},
|
|
213
|
+
children: /*#__PURE__*/jsxs("li", {
|
|
707
214
|
...containerProps,
|
|
708
|
-
ref:
|
|
709
|
-
"data-variant":
|
|
710
|
-
"data-active":
|
|
711
|
-
"data-inactive":
|
|
712
|
-
"data-has-subitem":
|
|
713
|
-
"data-has-description":
|
|
714
|
-
className:
|
|
715
|
-
children: [
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
215
|
+
ref: listSemantics ? forwardedRef : null,
|
|
216
|
+
"data-variant": variant === 'danger' ? variant : undefined,
|
|
217
|
+
"data-active": active ? true : undefined,
|
|
218
|
+
"data-inactive": inactiveText ? true : undefined,
|
|
219
|
+
"data-has-subitem": slots.subItem ? true : undefined,
|
|
220
|
+
"data-has-description": slots.description ? true : false,
|
|
221
|
+
className: clsx(classes.ActionListItem, className),
|
|
222
|
+
children: [/*#__PURE__*/jsxs(ItemWrapper, {
|
|
223
|
+
...wrapperProps,
|
|
224
|
+
className: classes.ActionListContent,
|
|
225
|
+
"data-size": size
|
|
226
|
+
// @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
|
|
227
|
+
,
|
|
228
|
+
ref: forwardedRef,
|
|
229
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
230
|
+
className: classes.Spacer
|
|
231
|
+
}), /*#__PURE__*/jsx(Selection, {
|
|
232
|
+
selected: selected,
|
|
233
|
+
className: classes.LeadingAction
|
|
234
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
235
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
236
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
237
|
+
labelId: labelId,
|
|
238
|
+
loading: loading,
|
|
239
|
+
position: "leading",
|
|
240
|
+
children: slots.leadingVisual
|
|
241
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
242
|
+
className: classes.ActionListSubContent,
|
|
243
|
+
"data-component": "ActionList.Item--DividerContainer",
|
|
244
|
+
children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
|
|
245
|
+
if: !!slots.description,
|
|
246
|
+
className: classes.ItemDescriptionWrap,
|
|
247
|
+
"data-description-variant": descriptionVariant,
|
|
248
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
249
|
+
id: labelId,
|
|
250
|
+
className: classes.ItemLabel,
|
|
251
|
+
children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
252
|
+
children: "Loading"
|
|
253
|
+
})]
|
|
254
|
+
}), slots.description]
|
|
255
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
256
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
257
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
258
|
+
labelId: labelId,
|
|
259
|
+
loading: loading,
|
|
260
|
+
position: "trailing",
|
|
261
|
+
children: trailingVisual
|
|
262
|
+
}),
|
|
263
|
+
// If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
|
|
264
|
+
// render the inactive warning message directly in the item.
|
|
265
|
+
!showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
|
|
266
|
+
className: classes.InactiveWarning,
|
|
267
|
+
id: inactiveWarningId,
|
|
268
|
+
children: inactiveText
|
|
269
|
+
}) : null]
|
|
270
|
+
})]
|
|
271
|
+
}), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
|
|
272
|
+
})
|
|
273
|
+
});
|
|
745
274
|
};
|
|
275
|
+
UnwrappedItem.displayName = "UnwrappedItem";
|
|
746
276
|
const Item = Object.assign(fixedForwardRef(UnwrappedItem), {
|
|
747
277
|
displayName: 'ActionList.Item',
|
|
748
278
|
__SLOT__: Symbol('ActionList.Item')
|