@primer/react 0.0.0-20260615211732 → 0.0.0-20260615221322
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 +14 -13
- package/dist/ActionList/LinkItem.d.ts +1 -1
- package/dist/ActionList/List.d.ts +11 -2
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/index.d.ts +24 -4
- package/dist/ActionList/index.d.ts.map +1 -1
- package/dist/BranchName/BranchName.d.ts +4 -2
- package/dist/BranchName/BranchName.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +10 -4
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Card/Card.d.ts +20 -2
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/index.d.ts +8 -2
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionListLoaders-a46a8ea4.css +2 -0
- package/dist/FilteredActionList/FilteredActionListLoaders-a46a8ea4.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionListLoaders.js +1 -1
- package/dist/FilteredActionList/FilteredActionListLoaders.module.css.js +2 -2
- package/dist/Link/Link.d.ts +1 -1
- package/dist/NavList/NavList.d.ts +8 -2
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/Radio/Radio.d.ts.map +1 -1
- package/dist/Radio/Radio.js +2 -1
- package/dist/RadioGroup/RadioGroup.js +1 -0
- package/dist/RelativeTime/RelativeTime.js +1 -0
- package/dist/ScrollableRegion/ScrollableRegion.d.ts.map +1 -1
- package/dist/ScrollableRegion/ScrollableRegion.js +1 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +1 -0
- package/dist/SegmentedControl/SegmentedControlButton.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.js +1 -0
- package/dist/SegmentedControl/SegmentedControlIconButton.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlIconButton.js +1 -0
- package/dist/Select/Select.d.ts.map +1 -1
- package/dist/Select/Select.js +6 -2
- package/dist/SideNav.d.ts.map +1 -1
- package/dist/SideNav.js +2 -0
- package/dist/Skeleton/SkeletonBox.d.ts +1 -0
- package/dist/Skeleton/SkeletonBox.d.ts.map +1 -1
- package/dist/Skeleton/SkeletonBox.js +54 -47
- package/dist/SkeletonText/SkeletonText.js +2 -3
- package/dist/Spinner/Spinner.js +1 -0
- package/dist/Text/Text.d.ts +7 -2
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/TreeView/TreeView.d.ts +2 -11
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +166 -198
- package/dist/utils/modern-polymorphic.d.ts +1 -1
- package/dist/utils/modern-polymorphic.d.ts.map +1 -1
- package/package.json +2 -4
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css +0 -2
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css.map +0 -1
|
@@ -17,7 +17,6 @@ import { ButtonComponent } from '../Button/Button.js';
|
|
|
17
17
|
import { ActionList } from '../ActionList/index.js';
|
|
18
18
|
import { usePlatform } from '../KeybindingHint/platform.js';
|
|
19
19
|
import { isSlot } from '../utils/is-slot.js';
|
|
20
|
-
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
21
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
22
21
|
import { getAccessibleKeybindingHintString } from '../KeybindingHint/utils.js';
|
|
23
22
|
import { AriaStatus } from '../live-region/AriaStatus.js';
|
|
@@ -266,17 +265,7 @@ Root.displayName = 'TreeView';
|
|
|
266
265
|
// ----------------------------------------------------------------------------
|
|
267
266
|
// TreeView.Item
|
|
268
267
|
|
|
269
|
-
|
|
270
|
-
// `ref` and `onSelect` from the underlying element's props:
|
|
271
|
-
// - `ref` is provided solely by `fixedForwardRef` (typed as `Ref<unknown>`), preserving
|
|
272
|
-
// backward compatibility with consumers that pass `Ref<HTMLElement>` rather than the
|
|
273
|
-
// intrinsic element's ref type (e.g. `Ref<HTMLLIElement>` for the default `<li>`).
|
|
274
|
-
// - Our custom `onSelect` (typed against `HTMLElement`) replaces the native
|
|
275
|
-
// `ReactEventHandler<HTMLLIElement>` that would otherwise be intersected in
|
|
276
|
-
// and conflict with existing consumers.
|
|
277
|
-
// `DistributiveOmit` keeps the omit distributing over `as` union types.
|
|
278
|
-
|
|
279
|
-
const ItemImpl = fixedForwardRef(({
|
|
268
|
+
const Item = /*#__PURE__*/React.forwardRef(({
|
|
280
269
|
id: itemId,
|
|
281
270
|
containIntrinsicSize,
|
|
282
271
|
current: isCurrentItem = false,
|
|
@@ -288,18 +277,8 @@ const ItemImpl = fixedForwardRef(({
|
|
|
288
277
|
className,
|
|
289
278
|
'aria-label': ariaLabel,
|
|
290
279
|
'aria-labelledby': ariaLabelledby,
|
|
291
|
-
secondaryActions
|
|
292
|
-
as: Component,
|
|
293
|
-
...restProps
|
|
280
|
+
secondaryActions
|
|
294
281
|
}, ref) => {
|
|
295
|
-
// When `as` is provided, we render the polymorphic element as the
|
|
296
|
-
// `role="treeitem"` and wrap it in an `<li role="none">` so the markup
|
|
297
|
-
// remains valid (a `<ul role="tree">` may only directly contain `<li>`
|
|
298
|
-
// elements). When `as` is not provided we render an `<li>` directly as
|
|
299
|
-
// the treeitem to preserve the historical DOM shape and ref typing for
|
|
300
|
-
// existing consumers.
|
|
301
|
-
const ItemElement = Component !== null && Component !== void 0 ? Component : 'li';
|
|
302
|
-
const isPolymorphic = Component !== undefined;
|
|
303
282
|
const [slots, rest] = useSlots(children, {
|
|
304
283
|
leadingAction: LeadingAction,
|
|
305
284
|
leadingVisual: LeadingVisual,
|
|
@@ -341,7 +320,9 @@ const ItemImpl = fixedForwardRef(({
|
|
|
341
320
|
const platform = usePlatform();
|
|
342
321
|
|
|
343
322
|
// Set the expanded state and cache it
|
|
344
|
-
const setIsExpandedWithCache = React.useCallback(
|
|
323
|
+
const setIsExpandedWithCache = React.useCallback(
|
|
324
|
+
// eslint-disable-next-line react-hooks/preserve-manual-memoization
|
|
325
|
+
newIsExpanded => {
|
|
345
326
|
var _expandedStateCache$c3;
|
|
346
327
|
setIsExpanded(newIsExpanded);
|
|
347
328
|
(_expandedStateCache$c3 = expandedStateCache.current) === null || _expandedStateCache$c3 === void 0 ? void 0 : _expandedStateCache$c3.set(itemId, newIsExpanded);
|
|
@@ -364,34 +345,34 @@ const ItemImpl = fixedForwardRef(({
|
|
|
364
345
|
action();
|
|
365
346
|
}
|
|
366
347
|
}, [secondaryActions]);
|
|
367
|
-
const handleKeyDown = React.useCallback(
|
|
368
|
-
switch (
|
|
348
|
+
const handleKeyDown = React.useCallback(event_0 => {
|
|
349
|
+
switch (event_0.key) {
|
|
369
350
|
case 'Enter':
|
|
370
351
|
case ' ':
|
|
371
352
|
if (onSelect) {
|
|
372
|
-
onSelect(
|
|
353
|
+
onSelect(event_0);
|
|
373
354
|
} else {
|
|
374
|
-
toggle(
|
|
355
|
+
toggle(event_0);
|
|
375
356
|
}
|
|
376
|
-
|
|
357
|
+
event_0.stopPropagation();
|
|
377
358
|
break;
|
|
378
359
|
case 'ArrowRight':
|
|
379
360
|
// Ignore if modifier keys are pressed
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
|
|
361
|
+
if (event_0.altKey || event_0.metaKey) return;
|
|
362
|
+
event_0.preventDefault();
|
|
363
|
+
event_0.stopPropagation();
|
|
383
364
|
setIsExpandedWithCache(true);
|
|
384
365
|
break;
|
|
385
366
|
case 'ArrowLeft':
|
|
386
367
|
// Ignore if modifier keys are pressed
|
|
387
|
-
if (
|
|
388
|
-
|
|
389
|
-
|
|
368
|
+
if (event_0.altKey || event_0.metaKey) return;
|
|
369
|
+
event_0.preventDefault();
|
|
370
|
+
event_0.stopPropagation();
|
|
390
371
|
setIsExpandedWithCache(false);
|
|
391
372
|
break;
|
|
392
373
|
case 'U':
|
|
393
374
|
case 'u':
|
|
394
|
-
if (!(
|
|
375
|
+
if (!(event_0.shiftKey && (event_0.metaKey || event_0.ctrlKey))) return;
|
|
395
376
|
activateActionsDialog();
|
|
396
377
|
break;
|
|
397
378
|
}
|
|
@@ -399,104 +380,6 @@ const ItemImpl = fixedForwardRef(({
|
|
|
399
380
|
const ariaDescribedByIds = [slots.leadingVisual ? leadingVisualId : null, slots.trailingVisual ? trailingVisualId : null].filter(Boolean);
|
|
400
381
|
const shortcut = `Shift+${platform === 'apple' ? 'Meta' : 'Control'}+U`;
|
|
401
382
|
const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut, platform)}) for more actions.`;
|
|
402
|
-
const itemElement =
|
|
403
|
-
/*#__PURE__*/
|
|
404
|
-
// @ts-ignore Box doesn't have type support for `ref` used in combination with `as`
|
|
405
|
-
jsxs(ItemElement, {
|
|
406
|
-
className: clsx('PRIVATE_TreeView-item', className, classes.TreeViewItem),
|
|
407
|
-
ref: ref,
|
|
408
|
-
tabIndex: 0,
|
|
409
|
-
id: itemId,
|
|
410
|
-
role: "treeitem",
|
|
411
|
-
"aria-label": secondaryActions ? ariaLabel ? `${ariaLabel}. ${trailingActionShortcutText}` : undefined : ariaLabel,
|
|
412
|
-
"aria-labelledby": ariaLabel ? undefined : `${ariaLabelledby || labelId} ${secondaryActions ? trailingActionId : ''}`.trim(),
|
|
413
|
-
"aria-describedby": ariaDescribedByIds.length ? ariaDescribedByIds.join(' ') : undefined,
|
|
414
|
-
"aria-level": level,
|
|
415
|
-
"aria-expanded": isSubTreeEmpty && (!isExpanded || !hasSubTree) || expanded === null ? undefined : isExpanded,
|
|
416
|
-
"aria-current": isCurrentItem ? 'true' : undefined,
|
|
417
|
-
"aria-selected": isFocused ? 'true' : 'false',
|
|
418
|
-
"data-has-leading-action": slots.leadingAction ? true : undefined,
|
|
419
|
-
"data-loading": isLoadingPlaceholder ? true : undefined,
|
|
420
|
-
onKeyDown: handleKeyDown,
|
|
421
|
-
onFocus: event => {
|
|
422
|
-
// Defer scroll to the next animation frame so that rapid keyboard
|
|
423
|
-
// navigation (held key) coalesces into a single reflow per frame
|
|
424
|
-
scrollElementIntoView(event.currentTarget.firstElementChild);
|
|
425
|
-
|
|
426
|
-
// Set the focused state
|
|
427
|
-
setIsFocused(true);
|
|
428
|
-
|
|
429
|
-
// Prevent focus event from bubbling up to parent items
|
|
430
|
-
event.stopPropagation();
|
|
431
|
-
},
|
|
432
|
-
onBlur: () => setIsFocused(false),
|
|
433
|
-
onClick: event => {
|
|
434
|
-
if (onSelect) {
|
|
435
|
-
onSelect(event);
|
|
436
|
-
} else {
|
|
437
|
-
toggle(event);
|
|
438
|
-
}
|
|
439
|
-
event.stopPropagation();
|
|
440
|
-
},
|
|
441
|
-
onAuxClick: event => {
|
|
442
|
-
if (onSelect && event.button === 1) {
|
|
443
|
-
onSelect(event);
|
|
444
|
-
}
|
|
445
|
-
event.stopPropagation();
|
|
446
|
-
},
|
|
447
|
-
...restProps,
|
|
448
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
449
|
-
className: clsx('PRIVATE_TreeView-item-container', classes.TreeViewItemContainer),
|
|
450
|
-
style: {
|
|
451
|
-
// @ts-ignore CSS custom property
|
|
452
|
-
'--level': level,
|
|
453
|
-
contentVisibility: containIntrinsicSize ? 'auto' : undefined,
|
|
454
|
-
containIntrinsicSize
|
|
455
|
-
},
|
|
456
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
457
|
-
style: {
|
|
458
|
-
gridArea: 'spacer',
|
|
459
|
-
display: 'flex'
|
|
460
|
-
},
|
|
461
|
-
children: /*#__PURE__*/jsx(LevelIndicatorLines, {
|
|
462
|
-
level: level
|
|
463
|
-
})
|
|
464
|
-
}), slots.leadingAction, hasSubTree ?
|
|
465
|
-
/*#__PURE__*/
|
|
466
|
-
// This lint rule is disabled due to the guidelines in the `TreeView` api docs.
|
|
467
|
-
// https://github.com/github/primer/blob/main/apis/tree-view-api.md#the-expandcollapse-chevron-toggle
|
|
468
|
-
// This has specific advice that the chevron be available only to pointer event.
|
|
469
|
-
// If they take up a button role, they become unnecessary and numerous tab stops.
|
|
470
|
-
jsx("div", {
|
|
471
|
-
className: clsx('PRIVATE_TreeView-item-toggle', onSelect && 'PRIVATE_TreeView-item-toggle--hover', level === 1 && 'PRIVATE_TreeView-item-toggle--end', classes.TreeViewItemToggle, classes.TreeViewItemToggleHover, classes.TreeViewItemToggleEnd),
|
|
472
|
-
onClick: event => {
|
|
473
|
-
if (onSelect) {
|
|
474
|
-
toggle(event);
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
children: isExpanded ? /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
478
|
-
size: TOGGLE_ICON_SIZE
|
|
479
|
-
}) : /*#__PURE__*/jsx(ChevronRightIcon, {
|
|
480
|
-
size: TOGGLE_ICON_SIZE
|
|
481
|
-
})
|
|
482
|
-
}) : null, /*#__PURE__*/jsxs("div", {
|
|
483
|
-
id: labelId,
|
|
484
|
-
className: clsx('PRIVATE_TreeView-item-content', classes.TreeViewItemContent),
|
|
485
|
-
children: [slots.leadingVisual, /*#__PURE__*/jsx("span", {
|
|
486
|
-
className: clsx('PRIVATE_TreeView-item-content-text', classes.TreeViewItemContentText),
|
|
487
|
-
children: childrenWithoutSubTree
|
|
488
|
-
}), slots.trailingVisual]
|
|
489
|
-
}), secondaryActions ? /*#__PURE__*/jsxs(Fragment, {
|
|
490
|
-
children: [/*#__PURE__*/jsx(TrailingAction, {
|
|
491
|
-
items: secondaryActions,
|
|
492
|
-
shortcutText: trailingActionShortcutText
|
|
493
|
-
}), actionCommandPressed ? /*#__PURE__*/jsx(ActionDialog, {
|
|
494
|
-
items: secondaryActions,
|
|
495
|
-
onClose: () => setActionCommandPressed(false)
|
|
496
|
-
}) : null]
|
|
497
|
-
}) : null]
|
|
498
|
-
}), subTree]
|
|
499
|
-
});
|
|
500
383
|
return /*#__PURE__*/jsx(ItemContext.Provider, {
|
|
501
384
|
value: {
|
|
502
385
|
itemId,
|
|
@@ -509,15 +392,102 @@ const ItemImpl = fixedForwardRef(({
|
|
|
509
392
|
trailingVisualId,
|
|
510
393
|
trailingActionId
|
|
511
394
|
},
|
|
512
|
-
children:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
395
|
+
children: /*#__PURE__*/jsxs("li", {
|
|
396
|
+
className: clsx('PRIVATE_TreeView-item', className, classes.TreeViewItem),
|
|
397
|
+
ref: ref,
|
|
398
|
+
tabIndex: 0,
|
|
399
|
+
id: itemId,
|
|
400
|
+
role: "treeitem",
|
|
401
|
+
"aria-label": secondaryActions ? ariaLabel ? `${ariaLabel}. ${trailingActionShortcutText}` : undefined : ariaLabel,
|
|
402
|
+
"aria-labelledby": ariaLabel ? undefined : `${ariaLabelledby || labelId} ${secondaryActions ? trailingActionId : ''}`.trim(),
|
|
403
|
+
"aria-describedby": ariaDescribedByIds.length ? ariaDescribedByIds.join(' ') : undefined,
|
|
404
|
+
"aria-level": level,
|
|
405
|
+
"aria-expanded": isSubTreeEmpty && (!isExpanded || !hasSubTree) || expanded === null ? undefined : isExpanded,
|
|
406
|
+
"aria-current": isCurrentItem ? 'true' : undefined,
|
|
407
|
+
"aria-selected": isFocused ? 'true' : 'false',
|
|
408
|
+
"data-has-leading-action": slots.leadingAction ? true : undefined,
|
|
409
|
+
"data-loading": isLoadingPlaceholder ? true : undefined,
|
|
410
|
+
onKeyDown: handleKeyDown,
|
|
411
|
+
onFocus: event_1 => {
|
|
412
|
+
// Defer scroll to the next animation frame so that rapid keyboard
|
|
413
|
+
// navigation (held key) coalesces into a single reflow per frame
|
|
414
|
+
scrollElementIntoView(event_1.currentTarget.firstElementChild);
|
|
415
|
+
|
|
416
|
+
// Set the focused state
|
|
417
|
+
setIsFocused(true);
|
|
418
|
+
|
|
419
|
+
// Prevent focus event from bubbling up to parent items
|
|
420
|
+
event_1.stopPropagation();
|
|
421
|
+
},
|
|
422
|
+
onBlur: () => setIsFocused(false),
|
|
423
|
+
onClick: event_2 => {
|
|
424
|
+
if (onSelect) {
|
|
425
|
+
onSelect(event_2);
|
|
426
|
+
} else {
|
|
427
|
+
toggle(event_2);
|
|
428
|
+
}
|
|
429
|
+
event_2.stopPropagation();
|
|
430
|
+
},
|
|
431
|
+
onAuxClick: event_3 => {
|
|
432
|
+
if (onSelect && event_3.button === 1) {
|
|
433
|
+
onSelect(event_3);
|
|
434
|
+
}
|
|
435
|
+
event_3.stopPropagation();
|
|
436
|
+
},
|
|
437
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
438
|
+
className: clsx('PRIVATE_TreeView-item-container', classes.TreeViewItemContainer),
|
|
439
|
+
style: {
|
|
440
|
+
// @ts-ignore CSS custom property
|
|
441
|
+
'--level': level,
|
|
442
|
+
contentVisibility: containIntrinsicSize ? 'auto' : undefined,
|
|
443
|
+
containIntrinsicSize
|
|
444
|
+
},
|
|
445
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
446
|
+
style: {
|
|
447
|
+
gridArea: 'spacer',
|
|
448
|
+
display: 'flex'
|
|
449
|
+
},
|
|
450
|
+
children: /*#__PURE__*/jsx(LevelIndicatorLines, {
|
|
451
|
+
level: level
|
|
452
|
+
})
|
|
453
|
+
}), slots.leadingAction, hasSubTree ?
|
|
454
|
+
/*#__PURE__*/
|
|
455
|
+
// This lint rule is disabled due to the guidelines in the `TreeView` api docs.
|
|
456
|
+
// https://github.com/github/primer/blob/main/apis/tree-view-api.md#the-expandcollapse-chevron-toggle
|
|
457
|
+
// This has specific advice that the chevron be available only to pointer event.
|
|
458
|
+
// If they take up a button role, they become unnecessary and numerous tab stops.
|
|
459
|
+
jsx("div", {
|
|
460
|
+
className: clsx('PRIVATE_TreeView-item-toggle', onSelect && 'PRIVATE_TreeView-item-toggle--hover', level === 1 && 'PRIVATE_TreeView-item-toggle--end', classes.TreeViewItemToggle, classes.TreeViewItemToggleHover, classes.TreeViewItemToggleEnd),
|
|
461
|
+
onClick: event_4 => {
|
|
462
|
+
if (onSelect) {
|
|
463
|
+
toggle(event_4);
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
children: isExpanded ? /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
467
|
+
size: TOGGLE_ICON_SIZE
|
|
468
|
+
}) : /*#__PURE__*/jsx(ChevronRightIcon, {
|
|
469
|
+
size: TOGGLE_ICON_SIZE
|
|
470
|
+
})
|
|
471
|
+
}) : null, /*#__PURE__*/jsxs("div", {
|
|
472
|
+
id: labelId,
|
|
473
|
+
className: clsx('PRIVATE_TreeView-item-content', classes.TreeViewItemContent),
|
|
474
|
+
children: [slots.leadingVisual, /*#__PURE__*/jsx("span", {
|
|
475
|
+
className: clsx('PRIVATE_TreeView-item-content-text', classes.TreeViewItemContentText),
|
|
476
|
+
children: childrenWithoutSubTree
|
|
477
|
+
}), slots.trailingVisual]
|
|
478
|
+
}), secondaryActions ? /*#__PURE__*/jsxs(Fragment, {
|
|
479
|
+
children: [/*#__PURE__*/jsx(TrailingAction, {
|
|
480
|
+
items: secondaryActions,
|
|
481
|
+
shortcutText: trailingActionShortcutText
|
|
482
|
+
}), actionCommandPressed ? /*#__PURE__*/jsx(ActionDialog, {
|
|
483
|
+
items: secondaryActions,
|
|
484
|
+
onClose: () => setActionCommandPressed(false)
|
|
485
|
+
}) : null]
|
|
486
|
+
}) : null]
|
|
487
|
+
}), subTree]
|
|
488
|
+
})
|
|
516
489
|
});
|
|
517
490
|
});
|
|
518
|
-
const Item = Object.assign(ItemImpl, {
|
|
519
|
-
displayName: 'TreeView.Item'
|
|
520
|
-
});
|
|
521
491
|
|
|
522
492
|
/** Lines to indicate the depth of an item in a TreeView */
|
|
523
493
|
const LevelIndicatorLines = t0 => {
|
|
@@ -550,6 +520,7 @@ const LevelIndicatorLines = t0 => {
|
|
|
550
520
|
}
|
|
551
521
|
return t2;
|
|
552
522
|
};
|
|
523
|
+
Item.displayName = 'TreeView.Item';
|
|
553
524
|
|
|
554
525
|
// ----------------------------------------------------------------------------
|
|
555
526
|
// TreeView.SubTree
|
|
@@ -784,121 +755,118 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
784
755
|
} = t0;
|
|
785
756
|
const itemId = useId();
|
|
786
757
|
if (count) {
|
|
787
|
-
|
|
788
|
-
let t2;
|
|
758
|
+
let t1;
|
|
789
759
|
if ($[0] !== count) {
|
|
790
|
-
|
|
760
|
+
t1 = Array.from({
|
|
791
761
|
length: count
|
|
792
762
|
}).map(_temp3);
|
|
793
763
|
$[0] = count;
|
|
794
|
-
$[1] =
|
|
764
|
+
$[1] = t1;
|
|
795
765
|
} else {
|
|
796
|
-
|
|
766
|
+
t1 = $[1];
|
|
797
767
|
}
|
|
798
|
-
let
|
|
768
|
+
let t2;
|
|
799
769
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
800
|
-
|
|
801
|
-
$[2] =
|
|
770
|
+
t2 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
|
|
771
|
+
$[2] = t2;
|
|
802
772
|
} else {
|
|
803
|
-
|
|
773
|
+
t2 = $[2];
|
|
804
774
|
}
|
|
805
|
-
let
|
|
775
|
+
let t3;
|
|
806
776
|
if ($[3] !== count) {
|
|
807
|
-
|
|
808
|
-
className:
|
|
777
|
+
t3 = /*#__PURE__*/jsxs("div", {
|
|
778
|
+
className: t2,
|
|
809
779
|
children: ["Loading ", count, " items"]
|
|
810
780
|
});
|
|
811
781
|
$[3] = count;
|
|
812
|
-
$[4] =
|
|
782
|
+
$[4] = t3;
|
|
813
783
|
} else {
|
|
814
|
-
|
|
784
|
+
t3 = $[4];
|
|
815
785
|
}
|
|
816
|
-
let
|
|
817
|
-
if ($[5] !== itemId || $[6] !==
|
|
818
|
-
|
|
786
|
+
let t4;
|
|
787
|
+
if ($[5] !== itemId || $[6] !== ref || $[7] !== t1 || $[8] !== t3) {
|
|
788
|
+
t4 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
819
789
|
value: true,
|
|
820
790
|
children: /*#__PURE__*/jsxs(Item, {
|
|
821
791
|
id: itemId,
|
|
822
|
-
ref:
|
|
823
|
-
children: [
|
|
792
|
+
ref: ref,
|
|
793
|
+
children: [t1, t3]
|
|
824
794
|
})
|
|
825
795
|
});
|
|
826
796
|
$[5] = itemId;
|
|
827
|
-
$[6] =
|
|
828
|
-
$[7] =
|
|
829
|
-
$[8] =
|
|
830
|
-
$[9] =
|
|
797
|
+
$[6] = ref;
|
|
798
|
+
$[7] = t1;
|
|
799
|
+
$[8] = t3;
|
|
800
|
+
$[9] = t4;
|
|
831
801
|
} else {
|
|
832
|
-
|
|
802
|
+
t4 = $[9];
|
|
833
803
|
}
|
|
834
|
-
return
|
|
804
|
+
return t4;
|
|
835
805
|
}
|
|
836
|
-
|
|
806
|
+
let t1;
|
|
837
807
|
let t2;
|
|
838
|
-
let t3;
|
|
839
808
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
840
|
-
|
|
809
|
+
t1 = /*#__PURE__*/jsx(LeadingVisual, {
|
|
841
810
|
children: /*#__PURE__*/jsx(Spinner, {
|
|
842
811
|
size: "small"
|
|
843
812
|
})
|
|
844
813
|
});
|
|
845
|
-
|
|
814
|
+
t2 = /*#__PURE__*/jsx(Text, {
|
|
846
815
|
className: "fgColor-muted",
|
|
847
816
|
children: "Loading..."
|
|
848
817
|
});
|
|
849
|
-
$[10] =
|
|
850
|
-
$[11] =
|
|
818
|
+
$[10] = t1;
|
|
819
|
+
$[11] = t2;
|
|
851
820
|
} else {
|
|
852
|
-
|
|
853
|
-
|
|
821
|
+
t1 = $[10];
|
|
822
|
+
t2 = $[11];
|
|
854
823
|
}
|
|
855
|
-
let
|
|
856
|
-
if ($[12] !== itemId || $[13] !==
|
|
857
|
-
|
|
824
|
+
let t3;
|
|
825
|
+
if ($[12] !== itemId || $[13] !== ref) {
|
|
826
|
+
t3 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
858
827
|
value: true,
|
|
859
828
|
children: /*#__PURE__*/jsxs(Item, {
|
|
860
829
|
id: itemId,
|
|
861
|
-
ref:
|
|
862
|
-
children: [
|
|
830
|
+
ref: ref,
|
|
831
|
+
children: [t1, t2]
|
|
863
832
|
})
|
|
864
833
|
});
|
|
865
834
|
$[12] = itemId;
|
|
866
|
-
$[13] =
|
|
867
|
-
$[14] =
|
|
835
|
+
$[13] = ref;
|
|
836
|
+
$[14] = t3;
|
|
868
837
|
} else {
|
|
869
|
-
|
|
838
|
+
t3 = $[14];
|
|
870
839
|
}
|
|
871
|
-
return
|
|
840
|
+
return t3;
|
|
872
841
|
});
|
|
873
842
|
const EmptyItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
874
843
|
const $ = c(4);
|
|
875
844
|
const t0 = useId();
|
|
876
|
-
|
|
877
|
-
let t2;
|
|
845
|
+
let t1;
|
|
878
846
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
879
|
-
|
|
847
|
+
t1 = /*#__PURE__*/jsx(Text, {
|
|
880
848
|
className: "fgColor-muted",
|
|
881
849
|
children: "No items found"
|
|
882
850
|
});
|
|
883
|
-
$[0] =
|
|
851
|
+
$[0] = t1;
|
|
884
852
|
} else {
|
|
885
|
-
|
|
853
|
+
t1 = $[0];
|
|
886
854
|
}
|
|
887
|
-
let
|
|
888
|
-
if ($[1] !==
|
|
889
|
-
|
|
855
|
+
let t2;
|
|
856
|
+
if ($[1] !== ref || $[2] !== t0) {
|
|
857
|
+
t2 = /*#__PURE__*/jsx(Item, {
|
|
890
858
|
expanded: null,
|
|
891
859
|
id: t0,
|
|
892
|
-
ref:
|
|
893
|
-
children:
|
|
860
|
+
ref: ref,
|
|
861
|
+
children: t1
|
|
894
862
|
});
|
|
895
|
-
$[1] =
|
|
896
|
-
$[2] =
|
|
897
|
-
$[3] =
|
|
863
|
+
$[1] = ref;
|
|
864
|
+
$[2] = t0;
|
|
865
|
+
$[3] = t2;
|
|
898
866
|
} else {
|
|
899
|
-
|
|
867
|
+
t2 = $[3];
|
|
900
868
|
}
|
|
901
|
-
return
|
|
869
|
+
return t2;
|
|
902
870
|
});
|
|
903
871
|
function useSubTree(children) {
|
|
904
872
|
const $ = c(8);
|
|
@@ -2,7 +2,7 @@ import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Distributive Omit utility type that works correctly with union types
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omit<T, TOmitted> : never;
|
|
6
6
|
/**
|
|
7
7
|
* Fixed version of forwardRef that provides better type inference for polymorphic components
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modern-polymorphic.d.ts","sourceRoot":"","sources":["../../src/utils/modern-polymorphic.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,qBAAqB,EAAE,WAAW,EAAC,MAAM,OAAO,CAAA;AAE7D;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"modern-polymorphic.d.ts","sourceRoot":"","sources":["../../src/utils/modern-polymorphic.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,qBAAqB,EAAE,WAAW,EAAC,MAAM,OAAO,CAAA;AAE7D;;GAEG;AACH,KAAK,gBAAgB,CAAC,CAAC,EAAE,QAAQ,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAA;AAEtG;;GAEG;AAGH,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EACnC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,KACrD,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,EAAiB,eAAe,CAAA;AAE5D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAC1B,GAAG,SAAS,WAAW,EACvB,eAAe,SAAS,WAAW,GAAG,KAAK,EAC3C,KAAK,GAAG,MAAM,IACZ,gBAAgB,CAAC,qBAAqB,CAAC,WAAW,SAAS,GAAG,GAAG,eAAe,GAAG,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG;IAC3G,EAAE,CAAC,EAAE,GAAG,CAAA;CACT,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260615221322",
|
|
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",
|
|
@@ -108,7 +108,6 @@
|
|
|
108
108
|
"@figma/code-connect": "1.3.2",
|
|
109
109
|
"@primer/css": "^21.5.1",
|
|
110
110
|
"@primer/doc-gen": "^0.0.1",
|
|
111
|
-
"@rolldown/plugin-babel": "^0.2.3",
|
|
112
111
|
"@rollup/plugin-babel": "6.1.0",
|
|
113
112
|
"@rollup/plugin-commonjs": "29.0.0",
|
|
114
113
|
"@rollup/plugin-json": "6.1.0",
|
|
@@ -126,7 +125,6 @@
|
|
|
126
125
|
"@testing-library/react": "^16.3.0",
|
|
127
126
|
"@testing-library/react-hooks": "^8.0.1",
|
|
128
127
|
"@testing-library/user-event": "^14.5.2",
|
|
129
|
-
"@types/babel__core": "^7.20.5",
|
|
130
128
|
"@types/lodash.groupby": "4.6.9",
|
|
131
129
|
"@types/lodash.isempty": "4.4.9",
|
|
132
130
|
"@types/lodash.isobject": "3.0.9",
|
|
@@ -135,7 +133,7 @@
|
|
|
135
133
|
"@types/react": "18.3.11",
|
|
136
134
|
"@types/react-dom": "18.3.1",
|
|
137
135
|
"@types/react-is": "18.3.1",
|
|
138
|
-
"@vitejs/plugin-react": "^
|
|
136
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
139
137
|
"afterframe": "^1.0.2",
|
|
140
138
|
"ajv": "8.18.0",
|
|
141
139
|
"axe-core": "4.9.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-FilteredActionList-LoadingSkeleton-VKyQq{border-radius:4px;width:var(--loading-skeleton-width)}.prc-FilteredActionList-LoadingSkeletonRow-yQoJ-{--loading-skeleton-width:80%}.prc-FilteredActionList-LoadingSkeletonRow-yQoJ-:nth-of-type(5n+2){--loading-skeleton-width:52.5%}.prc-FilteredActionList-LoadingSkeletonRow-yQoJ-:nth-of-type(5n+3){--loading-skeleton-width:67.5%}.prc-FilteredActionList-LoadingSkeletonRow-yQoJ-:nth-of-type(5n+4){--loading-skeleton-width:40%}.prc-FilteredActionList-LoadingSkeletonRow-yQoJ-:nth-of-type(5n+5){--loading-skeleton-width:72.5%}.prc-FilteredActionList-LoadingSpinner-I3a7Y{align-content:center;flex-grow:1;height:100%;padding:var(--base-size-16,1rem);text-align:center}.prc-FilteredActionList-LoadingSkeletonContainer-FMeRG{display:flex;flex-direction:column;flex-grow:1;padding:var(--base-size-8,.5rem)}
|
|
2
|
-
/*# sourceMappingURL=FilteredActionListLoaders-bdda3d7e.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/FilteredActionList/FilteredActionListLoaders.module.css.js"],"names":[],"mappings":"AAAA,8CAGE,iBAAkB,CAFlB,mCAGF,CAEA,iDACE,4BAiBF,CAfE,mEACE,8BACF,CAEA,mEACE,8BACF,CAEA,mEACE,4BACF,CAEA,mEACE,8BACF,CAGF,6CAGE,oBAAqB,CADrB,WAAY,CAGZ,WAAY,CAJZ,gCAA4B,CAG5B,iBAEF,CAEA,uDAEE,YAAa,CAEb,qBAAsB,CADtB,WAAY,CAFZ,gCAIF","file":"FilteredActionListLoaders-bdda3d7e.css","sourcesContent":[".LoadingSkeleton {\n width: var(--loading-skeleton-width);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 4px;\n}\n\n.LoadingSkeletonRow {\n --loading-skeleton-width: 80%;\n\n &:nth-of-type(5n + 2) {\n --loading-skeleton-width: 52.5%;\n }\n\n &:nth-of-type(5n + 3) {\n --loading-skeleton-width: 67.5%;\n }\n\n &:nth-of-type(5n + 4) {\n --loading-skeleton-width: 40%;\n }\n\n &:nth-of-type(5n + 5) {\n --loading-skeleton-width: 72.5%;\n }\n}\n\n.LoadingSpinner {\n padding: var(--base-size-16);\n flex-grow: 1;\n align-content: center;\n text-align: center;\n height: 100%;\n}\n\n.LoadingSkeletonContainer {\n padding: var(--base-size-8);\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n}\n"]}
|