@primer/react 0.0.0-20260622173611 → 0.0.0-20260622180940
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 +3 -34
- package/dist/ActionList/ActionList-65f7daac.css +1 -1
- package/dist/ActionList/ActionList-65f7daac.css.map +1 -1
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/ActionList/Description.d.ts.map +1 -1
- package/dist/ActionList/GroupHeadingTrailingAction.js +14 -20
- 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/TrailingAction.d.ts +1 -2
- package/dist/ActionList/TrailingAction.d.ts.map +1 -1
- package/dist/ActionList/TrailingAction.js +31 -37
- package/dist/ActionList/index.d.ts +24 -4
- package/dist/ActionList/index.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-83281f45.css +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-83281f45.css.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -8
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +1 -3
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +1 -7
- package/dist/AvatarStack/AvatarStack-9bb5649f.css +1 -1
- package/dist/AvatarStack/AvatarStack-9bb5649f.css.map +1 -1
- package/dist/AvatarStack/AvatarStack.d.ts.map +1 -1
- package/dist/AvatarStack/AvatarStack.js +0 -1
- package/dist/BaseStyles-fda34843.css +1 -1
- package/dist/BaseStyles-fda34843.css.map +1 -1
- package/dist/Blankslate/Blankslate-a039d79a.css +2 -0
- package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
- package/dist/Blankslate/Blankslate.module.css.js +1 -1
- package/dist/BranchName/BranchName-2fad4f4b.css +1 -1
- package/dist/BranchName/BranchName-2fad4f4b.css.map +1 -1
- package/dist/BranchName/BranchName.d.ts +4 -2
- package/dist/BranchName/BranchName.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs-54395fc6.css +1 -1
- package/dist/Breadcrumbs/Breadcrumbs-54395fc6.css.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +10 -4
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +149 -330
- package/dist/Button/ButtonBase-311501b9.css +1 -1
- package/dist/Button/ButtonBase-311501b9.css.map +1 -1
- package/dist/Button/ButtonBase.module.css.js +1 -1
- package/dist/ButtonGroup/ButtonGroup-54ba293b.css +1 -1
- package/dist/ButtonGroup/ButtonGroup-54ba293b.css.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/Checkbox/Checkbox-edc5dc3e.css +1 -1
- package/dist/Checkbox/Checkbox-edc5dc3e.css.map +1 -1
- package/dist/CircleBadge/CircleBadge.d.ts +1 -1
- package/dist/CircleBadge/CircleBadge.d.ts.map +1 -1
- package/dist/CircleBadge/CircleBadge.js +1 -2
- package/dist/DataTable/storybook/data.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +1 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +0 -4
- 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/FilteredActionList/useAnnouncements.d.ts.map +1 -1
- package/dist/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/LabelGroup/LabelGroup.js +0 -5
- package/dist/Link/Link-ba423096.css +1 -1
- package/dist/Link/Link-ba423096.css.map +1 -1
- 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/Overlay/Overlay-214d10dd.css +1 -1
- package/dist/Overlay/Overlay-214d10dd.css.map +1 -1
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/Popover/Popover-a93df39c.css +1 -1
- package/dist/Popover/Popover-a93df39c.css.map +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts +2 -2
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +6 -26
- package/dist/SideNav-baa2364d.css +1 -1
- package/dist/SideNav-baa2364d.css.map +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/SubNav/SubNav-88128e5c.css +1 -1
- package/dist/SubNav/SubNav-88128e5c.css.map +1 -1
- package/dist/Text/Text.d.ts +7 -2
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Timeline/Timeline-ff81db92.css +1 -1
- package/dist/Timeline/Timeline-ff81db92.css.map +1 -1
- package/dist/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
- package/dist/Token/IssueLabelToken-10cfada5.css +1 -1
- package/dist/Token/IssueLabelToken-10cfada5.css.map +1 -1
- package/dist/Token/_TokenTextContainer-55ce2de3.css +1 -1
- package/dist/Token/_TokenTextContainer-55ce2de3.css.map +1 -1
- package/dist/Token/_TokenTextContainer.module.css.js +1 -1
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +0 -1
- package/dist/TreeView/TreeView-1bf45a33.css +1 -1
- package/dist/TreeView/TreeView-1bf45a33.css.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 -201
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +2 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +331 -91
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -1
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +4 -1
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +44 -1
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +38 -33
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/index.d.ts +1 -1
- package/dist/UnderlineNav/index.d.ts.map +1 -1
- package/dist/UnderlineNav/styles.d.ts +16 -0
- package/dist/UnderlineNav/styles.d.ts.map +1 -0
- package/dist/UnderlineNav/styles.js +19 -0
- package/dist/UnderlineNav/types.d.ts +10 -0
- package/dist/UnderlineNav/types.d.ts.map +1 -0
- package/dist/UnderlineNav/utils.d.ts +0 -2
- package/dist/UnderlineNav/utils.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.js +1 -2
- package/dist/deprecated/ActionList/Group.d.ts +1 -1
- package/dist/deprecated/ActionList/Group.d.ts.map +1 -1
- package/dist/deprecated/ActionList/Group.js +5 -9
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -4
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -3
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +2 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +1 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +11 -8
- package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
- package/dist/hooks/useControllableState.d.ts.map +1 -1
- package/dist/hooks/useControllableState.js +0 -2
- package/dist/hooks/useDetails.d.ts.map +1 -1
- package/dist/hooks/useDialog.d.ts.map +1 -1
- package/dist/hooks/useFocusZone.d.ts.map +1 -1
- package/dist/hooks/useFocusZone.js +1 -3
- package/dist/hooks/useMenuInitialFocus.d.ts.map +1 -1
- package/dist/hooks/useMenuInitialFocus.js +0 -1
- package/dist/hooks/useMergedRefs.js +30 -17
- package/dist/hooks/useMnemonics.d.ts.map +1 -1
- package/dist/internal/components/TextInputWrapper-b2f7f9fa.css +1 -1
- package/dist/internal/components/TextInputWrapper-b2f7f9fa.css.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +60 -66
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/StressTest.d.ts.map +1 -1
- package/dist/utils/descendant-registry.d.ts.map +1 -1
- package/dist/utils/form-story-helpers.d.ts +1 -2
- package/dist/utils/form-story-helpers.d.ts.map +1 -1
- package/dist/utils/modern-polymorphic.d.ts +1 -1
- package/dist/utils/modern-polymorphic.d.ts.map +1 -1
- package/dist/utils/story-helpers.d.ts +1 -2
- package/dist/utils/story-helpers.d.ts.map +1 -1
- package/generated/components.json +8 -20
- package/package.json +3 -5
- package/dist/Blankslate/Blankslate-11d7a7fd.css +0 -2
- package/dist/Blankslate/Blankslate-11d7a7fd.css.map +0 -1
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css +0 -2
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts +0 -51
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +0 -8
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +0 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.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,19 +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 (and resolves to something other than the default
|
|
296
|
-
// `'li'`), we render the polymorphic element as the `role="treeitem"` and
|
|
297
|
-
// wrap it in an `<li role="none">` so the markup remains valid (a
|
|
298
|
-
// `<ul role="tree">` may only directly contain `<li>` elements). When `as`
|
|
299
|
-
// is omitted, or explicitly set to `'li'`, we render an `<li>` directly as
|
|
300
|
-
// the treeitem to preserve the historical DOM shape and ref typing for
|
|
301
|
-
// existing consumers and to avoid nesting `<li>` inside `<li>`.
|
|
302
|
-
const ItemElement = Component !== null && Component !== void 0 ? Component : 'li';
|
|
303
|
-
const isPolymorphic = Component !== undefined && Component !== 'li';
|
|
304
282
|
const [slots, rest] = useSlots(children, {
|
|
305
283
|
leadingAction: LeadingAction,
|
|
306
284
|
leadingVisual: LeadingVisual,
|
|
@@ -342,7 +320,9 @@ const ItemImpl = fixedForwardRef(({
|
|
|
342
320
|
const platform = usePlatform();
|
|
343
321
|
|
|
344
322
|
// Set the expanded state and cache it
|
|
345
|
-
const setIsExpandedWithCache = React.useCallback(
|
|
323
|
+
const setIsExpandedWithCache = React.useCallback(
|
|
324
|
+
// eslint-disable-next-line react-hooks/preserve-manual-memoization
|
|
325
|
+
newIsExpanded => {
|
|
346
326
|
var _expandedStateCache$c3;
|
|
347
327
|
setIsExpanded(newIsExpanded);
|
|
348
328
|
(_expandedStateCache$c3 = expandedStateCache.current) === null || _expandedStateCache$c3 === void 0 ? void 0 : _expandedStateCache$c3.set(itemId, newIsExpanded);
|
|
@@ -365,34 +345,34 @@ const ItemImpl = fixedForwardRef(({
|
|
|
365
345
|
action();
|
|
366
346
|
}
|
|
367
347
|
}, [secondaryActions]);
|
|
368
|
-
const handleKeyDown = React.useCallback(
|
|
369
|
-
switch (
|
|
348
|
+
const handleKeyDown = React.useCallback(event_0 => {
|
|
349
|
+
switch (event_0.key) {
|
|
370
350
|
case 'Enter':
|
|
371
351
|
case ' ':
|
|
372
352
|
if (onSelect) {
|
|
373
|
-
onSelect(
|
|
353
|
+
onSelect(event_0);
|
|
374
354
|
} else {
|
|
375
|
-
toggle(
|
|
355
|
+
toggle(event_0);
|
|
376
356
|
}
|
|
377
|
-
|
|
357
|
+
event_0.stopPropagation();
|
|
378
358
|
break;
|
|
379
359
|
case 'ArrowRight':
|
|
380
360
|
// Ignore if modifier keys are pressed
|
|
381
|
-
if (
|
|
382
|
-
|
|
383
|
-
|
|
361
|
+
if (event_0.altKey || event_0.metaKey) return;
|
|
362
|
+
event_0.preventDefault();
|
|
363
|
+
event_0.stopPropagation();
|
|
384
364
|
setIsExpandedWithCache(true);
|
|
385
365
|
break;
|
|
386
366
|
case 'ArrowLeft':
|
|
387
367
|
// Ignore if modifier keys are pressed
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
|
|
368
|
+
if (event_0.altKey || event_0.metaKey) return;
|
|
369
|
+
event_0.preventDefault();
|
|
370
|
+
event_0.stopPropagation();
|
|
391
371
|
setIsExpandedWithCache(false);
|
|
392
372
|
break;
|
|
393
373
|
case 'U':
|
|
394
374
|
case 'u':
|
|
395
|
-
if (!(
|
|
375
|
+
if (!(event_0.shiftKey && (event_0.metaKey || event_0.ctrlKey))) return;
|
|
396
376
|
activateActionsDialog();
|
|
397
377
|
break;
|
|
398
378
|
}
|
|
@@ -400,106 +380,6 @@ const ItemImpl = fixedForwardRef(({
|
|
|
400
380
|
const ariaDescribedByIds = [slots.leadingVisual ? leadingVisualId : null, slots.trailingVisual ? trailingVisualId : null].filter(Boolean);
|
|
401
381
|
const shortcut = `Shift+${platform === 'apple' ? 'Meta' : 'Control'}+U`;
|
|
402
382
|
const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut, platform)}) for more actions.`;
|
|
403
|
-
const itemElement =
|
|
404
|
-
/*#__PURE__*/
|
|
405
|
-
// @ts-ignore TypeScript can't infer that the `ref` here is compatible
|
|
406
|
-
// with every possible polymorphic `ItemElement` (it's typed as
|
|
407
|
-
// `Ref<unknown>` by `fixedForwardRef`), so we cast at the boundary.
|
|
408
|
-
jsxs(ItemElement, {
|
|
409
|
-
...restProps,
|
|
410
|
-
className: clsx('PRIVATE_TreeView-item', className, classes.TreeViewItem),
|
|
411
|
-
ref: ref,
|
|
412
|
-
tabIndex: 0,
|
|
413
|
-
id: itemId,
|
|
414
|
-
role: "treeitem",
|
|
415
|
-
"aria-label": secondaryActions ? ariaLabel ? `${ariaLabel}. ${trailingActionShortcutText}` : undefined : ariaLabel,
|
|
416
|
-
"aria-labelledby": ariaLabel ? undefined : `${ariaLabelledby || labelId} ${secondaryActions ? trailingActionId : ''}`.trim(),
|
|
417
|
-
"aria-describedby": ariaDescribedByIds.length ? ariaDescribedByIds.join(' ') : undefined,
|
|
418
|
-
"aria-level": level,
|
|
419
|
-
"aria-expanded": isSubTreeEmpty && (!isExpanded || !hasSubTree) || expanded === null ? undefined : isExpanded,
|
|
420
|
-
"aria-current": isCurrentItem ? 'true' : undefined,
|
|
421
|
-
"aria-selected": isFocused ? 'true' : 'false',
|
|
422
|
-
"data-has-leading-action": slots.leadingAction ? true : undefined,
|
|
423
|
-
"data-loading": isLoadingPlaceholder ? true : undefined,
|
|
424
|
-
onKeyDown: handleKeyDown,
|
|
425
|
-
onFocus: event => {
|
|
426
|
-
// Defer scroll to the next animation frame so that rapid keyboard
|
|
427
|
-
// navigation (held key) coalesces into a single reflow per frame
|
|
428
|
-
scrollElementIntoView(event.currentTarget.firstElementChild);
|
|
429
|
-
|
|
430
|
-
// Set the focused state
|
|
431
|
-
setIsFocused(true);
|
|
432
|
-
|
|
433
|
-
// Prevent focus event from bubbling up to parent items
|
|
434
|
-
event.stopPropagation();
|
|
435
|
-
},
|
|
436
|
-
onBlur: () => setIsFocused(false),
|
|
437
|
-
onClick: event => {
|
|
438
|
-
if (onSelect) {
|
|
439
|
-
onSelect(event);
|
|
440
|
-
} else {
|
|
441
|
-
toggle(event);
|
|
442
|
-
}
|
|
443
|
-
event.stopPropagation();
|
|
444
|
-
},
|
|
445
|
-
onAuxClick: event => {
|
|
446
|
-
if (onSelect && event.button === 1) {
|
|
447
|
-
onSelect(event);
|
|
448
|
-
}
|
|
449
|
-
event.stopPropagation();
|
|
450
|
-
},
|
|
451
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
452
|
-
className: clsx('PRIVATE_TreeView-item-container', classes.TreeViewItemContainer),
|
|
453
|
-
style: {
|
|
454
|
-
// @ts-ignore CSS custom property
|
|
455
|
-
'--level': level,
|
|
456
|
-
contentVisibility: containIntrinsicSize ? 'auto' : undefined,
|
|
457
|
-
containIntrinsicSize
|
|
458
|
-
},
|
|
459
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
460
|
-
style: {
|
|
461
|
-
gridArea: 'spacer',
|
|
462
|
-
display: 'flex'
|
|
463
|
-
},
|
|
464
|
-
children: /*#__PURE__*/jsx(LevelIndicatorLines, {
|
|
465
|
-
level: level
|
|
466
|
-
})
|
|
467
|
-
}), slots.leadingAction, hasSubTree ?
|
|
468
|
-
/*#__PURE__*/
|
|
469
|
-
// This lint rule is disabled due to the guidelines in the `TreeView` api docs.
|
|
470
|
-
// https://github.com/github/primer/blob/main/apis/tree-view-api.md#the-expandcollapse-chevron-toggle
|
|
471
|
-
// This has specific advice that the chevron be available only to pointer event.
|
|
472
|
-
// If they take up a button role, they become unnecessary and numerous tab stops.
|
|
473
|
-
jsx("div", {
|
|
474
|
-
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),
|
|
475
|
-
onClick: event => {
|
|
476
|
-
if (onSelect) {
|
|
477
|
-
toggle(event);
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
children: isExpanded ? /*#__PURE__*/jsx(ChevronDownIcon, {
|
|
481
|
-
size: TOGGLE_ICON_SIZE
|
|
482
|
-
}) : /*#__PURE__*/jsx(ChevronRightIcon, {
|
|
483
|
-
size: TOGGLE_ICON_SIZE
|
|
484
|
-
})
|
|
485
|
-
}) : null, /*#__PURE__*/jsxs("div", {
|
|
486
|
-
id: labelId,
|
|
487
|
-
className: clsx('PRIVATE_TreeView-item-content', classes.TreeViewItemContent),
|
|
488
|
-
children: [slots.leadingVisual, /*#__PURE__*/jsx("span", {
|
|
489
|
-
className: clsx('PRIVATE_TreeView-item-content-text', classes.TreeViewItemContentText),
|
|
490
|
-
children: childrenWithoutSubTree
|
|
491
|
-
}), slots.trailingVisual]
|
|
492
|
-
}), secondaryActions ? /*#__PURE__*/jsxs(Fragment, {
|
|
493
|
-
children: [/*#__PURE__*/jsx(TrailingAction, {
|
|
494
|
-
items: secondaryActions,
|
|
495
|
-
shortcutText: trailingActionShortcutText
|
|
496
|
-
}), actionCommandPressed ? /*#__PURE__*/jsx(ActionDialog, {
|
|
497
|
-
items: secondaryActions,
|
|
498
|
-
onClose: () => setActionCommandPressed(false)
|
|
499
|
-
}) : null]
|
|
500
|
-
}) : null]
|
|
501
|
-
}), subTree]
|
|
502
|
-
});
|
|
503
383
|
return /*#__PURE__*/jsx(ItemContext.Provider, {
|
|
504
384
|
value: {
|
|
505
385
|
itemId,
|
|
@@ -512,15 +392,102 @@ const ItemImpl = fixedForwardRef(({
|
|
|
512
392
|
trailingVisualId,
|
|
513
393
|
trailingActionId
|
|
514
394
|
},
|
|
515
|
-
children:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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
|
+
})
|
|
519
489
|
});
|
|
520
490
|
});
|
|
521
|
-
const Item = Object.assign(ItemImpl, {
|
|
522
|
-
displayName: 'TreeView.Item'
|
|
523
|
-
});
|
|
524
491
|
|
|
525
492
|
/** Lines to indicate the depth of an item in a TreeView */
|
|
526
493
|
const LevelIndicatorLines = t0 => {
|
|
@@ -553,6 +520,7 @@ const LevelIndicatorLines = t0 => {
|
|
|
553
520
|
}
|
|
554
521
|
return t2;
|
|
555
522
|
};
|
|
523
|
+
Item.displayName = 'TreeView.Item';
|
|
556
524
|
|
|
557
525
|
// ----------------------------------------------------------------------------
|
|
558
526
|
// TreeView.SubTree
|
|
@@ -787,121 +755,118 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
787
755
|
} = t0;
|
|
788
756
|
const itemId = useId();
|
|
789
757
|
if (count) {
|
|
790
|
-
|
|
791
|
-
let t2;
|
|
758
|
+
let t1;
|
|
792
759
|
if ($[0] !== count) {
|
|
793
|
-
|
|
760
|
+
t1 = Array.from({
|
|
794
761
|
length: count
|
|
795
762
|
}).map(_temp3);
|
|
796
763
|
$[0] = count;
|
|
797
|
-
$[1] =
|
|
764
|
+
$[1] = t1;
|
|
798
765
|
} else {
|
|
799
|
-
|
|
766
|
+
t1 = $[1];
|
|
800
767
|
}
|
|
801
|
-
let
|
|
768
|
+
let t2;
|
|
802
769
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
803
|
-
|
|
804
|
-
$[2] =
|
|
770
|
+
t2 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
|
|
771
|
+
$[2] = t2;
|
|
805
772
|
} else {
|
|
806
|
-
|
|
773
|
+
t2 = $[2];
|
|
807
774
|
}
|
|
808
|
-
let
|
|
775
|
+
let t3;
|
|
809
776
|
if ($[3] !== count) {
|
|
810
|
-
|
|
811
|
-
className:
|
|
777
|
+
t3 = /*#__PURE__*/jsxs("div", {
|
|
778
|
+
className: t2,
|
|
812
779
|
children: ["Loading ", count, " items"]
|
|
813
780
|
});
|
|
814
781
|
$[3] = count;
|
|
815
|
-
$[4] =
|
|
782
|
+
$[4] = t3;
|
|
816
783
|
} else {
|
|
817
|
-
|
|
784
|
+
t3 = $[4];
|
|
818
785
|
}
|
|
819
|
-
let
|
|
820
|
-
if ($[5] !== itemId || $[6] !==
|
|
821
|
-
|
|
786
|
+
let t4;
|
|
787
|
+
if ($[5] !== itemId || $[6] !== ref || $[7] !== t1 || $[8] !== t3) {
|
|
788
|
+
t4 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
822
789
|
value: true,
|
|
823
790
|
children: /*#__PURE__*/jsxs(Item, {
|
|
824
791
|
id: itemId,
|
|
825
|
-
ref:
|
|
826
|
-
children: [
|
|
792
|
+
ref: ref,
|
|
793
|
+
children: [t1, t3]
|
|
827
794
|
})
|
|
828
795
|
});
|
|
829
796
|
$[5] = itemId;
|
|
830
|
-
$[6] =
|
|
831
|
-
$[7] =
|
|
832
|
-
$[8] =
|
|
833
|
-
$[9] =
|
|
797
|
+
$[6] = ref;
|
|
798
|
+
$[7] = t1;
|
|
799
|
+
$[8] = t3;
|
|
800
|
+
$[9] = t4;
|
|
834
801
|
} else {
|
|
835
|
-
|
|
802
|
+
t4 = $[9];
|
|
836
803
|
}
|
|
837
|
-
return
|
|
804
|
+
return t4;
|
|
838
805
|
}
|
|
839
|
-
|
|
806
|
+
let t1;
|
|
840
807
|
let t2;
|
|
841
|
-
let t3;
|
|
842
808
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
843
|
-
|
|
809
|
+
t1 = /*#__PURE__*/jsx(LeadingVisual, {
|
|
844
810
|
children: /*#__PURE__*/jsx(Spinner, {
|
|
845
811
|
size: "small"
|
|
846
812
|
})
|
|
847
813
|
});
|
|
848
|
-
|
|
814
|
+
t2 = /*#__PURE__*/jsx(Text, {
|
|
849
815
|
className: "fgColor-muted",
|
|
850
816
|
children: "Loading..."
|
|
851
817
|
});
|
|
852
|
-
$[10] =
|
|
853
|
-
$[11] =
|
|
818
|
+
$[10] = t1;
|
|
819
|
+
$[11] = t2;
|
|
854
820
|
} else {
|
|
855
|
-
|
|
856
|
-
|
|
821
|
+
t1 = $[10];
|
|
822
|
+
t2 = $[11];
|
|
857
823
|
}
|
|
858
|
-
let
|
|
859
|
-
if ($[12] !== itemId || $[13] !==
|
|
860
|
-
|
|
824
|
+
let t3;
|
|
825
|
+
if ($[12] !== itemId || $[13] !== ref) {
|
|
826
|
+
t3 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
861
827
|
value: true,
|
|
862
828
|
children: /*#__PURE__*/jsxs(Item, {
|
|
863
829
|
id: itemId,
|
|
864
|
-
ref:
|
|
865
|
-
children: [
|
|
830
|
+
ref: ref,
|
|
831
|
+
children: [t1, t2]
|
|
866
832
|
})
|
|
867
833
|
});
|
|
868
834
|
$[12] = itemId;
|
|
869
|
-
$[13] =
|
|
870
|
-
$[14] =
|
|
835
|
+
$[13] = ref;
|
|
836
|
+
$[14] = t3;
|
|
871
837
|
} else {
|
|
872
|
-
|
|
838
|
+
t3 = $[14];
|
|
873
839
|
}
|
|
874
|
-
return
|
|
840
|
+
return t3;
|
|
875
841
|
});
|
|
876
842
|
const EmptyItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
877
843
|
const $ = c(4);
|
|
878
844
|
const t0 = useId();
|
|
879
|
-
|
|
880
|
-
let t2;
|
|
845
|
+
let t1;
|
|
881
846
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
882
|
-
|
|
847
|
+
t1 = /*#__PURE__*/jsx(Text, {
|
|
883
848
|
className: "fgColor-muted",
|
|
884
849
|
children: "No items found"
|
|
885
850
|
});
|
|
886
|
-
$[0] =
|
|
851
|
+
$[0] = t1;
|
|
887
852
|
} else {
|
|
888
|
-
|
|
853
|
+
t1 = $[0];
|
|
889
854
|
}
|
|
890
|
-
let
|
|
891
|
-
if ($[1] !==
|
|
892
|
-
|
|
855
|
+
let t2;
|
|
856
|
+
if ($[1] !== ref || $[2] !== t0) {
|
|
857
|
+
t2 = /*#__PURE__*/jsx(Item, {
|
|
893
858
|
expanded: null,
|
|
894
859
|
id: t0,
|
|
895
|
-
ref:
|
|
896
|
-
children:
|
|
860
|
+
ref: ref,
|
|
861
|
+
children: t1
|
|
897
862
|
});
|
|
898
|
-
$[1] =
|
|
899
|
-
$[2] =
|
|
900
|
-
$[3] =
|
|
863
|
+
$[1] = ref;
|
|
864
|
+
$[2] = t0;
|
|
865
|
+
$[3] = t2;
|
|
901
866
|
} else {
|
|
902
|
-
|
|
867
|
+
t2 = $[3];
|
|
903
868
|
}
|
|
904
|
-
return
|
|
869
|
+
return t2;
|
|
905
870
|
});
|
|
906
871
|
function useSubTree(children) {
|
|
907
872
|
const $ = c(8);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlineNav-MenuItemContent-3J7gB{align-items:center;display:flex;justify-content:space-between}.prc-UnderlineNav-MoreButton-Y8soj{background:transparent;border:0;box-shadow:none;font-weight:var(--base-text-weight-normal,400);margin:0;padding:var(--base-size-4,.25rem) var(--base-size-8,.5rem)}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-4344d9b0.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,wCAEE,kBAAmB,CADnB,YAAa,CAEb,6BACF,CAGA,mCAGE,sBAAuB,CADvB,QAAS,CAGT,eAAgB,CADhB,8CAA2C,CAH3C,QAAS,CAQT,0DAKF,CAHE,mEACE,aACF","file":"UnderlineNav-4344d9b0.css","sourcesContent":[".MenuItemContent {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n/* More button styles migrated from styles.ts (was moreBtnStyles) */\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n border: 0;\n background: transparent;\n font-weight: var(--base-text-weight-normal);\n box-shadow: none;\n padding-top: var(--base-size-4);\n padding-bottom: var(--base-size-4);\n padding-left: var(--base-size-8);\n padding-right: var(--base-size-8);\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export type UnderlineNavProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
@@ -15,5 +15,6 @@ export type UnderlineNavProps = {
|
|
|
15
15
|
*/
|
|
16
16
|
variant?: 'inset' | 'flush';
|
|
17
17
|
};
|
|
18
|
+
export declare const MORE_BTN_WIDTH = 86;
|
|
18
19
|
export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<unknown>>;
|
|
19
20
|
//# sourceMappingURL=UnderlineNav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAqBtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAsGhC,eAAO,MAAM,YAAY,mFA0SxB,CAAA"}
|