@primer/react 0.0.0-20260528194125 → 0.0.0-20260528214723

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,12 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260528194125
4
-
5
- ### Patch Changes
6
-
7
- - Fake entry to force publishing
8
-
9
- ## 38.26.0
3
+ ## 0.0.0-20260528214723
10
4
 
11
5
  ### Minor Changes
12
6
 
@@ -23,6 +17,11 @@
23
17
 
24
18
  - [#7885](https://github.com/primer/react/pull/7885) [`9d2cb53`](https://github.com/primer/react/commit/9d2cb53c06f172598dc96be11ac0441c338e5341) Thanks [@janmaarten-a11y](https://github.com/janmaarten-a11y)! - Add `Timeline.Avatar` sub-component for rendering an actor avatar in the left gutter of a `Timeline.Item`. Accepts any React children and is absolutely positioned so it does not affect badge or body layout. Consumers must reserve roughly 72px of left padding around the `Timeline` for the avatar to be visible.
25
19
 
20
+ - [#7897](https://github.com/primer/react/pull/7897) [`dea9ea7`](https://github.com/primer/react/commit/dea9ea7908d3d9fe935c42311952fa5cbd7a17e4) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add support for the `as` prop on `TreeView.Item`. This enables rendering the
21
+ treeitem as a different element (e.g. `as="a"` for native anchors, or a custom
22
+ router-link component) while preserving all existing keyboard, focus, and ARIA
23
+ behavior. Defaults to `'li'`, so existing usage is unchanged.
24
+
26
25
  ### Patch Changes
27
26
 
28
27
  - [#7864](https://github.com/primer/react/pull/7864) [`e7205ea`](https://github.com/primer/react/commit/e7205ea51b02fb1b7ac9de2df122f7ba67ebe078) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Eliminate nested-update cascades in `useFocus`, `PageLayout.Pane`, and
@@ -48,6 +47,8 @@
48
47
 
49
48
  - [#7878](https://github.com/primer/react/pull/7878) [`8c468fd`](https://github.com/primer/react/commit/8c468fd28322456f48601f9cbf6226fc4c35b661) Thanks [@mattcosta7](https://github.com/mattcosta7)! - FilteredActionList: Guard against `undefined` items in the virtualizer's `getItemKey` callback to prevent a crash when `@tanstack/react-virtual` invokes it with an index whose item was just removed (e.g. when filtering shrinks the items list).
50
49
 
50
+ - Fake entry to force publishing
51
+
51
52
  - [#7893](https://github.com/primer/react/pull/7893) [`0eef204`](https://github.com/primer/react/commit/0eef20484e5e26d0b6edb89dca68c538e7e898c6) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Button: Replace the icon-only-with-counter `:has(...):not(:has(...))` selector with a `data-icon-only-counter` attribute computed from props. Reduces style-recalculation cost on pages that render many Buttons. No visual or behavioral changes.
52
53
 
53
54
  - [#7896](https://github.com/primer/react/pull/7896) [`673514b`](https://github.com/primer/react/commit/673514bf6743067d9db887a2c57e675a7e2a52f8) Thanks [@mattcosta7](https://github.com/mattcosta7)! - TextInput / TextInputWithTokens / Select / Autocomplete: Replace chained `:not([data-leading-visual])`, `:not([data-trailing-visual])`, and `:not([data-trailing-action])` attribute negations in `TextInputWrapper` styles with positive `data-no-leading-visual`, `data-no-trailing-visual`, and `data-no-trailing-action` markers emitted by the wrapper components. Eliminates the 2- and 3-deep `:not()` chains that previously evaluated against every input on every state change. No visual or behavioral changes.
@@ -1,6 +1,7 @@
1
1
  import { type Icon } from '@primer/octicons-react';
2
2
  import React from 'react';
3
3
  import type { FCWithSlotMarker } from '../utils/types';
4
+ import { type PolymorphicProps } from '../utils/modern-polymorphic';
4
5
  export type TreeViewProps = {
5
6
  'aria-label'?: React.AriaAttributes['aria-label'];
6
7
  'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
@@ -17,7 +18,7 @@ export type TreeViewSecondaryActions = {
17
18
  count?: number | string;
18
19
  className?: string;
19
20
  };
20
- export type TreeViewItemProps = {
21
+ type TreeViewItemBaseProps = {
21
22
  'aria-label'?: React.AriaAttributes['aria-label'];
22
23
  'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
23
24
  id: string;
@@ -31,6 +32,7 @@ export type TreeViewItemProps = {
31
32
  className?: string;
32
33
  secondaryActions?: TreeViewSecondaryActions[];
33
34
  };
35
+ export type TreeViewItemProps<As extends React.ElementType = 'li'> = PolymorphicProps<As, 'li', TreeViewItemBaseProps>;
34
36
  export type SubTreeState = 'initial' | 'loading' | 'done' | 'error';
35
37
  export type TreeViewSubTreeProps = {
36
38
  children?: React.ReactNode;
@@ -62,7 +64,11 @@ export type TreeViewErrorDialogProps = {
62
64
  onDismiss?: () => void;
63
65
  };
64
66
  export declare const TreeView: React.FC<TreeViewProps> & {
65
- Item: React.ForwardRefExoticComponent<TreeViewItemProps & React.RefAttributes<HTMLElement>>;
67
+ Item: (<As extends React.ElementType = "li">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "li" : As> & TreeViewItemBaseProps extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "li" : As> & TreeViewItemBaseProps ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
68
+ as?: As | undefined;
69
+ } & React.RefAttributes<unknown>) => React.ReactNode) & {
70
+ displayName: string;
71
+ };
66
72
  SubTree: FCWithSlotMarker<TreeViewSubTreeProps>;
67
73
  LeadingAction: React.FC<TreeViewVisualProps>;
68
74
  LeadingVisual: React.FC<TreeViewVisualProps>;
@@ -70,4 +76,5 @@ export declare const TreeView: React.FC<TreeViewProps> & {
70
76
  DirectoryIcon: () => React.JSX.Element;
71
77
  ErrorDialog: React.FC<TreeViewErrorDialogProps>;
72
78
  };
79
+ export {};
73
80
  //# sourceMappingURL=TreeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/TreeView/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAA+B,MAAM,OAAO,CAAA;AAsBnD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AA4CpD,MAAM,MAAM,aAAa,GAAG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AAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AA4CD,eAAO,MAAM,QAAQ;YAxvBlB,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;CAgwB7B,CAAA"}
@@ -16,6 +16,7 @@ import { IconButton } from '../Button/IconButton.js';
16
16
  import { ButtonComponent } from '../Button/Button.js';
17
17
  import { ActionList } from '../ActionList/index.js';
18
18
  import { isSlot } from '../utils/is-slot.js';
19
+ import { fixedForwardRef } from '../utils/modern-polymorphic.js';
19
20
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
20
21
  import { useIsMacOS } from '../hooks/useIsMacOS.js';
21
22
  import { AriaStatus } from '../live-region/AriaStatus.js';
@@ -260,7 +261,7 @@ Root.displayName = 'TreeView';
260
261
  // ----------------------------------------------------------------------------
261
262
  // TreeView.Item
262
263
 
263
- const Item = /*#__PURE__*/React.forwardRef(({
264
+ const ItemImpl = fixedForwardRef(({
264
265
  id: itemId,
265
266
  containIntrinsicSize,
266
267
  current: isCurrentItem = false,
@@ -272,8 +273,16 @@ const Item = /*#__PURE__*/React.forwardRef(({
272
273
  className,
273
274
  'aria-label': ariaLabel,
274
275
  'aria-labelledby': ariaLabelledby,
275
- secondaryActions
276
+ secondaryActions,
277
+ as: Component,
278
+ ...restProps
276
279
  }, ref) => {
280
+ // Note: when `as` swaps the element from `<li>`, the resulting markup
281
+ // (e.g. `<a>` as a direct child of `<ul role="tree">`) is technically
282
+ // not valid HTML. This mirrors the trade-off made by other polymorphic
283
+ // Primer components (e.g. `Breadcrumbs.Item`, `ActionList.LinkItem`)
284
+ // to support router-link integrations.
285
+ const ItemElement = Component !== null && Component !== void 0 ? Component : 'li';
277
286
  const [slots, rest] = useSlots(children, {
278
287
  leadingAction: LeadingAction,
279
288
  leadingVisual: LeadingVisual,
@@ -314,9 +323,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
314
323
  const isMacOS = useIsMacOS();
315
324
 
316
325
  // Set the expanded state and cache it
317
- const setIsExpandedWithCache = React.useCallback(
318
- // eslint-disable-next-line react-hooks/preserve-manual-memoization
319
- newIsExpanded => {
326
+ const setIsExpandedWithCache = React.useCallback(newIsExpanded => {
320
327
  var _expandedStateCache$c3;
321
328
  setIsExpanded(newIsExpanded);
322
329
  (_expandedStateCache$c3 = expandedStateCache.current) === null || _expandedStateCache$c3 === void 0 ? void 0 : _expandedStateCache$c3.set(itemId, newIsExpanded);
@@ -339,34 +346,34 @@ const Item = /*#__PURE__*/React.forwardRef(({
339
346
  action();
340
347
  }
341
348
  }, [secondaryActions]);
342
- const handleKeyDown = React.useCallback(event_0 => {
343
- switch (event_0.key) {
349
+ const handleKeyDown = React.useCallback(event => {
350
+ switch (event.key) {
344
351
  case 'Enter':
345
352
  case ' ':
346
353
  if (onSelect) {
347
- onSelect(event_0);
354
+ onSelect(event);
348
355
  } else {
349
- toggle(event_0);
356
+ toggle(event);
350
357
  }
351
- event_0.stopPropagation();
358
+ event.stopPropagation();
352
359
  break;
353
360
  case 'ArrowRight':
354
361
  // Ignore if modifier keys are pressed
355
- if (event_0.altKey || event_0.metaKey) return;
356
- event_0.preventDefault();
357
- event_0.stopPropagation();
362
+ if (event.altKey || event.metaKey) return;
363
+ event.preventDefault();
364
+ event.stopPropagation();
358
365
  setIsExpandedWithCache(true);
359
366
  break;
360
367
  case 'ArrowLeft':
361
368
  // Ignore if modifier keys are pressed
362
- if (event_0.altKey || event_0.metaKey) return;
363
- event_0.preventDefault();
364
- event_0.stopPropagation();
369
+ if (event.altKey || event.metaKey) return;
370
+ event.preventDefault();
371
+ event.stopPropagation();
365
372
  setIsExpandedWithCache(false);
366
373
  break;
367
374
  case 'U':
368
375
  case 'u':
369
- if (!(event_0.shiftKey && (event_0.metaKey || event_0.ctrlKey))) return;
376
+ if (!(event.shiftKey && (event.metaKey || event.ctrlKey))) return;
370
377
  activateActionsDialog();
371
378
  break;
372
379
  }
@@ -386,7 +393,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
386
393
  trailingVisualId,
387
394
  trailingActionId
388
395
  },
389
- children: /*#__PURE__*/jsxs("li", {
396
+ children: /*#__PURE__*/jsxs(ItemElement, {
390
397
  className: clsx('PRIVATE_TreeView-item', className, classes.TreeViewItem),
391
398
  ref: ref,
392
399
  tabIndex: 0,
@@ -401,32 +408,33 @@ const Item = /*#__PURE__*/React.forwardRef(({
401
408
  "aria-selected": isFocused ? 'true' : 'false',
402
409
  "data-has-leading-action": slots.leadingAction ? true : undefined,
403
410
  onKeyDown: handleKeyDown,
404
- onFocus: event_1 => {
411
+ onFocus: event => {
405
412
  // Defer scroll to the next animation frame so that rapid keyboard
406
413
  // navigation (held key) coalesces into a single reflow per frame
407
- scrollElementIntoView(event_1.currentTarget.firstElementChild);
414
+ scrollElementIntoView(event.currentTarget.firstElementChild);
408
415
 
409
416
  // Set the focused state
410
417
  setIsFocused(true);
411
418
 
412
419
  // Prevent focus event from bubbling up to parent items
413
- event_1.stopPropagation();
420
+ event.stopPropagation();
414
421
  },
415
422
  onBlur: () => setIsFocused(false),
416
- onClick: event_2 => {
423
+ onClick: event => {
417
424
  if (onSelect) {
418
- onSelect(event_2);
425
+ onSelect(event);
419
426
  } else {
420
- toggle(event_2);
427
+ toggle(event);
421
428
  }
422
- event_2.stopPropagation();
429
+ event.stopPropagation();
423
430
  },
424
- onAuxClick: event_3 => {
425
- if (onSelect && event_3.button === 1) {
426
- onSelect(event_3);
431
+ onAuxClick: event => {
432
+ if (onSelect && event.button === 1) {
433
+ onSelect(event);
427
434
  }
428
- event_3.stopPropagation();
435
+ event.stopPropagation();
429
436
  },
437
+ ...restProps,
430
438
  children: [/*#__PURE__*/jsxs("div", {
431
439
  className: clsx('PRIVATE_TreeView-item-container', classes.TreeViewItemContainer),
432
440
  style: {
@@ -451,9 +459,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
451
459
  // If they take up a button role, they become unnecessary and numerous tab stops.
452
460
  jsx("div", {
453
461
  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),
454
- onClick: event_4 => {
462
+ onClick: event => {
455
463
  if (onSelect) {
456
- toggle(event_4);
464
+ toggle(event);
457
465
  }
458
466
  },
459
467
  children: isExpanded ? /*#__PURE__*/jsx(ChevronDownIcon, {
@@ -481,6 +489,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
481
489
  })
482
490
  });
483
491
  });
492
+ const Item = Object.assign(ItemImpl, {
493
+ displayName: 'TreeView.Item'
494
+ });
484
495
 
485
496
  /** Lines to indicate the depth of an item in a TreeView */
486
497
  const LevelIndicatorLines = t0 => {
@@ -513,7 +524,6 @@ const LevelIndicatorLines = t0 => {
513
524
  }
514
525
  return t2;
515
526
  };
516
- Item.displayName = 'TreeView.Item';
517
527
 
518
528
  // ----------------------------------------------------------------------------
519
529
  // TreeView.SubTree
@@ -748,112 +758,115 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
748
758
  } = t0;
749
759
  const itemId = useId();
750
760
  if (count) {
751
- let t1;
761
+ const t1 = ref;
762
+ let t2;
752
763
  if ($[0] !== count) {
753
- t1 = Array.from({
764
+ t2 = Array.from({
754
765
  length: count
755
766
  }).map(_temp3);
756
767
  $[0] = count;
757
- $[1] = t1;
768
+ $[1] = t2;
758
769
  } else {
759
- t1 = $[1];
770
+ t2 = $[1];
760
771
  }
761
- let t2;
772
+ let t3;
762
773
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
763
- t2 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
764
- $[2] = t2;
774
+ t3 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
775
+ $[2] = t3;
765
776
  } else {
766
- t2 = $[2];
777
+ t3 = $[2];
767
778
  }
768
- let t3;
779
+ let t4;
769
780
  if ($[3] !== count) {
770
- t3 = /*#__PURE__*/jsxs("div", {
771
- className: t2,
781
+ t4 = /*#__PURE__*/jsxs("div", {
782
+ className: t3,
772
783
  children: ["Loading ", count, " items"]
773
784
  });
774
785
  $[3] = count;
775
- $[4] = t3;
786
+ $[4] = t4;
776
787
  } else {
777
- t3 = $[4];
788
+ t4 = $[4];
778
789
  }
779
- let t4;
780
- if ($[5] !== itemId || $[6] !== ref || $[7] !== t1 || $[8] !== t3) {
781
- t4 = /*#__PURE__*/jsxs(Item, {
790
+ let t5;
791
+ if ($[5] !== itemId || $[6] !== t1 || $[7] !== t2 || $[8] !== t4) {
792
+ t5 = /*#__PURE__*/jsxs(Item, {
782
793
  id: itemId,
783
- ref: ref,
784
- children: [t1, t3]
794
+ ref: t1,
795
+ children: [t2, t4]
785
796
  });
786
797
  $[5] = itemId;
787
- $[6] = ref;
788
- $[7] = t1;
789
- $[8] = t3;
790
- $[9] = t4;
798
+ $[6] = t1;
799
+ $[7] = t2;
800
+ $[8] = t4;
801
+ $[9] = t5;
791
802
  } else {
792
- t4 = $[9];
803
+ t5 = $[9];
793
804
  }
794
- return t4;
805
+ return t5;
795
806
  }
796
- let t1;
807
+ const t1 = ref;
797
808
  let t2;
809
+ let t3;
798
810
  if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
799
- t1 = /*#__PURE__*/jsx(LeadingVisual, {
811
+ t2 = /*#__PURE__*/jsx(LeadingVisual, {
800
812
  children: /*#__PURE__*/jsx(Spinner, {
801
813
  size: "small"
802
814
  })
803
815
  });
804
- t2 = /*#__PURE__*/jsx(Text, {
816
+ t3 = /*#__PURE__*/jsx(Text, {
805
817
  className: "fgColor-muted",
806
818
  children: "Loading..."
807
819
  });
808
- $[10] = t1;
809
- $[11] = t2;
820
+ $[10] = t2;
821
+ $[11] = t3;
810
822
  } else {
811
- t1 = $[10];
812
- t2 = $[11];
823
+ t2 = $[10];
824
+ t3 = $[11];
813
825
  }
814
- let t3;
815
- if ($[12] !== itemId || $[13] !== ref) {
816
- t3 = /*#__PURE__*/jsxs(Item, {
826
+ let t4;
827
+ if ($[12] !== itemId || $[13] !== t1) {
828
+ t4 = /*#__PURE__*/jsxs(Item, {
817
829
  id: itemId,
818
- ref: ref,
819
- children: [t1, t2]
830
+ ref: t1,
831
+ children: [t2, t3]
820
832
  });
821
833
  $[12] = itemId;
822
- $[13] = ref;
823
- $[14] = t3;
834
+ $[13] = t1;
835
+ $[14] = t4;
824
836
  } else {
825
- t3 = $[14];
837
+ t4 = $[14];
826
838
  }
827
- return t3;
839
+ return t4;
828
840
  });
829
841
  const EmptyItem = /*#__PURE__*/React.forwardRef((props, ref) => {
830
842
  const $ = c(4);
831
843
  const t0 = useId();
832
- let t1;
844
+ const t1 = ref;
845
+ let t2;
833
846
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
834
- t1 = /*#__PURE__*/jsx(Text, {
847
+ t2 = /*#__PURE__*/jsx(Text, {
835
848
  className: "fgColor-muted",
836
849
  children: "No items found"
837
850
  });
838
- $[0] = t1;
851
+ $[0] = t2;
839
852
  } else {
840
- t1 = $[0];
853
+ t2 = $[0];
841
854
  }
842
- let t2;
843
- if ($[1] !== ref || $[2] !== t0) {
844
- t2 = /*#__PURE__*/jsx(Item, {
855
+ let t3;
856
+ if ($[1] !== t0 || $[2] !== t1) {
857
+ t3 = /*#__PURE__*/jsx(Item, {
845
858
  expanded: null,
846
859
  id: t0,
847
- ref: ref,
848
- children: t1
860
+ ref: t1,
861
+ children: t2
849
862
  });
850
- $[1] = ref;
851
- $[2] = t0;
852
- $[3] = t2;
863
+ $[1] = t0;
864
+ $[2] = t1;
865
+ $[3] = t3;
853
866
  } else {
854
- t2 = $[3];
867
+ t3 = $[3];
855
868
  }
856
- return t2;
869
+ return t3;
857
870
  });
858
871
  function useSubTree(children) {
859
872
  const $ = c(8);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260528194125",
4
+ "version": "0.0.0-20260528214723",
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",