@primer/react 0.0.0-20260306091436 → 0.0.0-20260306110315

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260306091436
3
+ ## 0.0.0-20260306110315
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -18,6 +18,8 @@
18
18
 
19
19
  - [#7624](https://github.com/primer/react/pull/7624) [`f6d4311`](https://github.com/primer/react/commit/f6d431194d217fbb7d456e58bcbbcbb434896fe1) Thanks [@llastflowers](https://github.com/llastflowers)! - Fix FormControl + SelectPanel accessible name to address SR issues
20
20
 
21
+ - [#7554](https://github.com/primer/react/pull/7554) [`38e18ea`](https://github.com/primer/react/commit/38e18eaa0e965dba05f29422d7724e694d5ff4c4) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(ActionList): memoize context values, menuItemProps, and aria attributes
22
+
21
23
  - [#7617](https://github.com/primer/react/pull/7617) [`79c855a`](https://github.com/primer/react/commit/79c855abeb6f46d3fefafb236f00ea65dfcd1ed4) Thanks [@llastflowers](https://github.com/llastflowers)! - Push margin-top of TimelineBody +1px
22
24
 
23
25
  - [#7550](https://github.com/primer/react/pull/7550) [`9585669`](https://github.com/primer/react/commit/958566907a580b54b484ff2339b32315b8a3b4b7) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Spinner): replace Web Animations API with CSS animation-delay sync
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAmBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AA0SD,QAAA,MAAM,IAAI,IAlRa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqRjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAmBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AAsUD,QAAA,MAAM,IAAI,IAjSa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoSjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
@@ -108,50 +108,132 @@ const DivItemContainerNoBox = /*#__PURE__*/React.forwardRef((t0, forwardedRef) =
108
108
  }
109
109
  return t2;
110
110
  });
111
- const UnwrappedItem = ({
112
- variant = 'default',
113
- size = 'medium',
114
- disabled = false,
115
- inactiveText,
116
- selected = undefined,
117
- active = false,
118
- onSelect: onSelectUser,
119
- id,
120
- role,
121
- loading,
122
- _PrivateItemWrapper,
123
- className,
124
- groupId: _groupId,
125
- renderItem: _renderItem,
126
- handleAddItem: _handleAddItem,
127
- ...props
128
- }, forwardedRef) => {
111
+ const baseSlots = {
112
+ leadingVisual: LeadingVisual,
113
+ trailingVisual: TrailingVisual,
114
+ trailingAction: TrailingAction,
115
+ subItem: SubItem
116
+ };
117
+ const slotsConfig = {
118
+ ...baseSlots,
119
+ description: Description
120
+ };
121
+
122
+ // Pre-allocated array for selectableRoles check, avoids per-render allocation
123
+ const selectableRoles = ['menuitemradio', 'menuitemcheckbox', 'option'];
124
+ const listRoleTypes = ['listbox', 'menu', 'list'];
125
+ const UnwrappedItem = (t0, forwardedRef) => {
129
126
  var _slots$trailingVisual, _slots$description$pr, _slots$description;
130
- const baseSlots = {
131
- leadingVisual: LeadingVisual,
132
- trailingVisual: TrailingVisual,
133
- trailingAction: TrailingAction,
134
- subItem: SubItem
135
- };
136
- const [partialSlots, childrenWithoutSlots] = useSlots(props.children, {
137
- ...baseSlots,
138
- description: Description
139
- });
140
- const slots = {
141
- description: undefined,
142
- ...partialSlots
143
- };
127
+ const $ = c(152);
128
+ let _PrivateItemWrapper;
129
+ let className;
130
+ let id;
131
+ let inactiveText;
132
+ let loading;
133
+ let onSelectUser;
134
+ let props;
135
+ let role;
136
+ let t1;
137
+ let t2;
138
+ let t3;
139
+ let t4;
140
+ let t5;
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;
144
220
  const {
145
221
  container,
146
222
  afterSelect,
147
223
  selectionAttribute,
148
224
  defaultTrailingVisual
149
225
  } = React.useContext(ActionListContainerContext);
150
-
151
- // Be sure to avoid rendering the container unless there is a default
152
- const wrappedDefaultTrailingVisual = defaultTrailingVisual ? /*#__PURE__*/jsx(TrailingVisual, {
153
- children: defaultTrailingVisual
154
- }) : null;
226
+ let t7;
227
+ if ($[16] !== defaultTrailingVisual) {
228
+ t7 = defaultTrailingVisual ? /*#__PURE__*/jsx(TrailingVisual, {
229
+ children: defaultTrailingVisual
230
+ }) : null;
231
+ $[16] = defaultTrailingVisual;
232
+ $[17] = t7;
233
+ } else {
234
+ t7 = $[17];
235
+ }
236
+ const wrappedDefaultTrailingVisual = t7;
155
237
  const trailingVisual = (_slots$trailingVisual = slots.trailingVisual) !== null && _slots$trailingVisual !== void 0 ? _slots$trailingVisual : wrappedDefaultTrailingVisual;
156
238
  const {
157
239
  role: listRole,
@@ -161,57 +243,127 @@ const UnwrappedItem = ({
161
243
  selectionVariant: groupSelectionVariant
162
244
  } = React.useContext(GroupContext);
163
245
  const inactive = Boolean(inactiveText);
164
- // TODO change `menuContext` check to ```listRole !== undefined && ['menu', 'listbox'].includes(listRole)```
165
- // once we have a better way to handle existing usage in dotcom that incorrectly use ActionList.TrailingAction
166
- const menuContext = container === 'ActionMenu' || container === 'SelectPanel' || container === 'FilteredActionList';
167
- // TODO: when we change `menuContext` to check `listRole` instead of `container`
168
- const showInactiveIndicator = inactive && !(listRole !== undefined && ['menu', 'listbox'].includes(listRole));
169
- const onSelect = React.useCallback((event, afterSelect_0) => {
170
- if (typeof onSelectUser === 'function') onSelectUser(event);
171
- if (event.defaultPrevented) return;
172
- if (typeof afterSelect_0 === 'function') afterSelect_0(event);
173
- }, [onSelectUser]);
246
+ const menuContext = container === "ActionMenu" || container === "SelectPanel" || container === "FilteredActionList";
247
+ let t8;
248
+ if ($[18] !== inactive || $[19] !== listRole) {
249
+ t8 = inactive && !(listRole !== undefined && ["menu", "listbox"].includes(listRole));
250
+ $[18] = inactive;
251
+ $[19] = listRole;
252
+ $[20] = t8;
253
+ } else {
254
+ t8 = $[20];
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;
174
276
  const selectionVariant = groupSelectionVariant ? groupSelectionVariant : listSelectionVariant;
175
-
176
- /** Infer item role based on the container */
177
277
  let inferredItemRole;
178
- if (container === 'ActionMenu') {
179
- if (selectionVariant === 'single') inferredItemRole = 'menuitemradio';else if (selectionVariant === 'multiple') inferredItemRole = 'menuitemcheckbox';else inferredItemRole = 'menuitem';
180
- } else if (listRole === 'listbox') {
181
- if (selectionVariant !== undefined && !role) inferredItemRole = 'option';
182
- } else if (listRole === 'tablist') {
183
- inferredItemRole = 'tab';
278
+ if (container === "ActionMenu") {
279
+ if (selectionVariant === "single") {
280
+ inferredItemRole = "menuitemradio";
281
+ } else {
282
+ if (selectionVariant === "multiple") {
283
+ inferredItemRole = "menuitemcheckbox";
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
+ }
184
298
  }
185
299
  const itemRole = role || inferredItemRole;
186
300
  if (slots.trailingAction) {
187
- !!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;
301
+ !!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;
188
302
  }
189
-
190
- /** Infer the proper selection attribute based on the item's role */
191
303
  let inferredSelectionAttribute;
192
- if (itemRole === 'menuitemradio' || itemRole === 'menuitemcheckbox') inferredSelectionAttribute = 'aria-checked';else if (itemRole === 'option') inferredSelectionAttribute = 'aria-selected';
304
+ if (itemRole === "menuitemradio" || itemRole === "menuitemcheckbox") {
305
+ inferredSelectionAttribute = "aria-checked";
306
+ } else {
307
+ if (itemRole === "option") {
308
+ inferredSelectionAttribute = "aria-selected";
309
+ }
310
+ }
193
311
  const itemSelectionAttribute = selectionAttribute || inferredSelectionAttribute;
194
- // Ensures ActionList.Item retains list item semantics if a valid ARIA role is applied, or if item is inactive
195
- const listItemSemantics = itemRole === 'option' || itemRole === 'menuitem' || itemRole === 'menuitemradio' || itemRole === 'menuitemcheckbox' || itemRole === 'tab';
196
- const listRoleTypes = ['listbox', 'menu', 'list'];
197
- const listSemantics = listRole && listRoleTypes.includes(listRole) || inactive || listItemSemantics;
312
+ const listItemSemantics = itemRole === "option" || itemRole === "menuitem" || itemRole === "menuitemradio" || itemRole === "menuitemcheckbox" || itemRole === "tab";
313
+ let t10;
314
+ if ($[23] !== inactive || $[24] !== listItemSemantics || $[25] !== listRole) {
315
+ t10 = listRole && listRoleTypes.includes(listRole) || inactive || listItemSemantics;
316
+ $[23] = inactive;
317
+ $[24] = listItemSemantics;
318
+ $[25] = listRole;
319
+ $[26] = t10;
320
+ } else {
321
+ t10 = $[26];
322
+ }
323
+ const listSemantics = t10;
198
324
  const buttonSemantics = !listSemantics && !_PrivateItemWrapper;
199
- const clickHandler = React.useCallback(event_0 => {
200
- if (disabled || inactive || loading) return;
201
- onSelect(event_0, afterSelect);
202
- }, [onSelect, disabled, inactive, afterSelect, loading]);
203
- const keyPressHandler = React.useCallback(event_1 => {
204
- if (disabled || inactive || loading) return;
205
- if ([' ', 'Enter'].includes(event_1.key)) {
206
- if (event_1.key === ' ') {
207
- event_1.preventDefault(); // prevent scrolling on Space
208
- // immediately reset defaultPrevented once its job is done
209
- // so as to not disturb the functions that use that event after this
210
- event_1.defaultPrevented = false;
325
+ let t11;
326
+ if ($[27] !== afterSelect || $[28] !== disabled || $[29] !== inactive || $[30] !== loading || $[31] !== onSelect) {
327
+ t11 = event_0 => {
328
+ if (disabled || inactive || loading) {
329
+ return;
211
330
  }
212
- onSelect(event_1, afterSelect);
213
- }
214
- }, [onSelect, disabled, loading, inactive, afterSelect]);
331
+ onSelect(event_0, afterSelect);
332
+ };
333
+ $[27] = afterSelect;
334
+ $[28] = disabled;
335
+ $[29] = inactive;
336
+ $[30] = loading;
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;
348
+ }
349
+ if (event_1.key === " " || event_1.key === "Enter") {
350
+ if (event_1.key === " ") {
351
+ event_1.preventDefault();
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;
215
367
  const itemId = useId(id);
216
368
  const labelId = `${itemId}--label`;
217
369
  const inlineDescriptionId = `${itemId}--inline-description`;
@@ -220,121 +372,380 @@ const UnwrappedItem = ({
220
372
  const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
221
373
  const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
222
374
  const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
223
-
224
- // only apply aria-selected and aria-checked to selectable items
225
- const selectableRoles = ['menuitemradio', 'menuitemcheckbox', 'option'];
226
- const includeSelectionAttribute = itemSelectionAttribute && itemRole && selectableRoles.includes(itemRole);
227
- let focusable;
228
- if (showInactiveIndicator) {
229
- focusable = true;
375
+ let t13;
376
+ if ($[39] !== itemRole || $[40] !== itemSelectionAttribute) {
377
+ t13 = itemSelectionAttribute && itemRole && selectableRoles.includes(itemRole);
378
+ $[39] = itemRole;
379
+ $[40] = itemSelectionAttribute;
380
+ $[41] = t13;
381
+ } else {
382
+ t13 = $[41];
230
383
  }
231
-
232
- // Extract the variant prop value from the description slot component
233
- 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';
234
- const menuItemProps = {
235
- onClick: clickHandler,
236
- onKeyPress: !buttonSemantics ? keyPressHandler : undefined,
237
- 'aria-disabled': disabled ? true : undefined,
238
- 'data-inactive': inactive ? true : undefined,
239
- 'data-loading': loading && !inactive ? true : undefined,
240
- tabIndex: focusable ? undefined : 0,
241
- 'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''} ${slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : ''}`,
242
- 'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
243
- ...(includeSelectionAttribute && {
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];
425
+ }
426
+ const ariaDescribedBy = parts_0.length > 0 ? parts_0.join(" ") : undefined;
427
+ const t14 = !buttonSemantics ? keyPressHandler : undefined;
428
+ const t15 = disabled ? true : undefined;
429
+ const t16 = inactive ? true : undefined;
430
+ const t17 = loading && !inactive ? true : undefined;
431
+ const t18 = focusable ? undefined : 0;
432
+ let t19;
433
+ if ($[54] !== includeSelectionAttribute || $[55] !== itemSelectionAttribute || $[56] !== selected) {
434
+ t19 = includeSelectionAttribute && {
244
435
  [itemSelectionAttribute]: selected
245
- }),
246
- role: itemRole,
247
- id: itemId
248
- };
249
- const containerProps = _PrivateItemWrapper ? {
250
- role: itemRole ? 'none' : undefined,
251
- ...props
252
- } :
253
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
254
- listSemantics && {
255
- ...menuItemProps,
256
- ...props,
257
- ref: forwardedRef
258
- } || {};
259
- const wrapperProps = _PrivateItemWrapper ? menuItemProps : !listSemantics && {
260
- ...menuItemProps,
261
- ...props,
262
- ref: forwardedRef
263
- };
264
- return /*#__PURE__*/jsx(ItemContext.Provider, {
265
- value: {
436
+ };
437
+ $[54] = includeSelectionAttribute;
438
+ $[55] = itemSelectionAttribute;
439
+ $[56] = selected;
440
+ $[57] = t19;
441
+ } else {
442
+ t19 = $[57];
443
+ }
444
+ let t20;
445
+ if ($[58] !== ariaDescribedBy || $[59] !== ariaLabelledBy || $[60] !== clickHandler || $[61] !== itemId || $[62] !== itemRole || $[63] !== t14 || $[64] !== t15 || $[65] !== t16 || $[66] !== t17 || $[67] !== t18 || $[68] !== t19) {
446
+ t20 = {
447
+ onClick: clickHandler,
448
+ onKeyPress: t14,
449
+ "aria-disabled": t15,
450
+ "data-inactive": t16,
451
+ "data-loading": t17,
452
+ tabIndex: t18,
453
+ "aria-labelledby": ariaLabelledBy,
454
+ "aria-describedby": ariaDescribedBy,
455
+ ...t19,
456
+ role: itemRole,
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 = {
266
517
  variant,
267
518
  size,
268
519
  disabled,
269
- inactive: Boolean(inactiveText),
520
+ inactive: t23,
270
521
  inlineDescriptionId,
271
522
  blockDescriptionId,
272
523
  trailingVisualId
273
- },
274
- children: /*#__PURE__*/jsxs("li", {
524
+ };
525
+ $[83] = blockDescriptionId;
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 = disabled ? true : undefined;
542
+ const t30 = slots.subItem ? true : undefined;
543
+ const t31 = slots.description ? true : false;
544
+ let t32;
545
+ if ($[91] !== className) {
546
+ t32 = clsx(classes.ActionListItem, className);
547
+ $[91] = className;
548
+ $[92] = t32;
549
+ } else {
550
+ t32 = $[92];
551
+ }
552
+ let t33;
553
+ if ($[93] === Symbol.for("react.memo_cache_sentinel")) {
554
+ t33 = /*#__PURE__*/jsx("span", {
555
+ className: classes.Spacer
556
+ });
557
+ $[93] = t33;
558
+ } else {
559
+ t33 = $[93];
560
+ }
561
+ let t34;
562
+ if ($[94] !== selected) {
563
+ t34 = /*#__PURE__*/jsx(Selection, {
564
+ selected: selected,
565
+ className: classes.LeadingAction
566
+ });
567
+ $[94] = selected;
568
+ $[95] = t34;
569
+ } else {
570
+ t34 = $[95];
571
+ }
572
+ const t35 = showInactiveIndicator ? inactiveText : undefined;
573
+ const t36 = Boolean(slots.leadingVisual);
574
+ let t37;
575
+ if ($[96] !== labelId || $[97] !== loading || $[98] !== slots.leadingVisual || $[99] !== t35 || $[100] !== t36) {
576
+ t37 = /*#__PURE__*/jsx(VisualOrIndicator, {
577
+ inactiveText: t35,
578
+ itemHasLeadingVisual: t36,
579
+ labelId: labelId,
580
+ loading: loading,
581
+ position: "leading",
582
+ children: slots.leadingVisual
583
+ });
584
+ $[96] = labelId;
585
+ $[97] = loading;
586
+ $[98] = slots.leadingVisual;
587
+ $[99] = t35;
588
+ $[100] = t36;
589
+ $[101] = t37;
590
+ } else {
591
+ t37 = $[101];
592
+ }
593
+ const t38 = !!slots.description;
594
+ let t39;
595
+ if ($[102] !== inactive || $[103] !== loading) {
596
+ t39 = loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
597
+ children: "Loading"
598
+ });
599
+ $[102] = inactive;
600
+ $[103] = loading;
601
+ $[104] = t39;
602
+ } else {
603
+ t39 = $[104];
604
+ }
605
+ let t40;
606
+ if ($[105] !== childrenWithoutSlots || $[106] !== labelId || $[107] !== t39) {
607
+ t40 = /*#__PURE__*/jsxs("span", {
608
+ id: labelId,
609
+ className: classes.ItemLabel,
610
+ children: [childrenWithoutSlots, t39]
611
+ });
612
+ $[105] = childrenWithoutSlots;
613
+ $[106] = labelId;
614
+ $[107] = t39;
615
+ $[108] = t40;
616
+ } else {
617
+ t40 = $[108];
618
+ }
619
+ let t41;
620
+ if ($[109] !== descriptionVariant || $[110] !== slots.description || $[111] !== t38 || $[112] !== t40) {
621
+ t41 = /*#__PURE__*/jsxs(ConditionalWrapper, {
622
+ if: t38,
623
+ className: classes.ItemDescriptionWrap,
624
+ "data-description-variant": descriptionVariant,
625
+ children: [t40, slots.description]
626
+ });
627
+ $[109] = descriptionVariant;
628
+ $[110] = slots.description;
629
+ $[111] = t38;
630
+ $[112] = t40;
631
+ $[113] = t41;
632
+ } else {
633
+ t41 = $[113];
634
+ }
635
+ const t42 = showInactiveIndicator ? inactiveText : undefined;
636
+ const t43 = Boolean(slots.leadingVisual);
637
+ let t44;
638
+ if ($[114] !== labelId || $[115] !== loading || $[116] !== t42 || $[117] !== t43 || $[118] !== trailingVisual) {
639
+ t44 = /*#__PURE__*/jsx(VisualOrIndicator, {
640
+ inactiveText: t42,
641
+ itemHasLeadingVisual: t43,
642
+ labelId: labelId,
643
+ loading: loading,
644
+ position: "trailing",
645
+ children: trailingVisual
646
+ });
647
+ $[114] = labelId;
648
+ $[115] = loading;
649
+ $[116] = t42;
650
+ $[117] = t43;
651
+ $[118] = trailingVisual;
652
+ $[119] = t44;
653
+ } else {
654
+ t44 = $[119];
655
+ }
656
+ let t45;
657
+ if ($[120] !== inactiveText || $[121] !== inactiveWarningId || $[122] !== showInactiveIndicator) {
658
+ t45 = !showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
659
+ className: classes.InactiveWarning,
660
+ id: inactiveWarningId,
661
+ children: inactiveText
662
+ }) : null;
663
+ $[120] = inactiveText;
664
+ $[121] = inactiveWarningId;
665
+ $[122] = showInactiveIndicator;
666
+ $[123] = t45;
667
+ } else {
668
+ t45 = $[123];
669
+ }
670
+ let t46;
671
+ if ($[124] !== t41 || $[125] !== t44 || $[126] !== t45) {
672
+ t46 = /*#__PURE__*/jsxs("span", {
673
+ className: classes.ActionListSubContent,
674
+ "data-component": "ActionList.Item--DividerContainer",
675
+ children: [t41, t44, t45]
676
+ });
677
+ $[124] = t41;
678
+ $[125] = t44;
679
+ $[126] = t45;
680
+ $[127] = t46;
681
+ } else {
682
+ t46 = $[127];
683
+ }
684
+ let t47;
685
+ if ($[128] !== ItemWrapper || $[129] !== forwardedRef || $[130] !== size || $[131] !== t34 || $[132] !== t37 || $[133] !== t46 || $[134] !== wrapperProps) {
686
+ t47 = /*#__PURE__*/jsxs(ItemWrapper, {
687
+ ...wrapperProps,
688
+ className: classes.ActionListContent,
689
+ "data-size": size,
690
+ ref: forwardedRef,
691
+ children: [t33, t34, t37, t46]
692
+ });
693
+ $[128] = ItemWrapper;
694
+ $[129] = forwardedRef;
695
+ $[130] = size;
696
+ $[131] = t34;
697
+ $[132] = t37;
698
+ $[133] = t46;
699
+ $[134] = wrapperProps;
700
+ $[135] = t47;
701
+ } else {
702
+ t47 = $[135];
703
+ }
704
+ const t48 = !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction;
705
+ let t49;
706
+ if ($[136] !== containerProps || $[137] !== slots.subItem || $[138] !== t25 || $[139] !== t26 || $[140] !== t27 || $[141] !== t28 || $[142] !== t29 || $[143] !== t30 || $[144] !== t31 || $[145] !== t32 || $[146] !== t47 || $[147] !== t48) {
707
+ t49 = /*#__PURE__*/jsxs("li", {
275
708
  ...containerProps,
276
- ref: listSemantics ? forwardedRef : null,
277
- "data-variant": variant === 'danger' ? variant : undefined,
278
- "data-active": active ? true : undefined,
279
- "data-inactive": inactiveText ? true : undefined,
280
- "data-is-disabled": disabled ? true : undefined,
281
- "data-has-subitem": slots.subItem ? true : undefined,
282
- "data-has-description": slots.description ? true : false,
283
- className: clsx(classes.ActionListItem, className),
284
- children: [/*#__PURE__*/jsxs(ItemWrapper, {
285
- ...wrapperProps,
286
- className: classes.ActionListContent,
287
- "data-size": size
288
- // @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
289
- ,
290
- ref: forwardedRef,
291
- children: [/*#__PURE__*/jsx("span", {
292
- className: classes.Spacer
293
- }), /*#__PURE__*/jsx(Selection, {
294
- selected: selected,
295
- className: classes.LeadingAction
296
- }), /*#__PURE__*/jsx(VisualOrIndicator, {
297
- inactiveText: showInactiveIndicator ? inactiveText : undefined,
298
- itemHasLeadingVisual: Boolean(slots.leadingVisual),
299
- labelId: labelId,
300
- loading: loading,
301
- position: "leading",
302
- children: slots.leadingVisual
303
- }), /*#__PURE__*/jsxs("span", {
304
- className: classes.ActionListSubContent,
305
- "data-component": "ActionList.Item--DividerContainer",
306
- children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
307
- if: !!slots.description,
308
- className: classes.ItemDescriptionWrap,
309
- "data-description-variant": descriptionVariant,
310
- children: [/*#__PURE__*/jsxs("span", {
311
- id: labelId,
312
- className: classes.ItemLabel,
313
- children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
314
- children: "Loading"
315
- })]
316
- }), slots.description]
317
- }), /*#__PURE__*/jsx(VisualOrIndicator, {
318
- inactiveText: showInactiveIndicator ? inactiveText : undefined,
319
- itemHasLeadingVisual: Boolean(slots.leadingVisual),
320
- labelId: labelId,
321
- loading: loading,
322
- position: "trailing",
323
- children: trailingVisual
324
- }),
325
- // If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
326
- // render the inactive warning message directly in the item.
327
- !showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
328
- className: classes.InactiveWarning,
329
- id: inactiveWarningId,
330
- children: inactiveText
331
- }) : null]
332
- })]
333
- }), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
334
- })
335
- });
709
+ ref: t25,
710
+ "data-variant": t26,
711
+ "data-active": t27,
712
+ "data-inactive": t28,
713
+ "data-is-disabled": t29,
714
+ "data-has-subitem": t30,
715
+ "data-has-description": t31,
716
+ className: t32,
717
+ children: [t47, t48, slots.subItem]
718
+ });
719
+ $[136] = containerProps;
720
+ $[137] = slots.subItem;
721
+ $[138] = t25;
722
+ $[139] = t26;
723
+ $[140] = t27;
724
+ $[141] = t28;
725
+ $[142] = t29;
726
+ $[143] = t30;
727
+ $[144] = t31;
728
+ $[145] = t32;
729
+ $[146] = t47;
730
+ $[147] = t48;
731
+ $[148] = t49;
732
+ } else {
733
+ t49 = $[148];
734
+ }
735
+ let t50;
736
+ if ($[149] !== itemContextValue || $[150] !== t49) {
737
+ t50 = /*#__PURE__*/jsx(ItemContext.Provider, {
738
+ value: itemContextValue,
739
+ children: t49
740
+ });
741
+ $[149] = itemContextValue;
742
+ $[150] = t49;
743
+ $[151] = t50;
744
+ } else {
745
+ t50 = $[151];
746
+ }
747
+ return t50;
336
748
  };
337
- UnwrappedItem.displayName = "UnwrappedItem";
338
749
  const Item = Object.assign(fixedForwardRef(UnwrappedItem), {
339
750
  displayName: 'ActionList.Item',
340
751
  __SLOT__: Symbol('ActionList.Item')
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAoFrC,QAAA,MAAM,IAAI,GAxEa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDAwER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
1
+ {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAuFrC,QAAA,MAAM,IAAI,GA3Ea,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDA2ER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
@@ -131,6 +131,7 @@ const UnwrappedList = (props, forwardedRef) => {
131
131
  } else {
132
132
  t9 = $[20];
133
133
  }
134
+ const listContextValue = t9;
134
135
  const t10 = slots.heading;
135
136
  let t11;
136
137
  if ($[21] !== className) {
@@ -166,14 +167,14 @@ const UnwrappedList = (props, forwardedRef) => {
166
167
  t12 = $[32];
167
168
  }
168
169
  let t13;
169
- if ($[33] !== slots.heading || $[34] !== t12 || $[35] !== t9) {
170
+ if ($[33] !== listContextValue || $[34] !== slots.heading || $[35] !== t12) {
170
171
  t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
171
- value: t9,
172
+ value: listContextValue,
172
173
  children: [t10, t12]
173
174
  });
174
- $[33] = slots.heading;
175
- $[34] = t12;
176
- $[35] = t9;
175
+ $[33] = listContextValue;
176
+ $[34] = slots.heading;
177
+ $[35] = t12;
177
178
  $[36] = t13;
178
179
  } else {
179
180
  t13 = $[36];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260306091436",
4
+ "version": "0.0.0-20260306110315",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",