@primer/react 0.0.0-20260218171929 → 0.0.0-20260218180138
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 -2
- package/dist/ActionList/Description.js +113 -35
- package/dist/ActionList/Divider.js +30 -11
- package/dist/ActionList/Group.js +294 -117
- package/dist/ActionList/Heading.js +77 -22
- package/dist/ActionList/Item.js +98 -37
- package/dist/ActionList/LinkItem.js +80 -24
- package/dist/ActionList/List.js +143 -33
- package/dist/ActionList/Selection.js +78 -30
- package/dist/ActionList/TrailingAction.js +83 -23
- package/dist/ActionList/Visuals.js +162 -64
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +82 -32
- package/dist/hooks/useIsMacOS.d.ts +15 -3
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +24 -26
- package/dist/live-region/Announce.d.ts.map +1 -1
- package/dist/live-region/Announce.js +7 -4
- package/generated/components.json +1 -1
- package/package.json +1 -1
- package/dist/utils/environment.js +0 -9
package/dist/ActionList/Group.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { useId } from '../hooks/useId.js';
|
|
3
4
|
import { ListContext } from './shared.js';
|
|
@@ -8,21 +9,54 @@ import classes from './ActionList.module.css.js';
|
|
|
8
9
|
import groupClasses from './Group.module.css.js';
|
|
9
10
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
|
|
11
|
-
const Heading =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
id
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const Heading = t0 => {
|
|
13
|
+
const $ = c(12);
|
|
14
|
+
let children;
|
|
15
|
+
let className;
|
|
16
|
+
let id;
|
|
17
|
+
let rest;
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
({
|
|
21
|
+
as: t1,
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
id,
|
|
25
|
+
...rest
|
|
26
|
+
} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = children;
|
|
29
|
+
$[2] = className;
|
|
30
|
+
$[3] = id;
|
|
31
|
+
$[4] = rest;
|
|
32
|
+
$[5] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
children = $[1];
|
|
35
|
+
className = $[2];
|
|
36
|
+
id = $[3];
|
|
37
|
+
rest = $[4];
|
|
38
|
+
t1 = $[5];
|
|
39
|
+
}
|
|
40
|
+
const Component = t1 === undefined ? "h3" : t1;
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[6] !== Component || $[7] !== children || $[8] !== className || $[9] !== id || $[10] !== rest) {
|
|
43
|
+
t2 = /*#__PURE__*/jsx(Component, {
|
|
44
|
+
className: className,
|
|
45
|
+
id: id,
|
|
46
|
+
...rest,
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
$[6] = Component;
|
|
50
|
+
$[7] = children;
|
|
51
|
+
$[8] = className;
|
|
52
|
+
$[9] = id;
|
|
53
|
+
$[10] = rest;
|
|
54
|
+
$[11] = t2;
|
|
55
|
+
} else {
|
|
56
|
+
t2 = $[11];
|
|
57
|
+
}
|
|
58
|
+
return t2;
|
|
24
59
|
};
|
|
25
|
-
Heading.displayName = "Heading";
|
|
26
60
|
const HeadingWrap = ({
|
|
27
61
|
as = 'div',
|
|
28
62
|
children,
|
|
@@ -38,66 +72,168 @@ const GroupContext = /*#__PURE__*/React.createContext({
|
|
|
38
72
|
groupHeadingId: undefined,
|
|
39
73
|
selectionVariant: undefined
|
|
40
74
|
});
|
|
41
|
-
const Group =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
75
|
+
const Group = t0 => {
|
|
76
|
+
var _ariaLabel, _title, _slots$groupHeading;
|
|
77
|
+
const $ = c(38);
|
|
78
|
+
let ariaLabel;
|
|
79
|
+
let auxiliaryText;
|
|
80
|
+
let className;
|
|
81
|
+
let props;
|
|
82
|
+
let role;
|
|
83
|
+
let selectionVariant;
|
|
84
|
+
let t1;
|
|
85
|
+
let title;
|
|
86
|
+
if ($[0] !== t0) {
|
|
87
|
+
({
|
|
88
|
+
title,
|
|
89
|
+
variant: t1,
|
|
90
|
+
auxiliaryText,
|
|
91
|
+
selectionVariant,
|
|
92
|
+
role,
|
|
93
|
+
className,
|
|
94
|
+
"aria-label": ariaLabel,
|
|
95
|
+
...props
|
|
96
|
+
} = t0);
|
|
97
|
+
$[0] = t0;
|
|
98
|
+
$[1] = ariaLabel;
|
|
99
|
+
$[2] = auxiliaryText;
|
|
100
|
+
$[3] = className;
|
|
101
|
+
$[4] = props;
|
|
102
|
+
$[5] = role;
|
|
103
|
+
$[6] = selectionVariant;
|
|
104
|
+
$[7] = t1;
|
|
105
|
+
$[8] = title;
|
|
106
|
+
} else {
|
|
107
|
+
ariaLabel = $[1];
|
|
108
|
+
auxiliaryText = $[2];
|
|
109
|
+
className = $[3];
|
|
110
|
+
props = $[4];
|
|
111
|
+
role = $[5];
|
|
112
|
+
selectionVariant = $[6];
|
|
113
|
+
t1 = $[7];
|
|
114
|
+
title = $[8];
|
|
115
|
+
}
|
|
116
|
+
const variant = t1 === undefined ? "subtle" : t1;
|
|
52
117
|
const id = useId();
|
|
53
118
|
const {
|
|
54
119
|
role: listRole
|
|
55
120
|
} = React.useContext(ListContext);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
121
|
+
let t2;
|
|
122
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
t2 = {
|
|
124
|
+
groupHeading: GroupHeading
|
|
125
|
+
};
|
|
126
|
+
$[9] = t2;
|
|
127
|
+
} else {
|
|
128
|
+
t2 = $[9];
|
|
129
|
+
}
|
|
130
|
+
const [slots, childrenWithoutSlots] = useSlots(props.children, t2);
|
|
59
131
|
let groupHeadingId = undefined;
|
|
60
|
-
|
|
61
|
-
// ActionList.GroupHeading
|
|
62
132
|
if (slots.groupHeading) {
|
|
63
133
|
var _slots$groupHeading$p;
|
|
64
|
-
// If there is an id prop passed in the ActionList.GroupHeading, use it otherwise use the generated id.
|
|
65
134
|
groupHeadingId = (_slots$groupHeading$p = slots.groupHeading.props.id) !== null && _slots$groupHeading$p !== void 0 ? _slots$groupHeading$p : id;
|
|
66
135
|
}
|
|
67
|
-
// Supports the deprecated `title` prop
|
|
68
136
|
if (title) {
|
|
69
137
|
groupHeadingId = id;
|
|
70
138
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
139
|
+
let t3;
|
|
140
|
+
if ($[10] !== className) {
|
|
141
|
+
t3 = clsx(className, groupClasses.Group);
|
|
142
|
+
$[10] = className;
|
|
143
|
+
$[11] = t3;
|
|
144
|
+
} else {
|
|
145
|
+
t3 = $[11];
|
|
146
|
+
}
|
|
147
|
+
const t4 = listRole ? "none" : undefined;
|
|
148
|
+
let t5;
|
|
149
|
+
if ($[12] !== groupHeadingId || $[13] !== selectionVariant) {
|
|
150
|
+
t5 = {
|
|
151
|
+
selectionVariant,
|
|
152
|
+
groupHeadingId
|
|
153
|
+
};
|
|
154
|
+
$[12] = groupHeadingId;
|
|
155
|
+
$[13] = selectionVariant;
|
|
156
|
+
$[14] = t5;
|
|
157
|
+
} else {
|
|
158
|
+
t5 = $[14];
|
|
159
|
+
}
|
|
160
|
+
let t6;
|
|
161
|
+
if ($[15] !== auxiliaryText || $[16] !== slots.groupHeading || $[17] !== title || $[18] !== variant) {
|
|
162
|
+
t6 = title && !slots.groupHeading ? /*#__PURE__*/jsx(GroupHeading, {
|
|
163
|
+
variant: variant,
|
|
164
|
+
auxiliaryText: auxiliaryText,
|
|
165
|
+
_internalBackwardCompatibleTitle: title
|
|
166
|
+
}) : null;
|
|
167
|
+
$[15] = auxiliaryText;
|
|
168
|
+
$[16] = slots.groupHeading;
|
|
169
|
+
$[17] = title;
|
|
170
|
+
$[18] = variant;
|
|
171
|
+
$[19] = t6;
|
|
172
|
+
} else {
|
|
173
|
+
t6 = $[19];
|
|
174
|
+
}
|
|
175
|
+
let t7;
|
|
176
|
+
if ($[20] !== slots.groupHeading || $[21] !== title) {
|
|
177
|
+
t7 = !title && slots.groupHeading ? /*#__PURE__*/React.cloneElement(slots.groupHeading) : null;
|
|
178
|
+
$[20] = slots.groupHeading;
|
|
179
|
+
$[21] = title;
|
|
180
|
+
$[22] = t7;
|
|
181
|
+
} else {
|
|
182
|
+
t7 = $[22];
|
|
183
|
+
}
|
|
184
|
+
const t8 = listRole ? undefined : groupHeadingId;
|
|
185
|
+
const t9 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : listRole ? (_title = title) !== null && _title !== void 0 ? _title : (_slots$groupHeading = slots.groupHeading) === null || _slots$groupHeading === void 0 ? void 0 : _slots$groupHeading.props.children : undefined;
|
|
186
|
+
const t10 = role || listRole && "group";
|
|
187
|
+
const t11 = slots.groupHeading ? childrenWithoutSlots : props.children;
|
|
188
|
+
let t12;
|
|
189
|
+
if ($[23] !== t10 || $[24] !== t11 || $[25] !== t8 || $[26] !== t9) {
|
|
190
|
+
t12 = /*#__PURE__*/jsx("ul", {
|
|
191
|
+
"aria-labelledby": t8,
|
|
192
|
+
"aria-label": t9,
|
|
193
|
+
role: t10,
|
|
194
|
+
className: groupClasses.GroupList,
|
|
195
|
+
children: t11
|
|
196
|
+
});
|
|
197
|
+
$[23] = t10;
|
|
198
|
+
$[24] = t11;
|
|
199
|
+
$[25] = t8;
|
|
200
|
+
$[26] = t9;
|
|
201
|
+
$[27] = t12;
|
|
202
|
+
} else {
|
|
203
|
+
t12 = $[27];
|
|
204
|
+
}
|
|
205
|
+
let t13;
|
|
206
|
+
if ($[28] !== t12 || $[29] !== t5 || $[30] !== t6 || $[31] !== t7) {
|
|
207
|
+
t13 = /*#__PURE__*/jsxs(GroupContext.Provider, {
|
|
208
|
+
value: t5,
|
|
209
|
+
children: [t6, t7, t12]
|
|
210
|
+
});
|
|
211
|
+
$[28] = t12;
|
|
212
|
+
$[29] = t5;
|
|
213
|
+
$[30] = t6;
|
|
214
|
+
$[31] = t7;
|
|
215
|
+
$[32] = t13;
|
|
216
|
+
} else {
|
|
217
|
+
t13 = $[32];
|
|
218
|
+
}
|
|
219
|
+
let t14;
|
|
220
|
+
if ($[33] !== props || $[34] !== t13 || $[35] !== t3 || $[36] !== t4) {
|
|
221
|
+
t14 = /*#__PURE__*/jsx("li", {
|
|
222
|
+
className: t3,
|
|
223
|
+
role: t4,
|
|
224
|
+
...props,
|
|
225
|
+
children: t13
|
|
226
|
+
});
|
|
227
|
+
$[33] = props;
|
|
228
|
+
$[34] = t13;
|
|
229
|
+
$[35] = t3;
|
|
230
|
+
$[36] = t4;
|
|
231
|
+
$[37] = t14;
|
|
232
|
+
} else {
|
|
233
|
+
t14 = $[37];
|
|
234
|
+
}
|
|
235
|
+
return t14;
|
|
99
236
|
};
|
|
100
|
-
Group.displayName = "Group";
|
|
101
237
|
/**
|
|
102
238
|
* Heading of a `Group`.
|
|
103
239
|
*
|
|
@@ -106,69 +242,110 @@ Group.displayName = "Group";
|
|
|
106
242
|
* hidden from the accessibility tree due to the limitation of listbox children. https://w3c.github.io/aria/#listbox
|
|
107
243
|
* groups under menu or listbox are labelled by `aria-label`
|
|
108
244
|
*/
|
|
109
|
-
const GroupHeading =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
245
|
+
const GroupHeading = t0 => {
|
|
246
|
+
const $ = c(20);
|
|
247
|
+
let _internalBackwardCompatibleTitle;
|
|
248
|
+
let as;
|
|
249
|
+
let auxiliaryText;
|
|
250
|
+
let children;
|
|
251
|
+
let className;
|
|
252
|
+
let props;
|
|
253
|
+
let t1;
|
|
254
|
+
let t2;
|
|
255
|
+
if ($[0] !== t0) {
|
|
256
|
+
({
|
|
257
|
+
as,
|
|
258
|
+
variant: t1,
|
|
259
|
+
_internalBackwardCompatibleTitle,
|
|
260
|
+
auxiliaryText,
|
|
261
|
+
children,
|
|
262
|
+
className,
|
|
263
|
+
headingWrapElement: t2,
|
|
264
|
+
...props
|
|
265
|
+
} = t0);
|
|
266
|
+
$[0] = t0;
|
|
267
|
+
$[1] = _internalBackwardCompatibleTitle;
|
|
268
|
+
$[2] = as;
|
|
269
|
+
$[3] = auxiliaryText;
|
|
270
|
+
$[4] = children;
|
|
271
|
+
$[5] = className;
|
|
272
|
+
$[6] = props;
|
|
273
|
+
$[7] = t1;
|
|
274
|
+
$[8] = t2;
|
|
275
|
+
} else {
|
|
276
|
+
_internalBackwardCompatibleTitle = $[1];
|
|
277
|
+
as = $[2];
|
|
278
|
+
auxiliaryText = $[3];
|
|
279
|
+
children = $[4];
|
|
280
|
+
className = $[5];
|
|
281
|
+
props = $[6];
|
|
282
|
+
t1 = $[7];
|
|
283
|
+
t2 = $[8];
|
|
284
|
+
}
|
|
285
|
+
const variant = t1 === undefined ? "subtle" : t1;
|
|
286
|
+
const headingWrapElement = t2 === undefined ? "div" : t2;
|
|
120
287
|
const {
|
|
121
288
|
role: listRole
|
|
122
289
|
} = React.useContext(ListContext);
|
|
123
290
|
const {
|
|
124
291
|
groupHeadingId
|
|
125
292
|
} = React.useContext(GroupContext);
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"data-component": "GroupHeadingWrap",
|
|
142
|
-
as: headingWrapElement,
|
|
143
|
-
...props,
|
|
144
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
145
|
-
className: clsx(className, groupClasses.GroupHeading),
|
|
146
|
-
id: groupHeadingId,
|
|
147
|
-
children: _internalBackwardCompatibleTitle !== null && _internalBackwardCompatibleTitle !== void 0 ? _internalBackwardCompatibleTitle : children
|
|
148
|
-
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
149
|
-
className: classes.Description,
|
|
150
|
-
children: auxiliaryText
|
|
151
|
-
})]
|
|
152
|
-
}) :
|
|
153
|
-
/*#__PURE__*/
|
|
154
|
-
// for explicit (role="list" is passed as prop) and implicit list roles (ActionList ins rendered as list by default), group titles are proper heading tags.
|
|
155
|
-
jsxs(HeadingWrap, {
|
|
156
|
-
className: groupClasses.GroupHeadingWrap,
|
|
157
|
-
"data-variant": variant,
|
|
158
|
-
as: headingWrapElement,
|
|
159
|
-
"data-component": "GroupHeadingWrap",
|
|
160
|
-
children: [/*#__PURE__*/jsx(Heading, {
|
|
161
|
-
className: clsx(className, groupClasses.GroupHeading),
|
|
162
|
-
as: as || 'h3',
|
|
163
|
-
id: groupHeadingId,
|
|
293
|
+
const missingAsForList = (listRole === undefined || listRole === "list") && children !== undefined && as === undefined;
|
|
294
|
+
const unnecessaryAsForListboxOrMenu = listRole !== undefined && listRole !== "list" && children !== undefined && as !== undefined;
|
|
295
|
+
!!missingAsForList ? process.env.NODE_ENV !== "production" ? invariant(false, "You are setting a heading for a list, that requires a heading level. Please use 'as' prop to set a proper heading level.") : invariant(false) : void 0;
|
|
296
|
+
!!unnecessaryAsForListboxOrMenu ? process.env.NODE_ENV !== "production" ? invariant(false, `Looks like you are trying to set a heading level to a ${listRole} role. Group headings for ${listRole} type action lists are for representational purposes, and rendered as divs. Therefore they don't need a heading level.`) : invariant(false) : void 0;
|
|
297
|
+
let t3;
|
|
298
|
+
if ($[9] !== _internalBackwardCompatibleTitle || $[10] !== as || $[11] !== auxiliaryText || $[12] !== children || $[13] !== className || $[14] !== groupHeadingId || $[15] !== headingWrapElement || $[16] !== listRole || $[17] !== props || $[18] !== variant) {
|
|
299
|
+
var _internalBackwardComp, _internalBackwardComp2;
|
|
300
|
+
t3 = /*#__PURE__*/jsx(Fragment, {
|
|
301
|
+
children: listRole && listRole !== "list" ? /*#__PURE__*/jsxs(HeadingWrap, {
|
|
302
|
+
role: "presentation",
|
|
303
|
+
className: groupClasses.GroupHeadingWrap,
|
|
304
|
+
"aria-hidden": "true",
|
|
305
|
+
"data-variant": variant,
|
|
306
|
+
"data-component": "GroupHeadingWrap",
|
|
307
|
+
as: headingWrapElement,
|
|
164
308
|
...props,
|
|
165
|
-
children:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
309
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
310
|
+
className: clsx(className, groupClasses.GroupHeading),
|
|
311
|
+
id: groupHeadingId,
|
|
312
|
+
children: (_internalBackwardComp = _internalBackwardCompatibleTitle) !== null && _internalBackwardComp !== void 0 ? _internalBackwardComp : children
|
|
313
|
+
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
314
|
+
className: classes.Description,
|
|
315
|
+
children: auxiliaryText
|
|
316
|
+
})]
|
|
317
|
+
}) : /*#__PURE__*/jsxs(HeadingWrap, {
|
|
318
|
+
className: groupClasses.GroupHeadingWrap,
|
|
319
|
+
"data-variant": variant,
|
|
320
|
+
as: headingWrapElement,
|
|
321
|
+
"data-component": "GroupHeadingWrap",
|
|
322
|
+
children: [/*#__PURE__*/jsx(Heading, {
|
|
323
|
+
className: clsx(className, groupClasses.GroupHeading),
|
|
324
|
+
as: as || "h3",
|
|
325
|
+
id: groupHeadingId,
|
|
326
|
+
...props,
|
|
327
|
+
children: (_internalBackwardComp2 = _internalBackwardCompatibleTitle) !== null && _internalBackwardComp2 !== void 0 ? _internalBackwardComp2 : children
|
|
328
|
+
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
329
|
+
className: classes.Description,
|
|
330
|
+
children: auxiliaryText
|
|
331
|
+
})]
|
|
332
|
+
})
|
|
333
|
+
});
|
|
334
|
+
$[9] = _internalBackwardCompatibleTitle;
|
|
335
|
+
$[10] = as;
|
|
336
|
+
$[11] = auxiliaryText;
|
|
337
|
+
$[12] = children;
|
|
338
|
+
$[13] = className;
|
|
339
|
+
$[14] = groupHeadingId;
|
|
340
|
+
$[15] = headingWrapElement;
|
|
341
|
+
$[16] = listRole;
|
|
342
|
+
$[17] = props;
|
|
343
|
+
$[18] = variant;
|
|
344
|
+
$[19] = t3;
|
|
345
|
+
} else {
|
|
346
|
+
t3 = $[19];
|
|
347
|
+
}
|
|
348
|
+
return t3;
|
|
172
349
|
};
|
|
173
350
|
GroupHeading.displayName = 'ActionList.GroupHeading';
|
|
174
351
|
Group.displayName = 'ActionList.Group';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React, { forwardRef } from 'react';
|
|
2
3
|
import { ListContext } from './shared.js';
|
|
3
4
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
@@ -9,42 +10,96 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
9
10
|
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
10
11
|
import Heading$1 from '../Heading/Heading.js';
|
|
11
12
|
|
|
12
|
-
const Heading = /*#__PURE__*/forwardRef(({
|
|
13
|
-
as,
|
|
14
|
-
size,
|
|
15
|
-
children,
|
|
16
|
-
visuallyHidden = false,
|
|
17
|
-
className,
|
|
18
|
-
...props
|
|
19
|
-
}, forwardedRef) => {
|
|
13
|
+
const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
20
14
|
var _props$id;
|
|
15
|
+
const $ = c(20);
|
|
16
|
+
let as;
|
|
17
|
+
let children;
|
|
18
|
+
let className;
|
|
19
|
+
let props;
|
|
20
|
+
let size;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== t0) {
|
|
23
|
+
({
|
|
24
|
+
as,
|
|
25
|
+
size,
|
|
26
|
+
children,
|
|
27
|
+
visuallyHidden: t1,
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
} = t0);
|
|
31
|
+
$[0] = t0;
|
|
32
|
+
$[1] = as;
|
|
33
|
+
$[2] = children;
|
|
34
|
+
$[3] = className;
|
|
35
|
+
$[4] = props;
|
|
36
|
+
$[5] = size;
|
|
37
|
+
$[6] = t1;
|
|
38
|
+
} else {
|
|
39
|
+
as = $[1];
|
|
40
|
+
children = $[2];
|
|
41
|
+
className = $[3];
|
|
42
|
+
props = $[4];
|
|
43
|
+
size = $[5];
|
|
44
|
+
t1 = $[6];
|
|
45
|
+
}
|
|
46
|
+
const visuallyHidden = t1 === undefined ? false : t1;
|
|
21
47
|
const innerRef = React.useRef(null);
|
|
22
48
|
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
23
49
|
const {
|
|
24
|
-
headingId
|
|
50
|
+
headingId,
|
|
25
51
|
variant: listVariant
|
|
26
52
|
} = React.useContext(ListContext);
|
|
27
53
|
const {
|
|
28
54
|
container
|
|
29
55
|
} = React.useContext(ActionListContainerContext);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
!(container !== "ActionMenu") ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionList.Heading shouldn't be used within an ActionMenu container. Menus are labelled by the menu button's name.") : invariant(false) : void 0;
|
|
57
|
+
const t2 = !visuallyHidden;
|
|
58
|
+
const t3 = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : headingId;
|
|
59
|
+
let t4;
|
|
60
|
+
if ($[7] !== className) {
|
|
61
|
+
t4 = clsx(className, classes.ActionListHeader);
|
|
62
|
+
$[7] = className;
|
|
63
|
+
$[8] = t4;
|
|
64
|
+
} else {
|
|
65
|
+
t4 = $[8];
|
|
66
|
+
}
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[9] !== as || $[10] !== children || $[11] !== listVariant || $[12] !== props || $[13] !== size || $[14] !== t3 || $[15] !== t4) {
|
|
69
|
+
t5 = /*#__PURE__*/jsx(Heading$1, {
|
|
36
70
|
as: as,
|
|
37
71
|
variant: size,
|
|
38
|
-
ref: innerRef
|
|
39
|
-
|
|
40
|
-
,
|
|
41
|
-
id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : headingId,
|
|
42
|
-
className: clsx(className, classes.ActionListHeader),
|
|
72
|
+
ref: innerRef,
|
|
73
|
+
id: t3,
|
|
74
|
+
className: t4,
|
|
43
75
|
"data-list-variant": listVariant,
|
|
44
76
|
...props,
|
|
45
77
|
children: children
|
|
46
|
-
})
|
|
47
|
-
|
|
78
|
+
});
|
|
79
|
+
$[9] = as;
|
|
80
|
+
$[10] = children;
|
|
81
|
+
$[11] = listVariant;
|
|
82
|
+
$[12] = props;
|
|
83
|
+
$[13] = size;
|
|
84
|
+
$[14] = t3;
|
|
85
|
+
$[15] = t4;
|
|
86
|
+
$[16] = t5;
|
|
87
|
+
} else {
|
|
88
|
+
t5 = $[16];
|
|
89
|
+
}
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[17] !== t2 || $[18] !== t5) {
|
|
92
|
+
t6 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
93
|
+
isVisible: t2,
|
|
94
|
+
children: t5
|
|
95
|
+
});
|
|
96
|
+
$[17] = t2;
|
|
97
|
+
$[18] = t5;
|
|
98
|
+
$[19] = t6;
|
|
99
|
+
} else {
|
|
100
|
+
t6 = $[19];
|
|
101
|
+
}
|
|
102
|
+
return t6;
|
|
48
103
|
});
|
|
49
104
|
Heading.displayName = 'ActionList.Heading';
|
|
50
105
|
Heading.__SLOT__ = Symbol('ActionList.Heading');
|