@primer/react 0.0.0-20260601220336 → 0.0.0-20260601225305

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/dist/ActionList/LinkItem.d.ts +1 -1
  3. package/dist/ActionList/List.d.ts +2 -11
  4. package/dist/ActionList/List.d.ts.map +1 -1
  5. package/dist/ActionList/index.d.ts +4 -24
  6. package/dist/ActionList/index.d.ts.map +1 -1
  7. package/dist/BranchName/BranchName.d.ts +2 -4
  8. package/dist/BranchName/BranchName.d.ts.map +1 -1
  9. package/dist/Breadcrumbs/Breadcrumbs.d.ts +4 -10
  10. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  11. package/dist/Card/Card.d.ts +2 -14
  12. package/dist/Card/Card.d.ts.map +1 -1
  13. package/dist/Card/index.d.ts +2 -7
  14. package/dist/Card/index.d.ts.map +1 -1
  15. package/dist/Dialog/Dialog.d.ts +0 -1
  16. package/dist/Dialog/Dialog.d.ts.map +1 -1
  17. package/dist/Dialog/Dialog.js +2 -16
  18. package/dist/KeybindingHint/KeybindingHint.d.ts +6 -1
  19. package/dist/KeybindingHint/KeybindingHint.d.ts.map +1 -1
  20. package/dist/KeybindingHint/KeybindingHint.js +6 -2
  21. package/dist/KeybindingHint/components/Chord.d.ts +2 -1
  22. package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
  23. package/dist/KeybindingHint/components/Chord.js +1 -1
  24. package/dist/KeybindingHint/components/Key.js +10 -10
  25. package/dist/KeybindingHint/components/Sequence.d.ts +2 -1
  26. package/dist/KeybindingHint/components/Sequence.d.ts.map +1 -1
  27. package/dist/KeybindingHint/components/Sequence.js +2 -2
  28. package/dist/KeybindingHint/key-names.d.ts +4 -3
  29. package/dist/KeybindingHint/key-names.d.ts.map +1 -1
  30. package/dist/KeybindingHint/key-names.js +15 -14
  31. package/dist/KeybindingHint/platform.d.ts +22 -0
  32. package/dist/KeybindingHint/platform.d.ts.map +1 -0
  33. package/dist/KeybindingHint/platform.js +61 -0
  34. package/dist/Link/Link.d.ts +1 -1
  35. package/dist/NavList/NavList.d.ts +2 -8
  36. package/dist/NavList/NavList.d.ts.map +1 -1
  37. package/dist/Text/Text.d.ts +2 -7
  38. package/dist/Text/Text.d.ts.map +1 -1
  39. package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
  40. package/dist/TooltipV2/Tooltip.js +3 -3
  41. package/dist/TreeView/TreeView-1bf45a33.css +2 -0
  42. package/dist/TreeView/TreeView-1bf45a33.css.map +1 -0
  43. package/dist/TreeView/TreeView.d.ts +11 -2
  44. package/dist/TreeView/TreeView.d.ts.map +1 -1
  45. package/dist/TreeView/TreeView.js +128 -92
  46. package/dist/TreeView/TreeView.module.css.js +2 -2
  47. package/dist/utils/modern-polymorphic.d.ts +1 -1
  48. package/dist/utils/modern-polymorphic.d.ts.map +1 -1
  49. package/generated/components.json +4 -0
  50. package/package.json +1 -1
  51. package/dist/TreeView/TreeView-0fe09f34.css +0 -2
  52. package/dist/TreeView/TreeView-0fe09f34.css.map +0 -1
  53. package/dist/hooks/useIsMacOS.js +0 -32
@@ -15,9 +15,10 @@ import { useTypeahead } from './useTypeahead.js';
15
15
  import { IconButton } from '../Button/IconButton.js';
16
16
  import { ButtonComponent } from '../Button/Button.js';
17
17
  import { ActionList } from '../ActionList/index.js';
18
+ import { usePlatform } from '../KeybindingHint/platform.js';
18
19
  import { isSlot } from '../utils/is-slot.js';
20
+ import { fixedForwardRef } from '../utils/modern-polymorphic.js';
19
21
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
20
- import { useIsMacOS } from '../hooks/useIsMacOS.js';
21
22
  import { AriaStatus } from '../live-region/AriaStatus.js';
22
23
  import Spinner from '../Spinner/Spinner.js';
23
24
  import { Tooltip } from '../TooltipV2/Tooltip.js';
@@ -46,6 +47,11 @@ const ItemContext = /*#__PURE__*/React.createContext({
46
47
  trailingActionId: ''
47
48
  });
48
49
 
50
+ // Module-private channel from LoadingItem to the Item it renders. Lets us mark the placeholder
51
+ // row with `data-loading` (used by CSS to suppress hover affordances) without exposing an
52
+ // internal-only prop on the public TreeViewItemProps API.
53
+ const LoadingPlaceholderContext = /*#__PURE__*/React.createContext(false);
54
+
49
55
  // ----------------------------------------------------------------------------
50
56
  // TreeView
51
57
 
@@ -260,7 +266,17 @@ Root.displayName = 'TreeView';
260
266
  // ----------------------------------------------------------------------------
261
267
  // TreeView.Item
262
268
 
263
- const Item = /*#__PURE__*/React.forwardRef(({
269
+ // We build this type manually (instead of using `PolymorphicProps`) so we can omit
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(({
264
280
  id: itemId,
265
281
  containIntrinsicSize,
266
282
  current: isCurrentItem = false,
@@ -272,8 +288,16 @@ const Item = /*#__PURE__*/React.forwardRef(({
272
288
  className,
273
289
  'aria-label': ariaLabel,
274
290
  'aria-labelledby': ariaLabelledby,
275
- secondaryActions
291
+ secondaryActions,
292
+ as: Component,
293
+ ...restProps
276
294
  }, ref) => {
295
+ // Note: when `as` swaps the element from `<li>`, the resulting markup
296
+ // (e.g. `<a>` as a direct child of `<ul role="tree">`) is technically
297
+ // not valid HTML. This mirrors the trade-off made by other polymorphic
298
+ // Primer components (e.g. `Breadcrumbs.Item`, `ActionList.LinkItem`)
299
+ // to support router-link integrations.
300
+ const ItemElement = Component !== null && Component !== void 0 ? Component : 'li';
277
301
  const [slots, rest] = useSlots(children, {
278
302
  leadingAction: LeadingAction,
279
303
  leadingVisual: LeadingVisual,
@@ -303,6 +327,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
303
327
  const {
304
328
  level
305
329
  } = React.useContext(ItemContext);
330
+ const isLoadingPlaceholder = React.useContext(LoadingPlaceholderContext);
306
331
  const {
307
332
  hasSubTree,
308
333
  subTree,
@@ -311,12 +336,10 @@ const Item = /*#__PURE__*/React.forwardRef(({
311
336
  const [isSubTreeEmpty, setIsSubTreeEmpty] = React.useState(!hasSubTree);
312
337
  const [actionCommandPressed, setActionCommandPressed] = React.useState(false);
313
338
  const [isFocused, setIsFocused] = React.useState(false);
314
- const isMacOS = useIsMacOS();
339
+ const platform = usePlatform();
315
340
 
316
341
  // Set the expanded state and cache it
317
- const setIsExpandedWithCache = React.useCallback(
318
- // eslint-disable-next-line react-hooks/preserve-manual-memoization
319
- newIsExpanded => {
342
+ const setIsExpandedWithCache = React.useCallback(newIsExpanded => {
320
343
  var _expandedStateCache$c3;
321
344
  setIsExpanded(newIsExpanded);
322
345
  (_expandedStateCache$c3 = expandedStateCache.current) === null || _expandedStateCache$c3 === void 0 ? void 0 : _expandedStateCache$c3.set(itemId, newIsExpanded);
@@ -339,41 +362,41 @@ const Item = /*#__PURE__*/React.forwardRef(({
339
362
  action();
340
363
  }
341
364
  }, [secondaryActions]);
342
- const handleKeyDown = React.useCallback(event_0 => {
343
- switch (event_0.key) {
365
+ const handleKeyDown = React.useCallback(event => {
366
+ switch (event.key) {
344
367
  case 'Enter':
345
368
  case ' ':
346
369
  if (onSelect) {
347
- onSelect(event_0);
370
+ onSelect(event);
348
371
  } else {
349
- toggle(event_0);
372
+ toggle(event);
350
373
  }
351
- event_0.stopPropagation();
374
+ event.stopPropagation();
352
375
  break;
353
376
  case 'ArrowRight':
354
377
  // Ignore if modifier keys are pressed
355
- if (event_0.altKey || event_0.metaKey) return;
356
- event_0.preventDefault();
357
- event_0.stopPropagation();
378
+ if (event.altKey || event.metaKey) return;
379
+ event.preventDefault();
380
+ event.stopPropagation();
358
381
  setIsExpandedWithCache(true);
359
382
  break;
360
383
  case 'ArrowLeft':
361
384
  // Ignore if modifier keys are pressed
362
- if (event_0.altKey || event_0.metaKey) return;
363
- event_0.preventDefault();
364
- event_0.stopPropagation();
385
+ if (event.altKey || event.metaKey) return;
386
+ event.preventDefault();
387
+ event.stopPropagation();
365
388
  setIsExpandedWithCache(false);
366
389
  break;
367
390
  case 'U':
368
391
  case 'u':
369
- if (!(event_0.shiftKey && (event_0.metaKey || event_0.ctrlKey))) return;
392
+ if (!(event.shiftKey && (event.metaKey || event.ctrlKey))) return;
370
393
  activateActionsDialog();
371
394
  break;
372
395
  }
373
396
  }, [onSelect, setIsExpandedWithCache, toggle, activateActionsDialog]);
374
397
  const ariaDescribedByIds = [slots.leadingVisual ? leadingVisualId : null, slots.trailingVisual ? trailingVisualId : null].filter(Boolean);
375
- const shortcut = `Shift+${isMacOS ? 'Meta' : 'Control'}+U`;
376
- const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut, isMacOS)}) for more actions.`;
398
+ const shortcut = `Shift+${platform === 'apple' ? 'Meta' : 'Control'}+U`;
399
+ const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut, platform)}) for more actions.`;
377
400
  return /*#__PURE__*/jsx(ItemContext.Provider, {
378
401
  value: {
379
402
  itemId,
@@ -386,7 +409,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
386
409
  trailingVisualId,
387
410
  trailingActionId
388
411
  },
389
- children: /*#__PURE__*/jsxs("li", {
412
+ children: /*#__PURE__*/jsxs(ItemElement, {
390
413
  className: clsx('PRIVATE_TreeView-item', className, classes.TreeViewItem),
391
414
  ref: ref,
392
415
  tabIndex: 0,
@@ -400,33 +423,35 @@ const Item = /*#__PURE__*/React.forwardRef(({
400
423
  "aria-current": isCurrentItem ? 'true' : undefined,
401
424
  "aria-selected": isFocused ? 'true' : 'false',
402
425
  "data-has-leading-action": slots.leadingAction ? true : undefined,
426
+ "data-loading": isLoadingPlaceholder ? true : undefined,
403
427
  onKeyDown: handleKeyDown,
404
- onFocus: event_1 => {
428
+ onFocus: event => {
405
429
  // Defer scroll to the next animation frame so that rapid keyboard
406
430
  // navigation (held key) coalesces into a single reflow per frame
407
- scrollElementIntoView(event_1.currentTarget.firstElementChild);
431
+ scrollElementIntoView(event.currentTarget.firstElementChild);
408
432
 
409
433
  // Set the focused state
410
434
  setIsFocused(true);
411
435
 
412
436
  // Prevent focus event from bubbling up to parent items
413
- event_1.stopPropagation();
437
+ event.stopPropagation();
414
438
  },
415
439
  onBlur: () => setIsFocused(false),
416
- onClick: event_2 => {
440
+ onClick: event => {
417
441
  if (onSelect) {
418
- onSelect(event_2);
442
+ onSelect(event);
419
443
  } else {
420
- toggle(event_2);
444
+ toggle(event);
421
445
  }
422
- event_2.stopPropagation();
446
+ event.stopPropagation();
423
447
  },
424
- onAuxClick: event_3 => {
425
- if (onSelect && event_3.button === 1) {
426
- onSelect(event_3);
448
+ onAuxClick: event => {
449
+ if (onSelect && event.button === 1) {
450
+ onSelect(event);
427
451
  }
428
- event_3.stopPropagation();
452
+ event.stopPropagation();
429
453
  },
454
+ ...restProps,
430
455
  children: [/*#__PURE__*/jsxs("div", {
431
456
  className: clsx('PRIVATE_TreeView-item-container', classes.TreeViewItemContainer),
432
457
  style: {
@@ -451,9 +476,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
451
476
  // If they take up a button role, they become unnecessary and numerous tab stops.
452
477
  jsx("div", {
453
478
  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 => {
479
+ onClick: event => {
455
480
  if (onSelect) {
456
- toggle(event_4);
481
+ toggle(event);
457
482
  }
458
483
  },
459
484
  children: isExpanded ? /*#__PURE__*/jsx(ChevronDownIcon, {
@@ -481,6 +506,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
481
506
  })
482
507
  });
483
508
  });
509
+ const Item = Object.assign(ItemImpl, {
510
+ displayName: 'TreeView.Item'
511
+ });
484
512
 
485
513
  /** Lines to indicate the depth of an item in a TreeView */
486
514
  const LevelIndicatorLines = t0 => {
@@ -513,7 +541,6 @@ const LevelIndicatorLines = t0 => {
513
541
  }
514
542
  return t2;
515
543
  };
516
- Item.displayName = 'TreeView.Item';
517
544
 
518
545
  // ----------------------------------------------------------------------------
519
546
  // TreeView.SubTree
@@ -748,112 +775,121 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
748
775
  } = t0;
749
776
  const itemId = useId();
750
777
  if (count) {
751
- let t1;
778
+ const t1 = ref;
779
+ let t2;
752
780
  if ($[0] !== count) {
753
- t1 = Array.from({
781
+ t2 = Array.from({
754
782
  length: count
755
783
  }).map(_temp3);
756
784
  $[0] = count;
757
- $[1] = t1;
785
+ $[1] = t2;
758
786
  } else {
759
- t1 = $[1];
787
+ t2 = $[1];
760
788
  }
761
- let t2;
789
+ let t3;
762
790
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
763
- t2 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
764
- $[2] = t2;
791
+ t3 = clsx("PRIVATE_VisuallyHidden", classes.TreeViewVisuallyHidden);
792
+ $[2] = t3;
765
793
  } else {
766
- t2 = $[2];
794
+ t3 = $[2];
767
795
  }
768
- let t3;
796
+ let t4;
769
797
  if ($[3] !== count) {
770
- t3 = /*#__PURE__*/jsxs("div", {
771
- className: t2,
798
+ t4 = /*#__PURE__*/jsxs("div", {
799
+ className: t3,
772
800
  children: ["Loading ", count, " items"]
773
801
  });
774
802
  $[3] = count;
775
- $[4] = t3;
803
+ $[4] = t4;
776
804
  } else {
777
- t3 = $[4];
805
+ t4 = $[4];
778
806
  }
779
- let t4;
780
- if ($[5] !== itemId || $[6] !== ref || $[7] !== t1 || $[8] !== t3) {
781
- t4 = /*#__PURE__*/jsxs(Item, {
782
- id: itemId,
783
- ref: ref,
784
- children: [t1, t3]
807
+ let t5;
808
+ if ($[5] !== itemId || $[6] !== t1 || $[7] !== t2 || $[8] !== t4) {
809
+ t5 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
810
+ value: true,
811
+ children: /*#__PURE__*/jsxs(Item, {
812
+ id: itemId,
813
+ ref: t1,
814
+ children: [t2, t4]
815
+ })
785
816
  });
786
817
  $[5] = itemId;
787
- $[6] = ref;
788
- $[7] = t1;
789
- $[8] = t3;
790
- $[9] = t4;
818
+ $[6] = t1;
819
+ $[7] = t2;
820
+ $[8] = t4;
821
+ $[9] = t5;
791
822
  } else {
792
- t4 = $[9];
823
+ t5 = $[9];
793
824
  }
794
- return t4;
825
+ return t5;
795
826
  }
796
- let t1;
827
+ const t1 = ref;
797
828
  let t2;
829
+ let t3;
798
830
  if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
799
- t1 = /*#__PURE__*/jsx(LeadingVisual, {
831
+ t2 = /*#__PURE__*/jsx(LeadingVisual, {
800
832
  children: /*#__PURE__*/jsx(Spinner, {
801
833
  size: "small"
802
834
  })
803
835
  });
804
- t2 = /*#__PURE__*/jsx(Text, {
836
+ t3 = /*#__PURE__*/jsx(Text, {
805
837
  className: "fgColor-muted",
806
838
  children: "Loading..."
807
839
  });
808
- $[10] = t1;
809
- $[11] = t2;
840
+ $[10] = t2;
841
+ $[11] = t3;
810
842
  } else {
811
- t1 = $[10];
812
- t2 = $[11];
843
+ t2 = $[10];
844
+ t3 = $[11];
813
845
  }
814
- let t3;
815
- if ($[12] !== itemId || $[13] !== ref) {
816
- t3 = /*#__PURE__*/jsxs(Item, {
817
- id: itemId,
818
- ref: ref,
819
- children: [t1, t2]
846
+ let t4;
847
+ if ($[12] !== itemId || $[13] !== t1) {
848
+ t4 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
849
+ value: true,
850
+ children: /*#__PURE__*/jsxs(Item, {
851
+ id: itemId,
852
+ ref: t1,
853
+ children: [t2, t3]
854
+ })
820
855
  });
821
856
  $[12] = itemId;
822
- $[13] = ref;
823
- $[14] = t3;
857
+ $[13] = t1;
858
+ $[14] = t4;
824
859
  } else {
825
- t3 = $[14];
860
+ t4 = $[14];
826
861
  }
827
- return t3;
862
+ return t4;
828
863
  });
829
864
  const EmptyItem = /*#__PURE__*/React.forwardRef((props, ref) => {
830
865
  const $ = c(4);
831
866
  const t0 = useId();
832
- let t1;
867
+ const t1 = ref;
868
+ let t2;
833
869
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
834
- t1 = /*#__PURE__*/jsx(Text, {
870
+ t2 = /*#__PURE__*/jsx(Text, {
835
871
  className: "fgColor-muted",
836
872
  children: "No items found"
837
873
  });
838
- $[0] = t1;
874
+ $[0] = t2;
839
875
  } else {
840
- t1 = $[0];
876
+ t2 = $[0];
841
877
  }
842
- let t2;
843
- if ($[1] !== ref || $[2] !== t0) {
844
- t2 = /*#__PURE__*/jsx(Item, {
878
+ let t3;
879
+ if ($[1] !== t0 || $[2] !== t1) {
880
+ t3 = /*#__PURE__*/jsx(Item, {
845
881
  expanded: null,
846
882
  id: t0,
847
- ref: ref,
848
- children: t1
883
+ ref: t1,
884
+ children: t2
849
885
  });
850
- $[1] = ref;
851
- $[2] = t0;
852
- $[3] = t2;
886
+ $[1] = t0;
887
+ $[2] = t1;
888
+ $[3] = t3;
853
889
  } else {
854
- t2 = $[3];
890
+ t3 = $[3];
855
891
  }
856
- return t2;
892
+ return t3;
857
893
  });
858
894
  function useSubTree(children) {
859
895
  const $ = c(8);
@@ -1,5 +1,5 @@
1
- import './TreeView-0fe09f34.css';
1
+ import './TreeView-1bf45a33.css';
2
2
 
3
- var classes = {"TreeViewRootUlStyles":"prc-TreeView-TreeViewRootUlStyles-Mzrmj","TreeViewItem":"prc-TreeView-TreeViewItem-Ter5f","TreeViewItemContainer":"prc-TreeView-TreeViewItemContainer-z6qqQ","TreeViewItemSkeleton":"prc-TreeView-TreeViewItemSkeleton-FGlnx","TreeViewItemToggle":"prc-TreeView-TreeViewItemToggle-hq3Xq","TreeViewItemToggleHover":"prc-TreeView-TreeViewItemToggleHover-H9tbt","TreeViewItemToggleEnd":"prc-TreeView-TreeViewItemToggleEnd-nWt9I","TreeViewItemContent":"prc-TreeView-TreeViewItemContent-RKsCI","TreeViewItemContentText":"prc-TreeView-TreeViewItemContentText-FFaKp","TreeViewItemVisual":"prc-TreeView-TreeViewItemVisual-naWzj","TreeViewItemLeadingAction":"prc-TreeView-TreeViewItemLeadingAction-vmOIV","TreeViewItemTrailingAction":"prc-TreeView-TreeViewItemTrailingAction-h9M5g","TreeViewItemTrailingActionButton":"prc-TreeView-TreeViewItemTrailingActionButton-pCTdP","TreeViewItemLevelLine":"prc-TreeView-TreeViewItemLevelLine-F-0-2","TreeViewDirectoryIcon":"prc-TreeView-TreeViewDirectoryIcon-yP1oY","TreeViewVisuallyHidden":"prc-TreeView-TreeViewVisuallyHidden-1N8xK","TreeViewSkeletonItemContainerStyle":"prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd","TreeItemSkeletonTextStyles":"prc-TreeView-TreeItemSkeletonTextStyles-8VJ-g"};
3
+ var classes = {"TreeViewRootUlStyles":"prc-TreeView-TreeViewRootUlStyles-Mzrmj","TreeViewItem":"prc-TreeView-TreeViewItem-Ter5f","TreeViewItemContainer":"prc-TreeView-TreeViewItemContainer-z6qqQ","TreeViewItemToggle":"prc-TreeView-TreeViewItemToggle-hq3Xq","TreeViewItemToggleHover":"prc-TreeView-TreeViewItemToggleHover-H9tbt","TreeViewItemToggleEnd":"prc-TreeView-TreeViewItemToggleEnd-nWt9I","TreeViewItemContent":"prc-TreeView-TreeViewItemContent-RKsCI","TreeViewItemContentText":"prc-TreeView-TreeViewItemContentText-FFaKp","TreeViewItemVisual":"prc-TreeView-TreeViewItemVisual-naWzj","TreeViewItemLeadingAction":"prc-TreeView-TreeViewItemLeadingAction-vmOIV","TreeViewItemTrailingAction":"prc-TreeView-TreeViewItemTrailingAction-h9M5g","TreeViewItemTrailingActionButton":"prc-TreeView-TreeViewItemTrailingActionButton-pCTdP","TreeViewItemLevelLine":"prc-TreeView-TreeViewItemLevelLine-F-0-2","TreeViewDirectoryIcon":"prc-TreeView-TreeViewDirectoryIcon-yP1oY","TreeViewVisuallyHidden":"prc-TreeView-TreeViewVisuallyHidden-1N8xK","TreeViewSkeletonItemContainerStyle":"prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd","TreeItemSkeletonTextStyles":"prc-TreeView-TreeItemSkeletonTextStyles-8VJ-g"};
4
4
 
5
5
  export { classes as default };
@@ -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
- type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omit<T, TOmitted> : never;
5
+ export 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,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"}
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,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,QAAQ,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAA;AAE7G;;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"}
@@ -3831,6 +3831,10 @@
3831
3831
  {
3832
3832
  "id": "experimental-components-keybindinghint-features--on-primary",
3833
3833
  "code": "(args) => (\n <div className={classes.PrimaryBackground}>\n <KeybindingHint {...args} />\n </div>\n)"
3834
+ },
3835
+ {
3836
+ "id": "experimental-components-keybindinghint-features--platforms",
3837
+ "code": "({ format = 'full', ...args }) => (\n <table className={classes.PlatformTable}>\n <thead>\n <tr>\n <th\n scope=\"col\"\n className={`${classes.PlatformCell} ${classes.PlatformHeader}`}\n >\n Platform\n </th>\n {modifierKeys.map((key) => (\n <th\n scope=\"col\"\n className={`${classes.PlatformCell} ${classes.PlatformHeader}`}\n key={key}\n >\n {key}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {platforms.map(({ platform, label }) => (\n <tr key={platform}>\n <th\n scope=\"row\"\n className={`${classes.PlatformCell} ${classes.PlatformHeader}`}\n >\n {label}\n </th>\n {modifierKeys.map((key) => (\n <td key={key} className={classes.PlatformCell}>\n <PlatformOverrideProvider value={platform}>\n <KeybindingHint {...args} format={format} keys={`${key}+K`} />\n </PlatformOverrideProvider>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n)"
3834
3838
  }
3835
3839
  ],
3836
3840
  "importPath": "@primer/react",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260601220336",
4
+ "version": "0.0.0-20260601225305",
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",
@@ -1,2 +0,0 @@
1
- .prc-TreeView-TreeViewRootUlStyles-Mzrmj{list-style:none;margin:0;padding:0}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f{outline:none}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f):focus-visible>div,:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f).focus-visible>div{box-shadow:var(--boxShadow-thick,inset 0 0 0 .125rem) var(--fgColor-accent,#0969da)}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f):focus-visible>div,:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f).focus-visible>div{outline:2px solid HighlightText;outline-offset:-2}}[data-has-leading-action]:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f){--has-leading-action:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ{--level:1;--toggle-width:1rem;--min-item-height:2rem;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);cursor:pointer;display:grid;font-size:var(--text-body-size-medium,.875rem);grid-template-areas:"spacer leadingAction toggle content trailingAction";grid-template-columns:var(--spacer-width) var(--leading-action-width) var(--toggle-width) 1fr;position:relative;width:100%;--leading-action-width:calc(var(--has-leading-action, 0)*1.5rem);--spacer-width:calc((var(--level) - 1)*(var(--toggle-width)/2))}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):hover{background-color:var(--control-transparent-bgColor-hover,#818b981a)}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):hover{outline:2px solid transparent;outline-offset:-2px}}@media (pointer:coarse){.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ{--toggle-width:1.5rem;--min-item-height:2.75rem}}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):has(.prc-TreeView-TreeViewItemSkeleton-FGlnx):hover{background-color:transparent;cursor:default}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):has(.prc-TreeView-TreeViewItemSkeleton-FGlnx):hover{outline:none}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-omit-spacer=true]) .prc-TreeView-TreeViewItemContainer-z6qqQ{grid-template-columns:0 0 0 1fr}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ{background-color:var(--control-transparent-bgColor-selected,#818b9826)}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ):after{background-color:var(--fgColor-accent,#0969da);border-radius:var(--borderRadius-medium,.375rem);content:"";height:1.5rem;left:calc(var(--base-size-8,.5rem)*-1);position:absolute;top:calc(50% - var(--base-size-12,.75rem));width:.25rem}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ):after{background-color:HighlightText}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggle-hq3Xq{align-items:flex-start;color:var(--fgColor-muted,#59636e);display:flex;grid-area:toggle;height:100%;justify-content:center;padding-top:calc(var(--min-item-height)/2 - var(--base-size-12,.75rem)/2)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggleHover-H9tbt:hover{background-color:var(--control-transparent-bgColor-hover,#818b981a)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggleEnd-nWt9I{border-bottom-left-radius:var(--borderRadius-medium,.375rem);border-top-left-radius:var(--borderRadius-medium,.375rem)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContent-RKsCI{display:flex;gap:var(--stack-gap-condensed,.5rem);grid-area:content;height:100%;line-height:var(--custom-line-height,var(--text-body-lineHeight-medium,1.4285));padding:0 var(--base-size-8,.5rem);padding-bottom:calc((var(--min-item-height) - var(--custom-line-height, 1.3rem))/2);padding-top:calc((var(--min-item-height) - var(--custom-line-height, 1.3rem))/2)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContentText-FFaKp{flex:1 1 auto;width:0}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-truncate-text=true]) .prc-TreeView-TreeViewItemContentText-FFaKp{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-truncate-text=false]) .prc-TreeView-TreeViewItemContentText-FFaKp{word-break:break-word}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemVisual-naWzj{align-items:center;color:var(--fgColor-muted,#59636e);display:flex;height:var(--custom-line-height,1.3rem)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLeadingAction-vmOIV{color:var(--fgColor-muted,#59636e);display:flex;grid-area:leadingAction}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLeadingAction-vmOIV)>button{flex-shrink:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemTrailingAction-h9M5g{color:var(--fgColor-muted,#59636e);display:flex;grid-area:trailingAction}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemTrailingActionButton-pCTdP{flex-shrink:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLevelLine-F-0-2{border-color:var(--borderColor-muted,#d1d9e0b3);border-right:var(--borderWidth-thin,.0625rem) solid;height:100%;width:100%}@media (hover:hover){.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLevelLine-F-0-2{border-color:transparent}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:focus-within .prc-TreeView-TreeViewItemLevelLine-F-0-2,.prc-TreeView-TreeViewRootUlStyles-Mzrmj:hover .prc-TreeView-TreeViewItemLevelLine-F-0-2{border-color:var(--borderColor-muted,#d1d9e0b3)}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewDirectoryIcon-yP1oY{color:var(--treeViewItem-leadingVisual-iconColor-rest,#54aeff);display:grid}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewVisuallyHidden-1N8xK{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd{align-items:center;column-gap:.5rem;display:flex;height:2rem}@media (pointer:coarse){.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd{height:2.75rem}}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+1){--tree-item-loading-width:67%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+2){--tree-item-loading-width:47%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+3){--tree-item-loading-width:73%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+4){--tree-item-loading-width:64%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+5){--tree-item-loading-width:50%}.prc-TreeView-TreeItemSkeletonTextStyles-8VJ-g{width:var(--tree-item-loading-width,67%)}
2
- /*# sourceMappingURL=TreeView-0fe09f34.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/TreeView/TreeView.module.css.js"],"names":[],"mappings":"AAAA,yCAGE,eAAgB,CADhB,QAAS,CADT,SAsPF,CArOE,0EACE,YAgBF,CAdE,kMAEE,mFAOF,CALE,8BAJF,kMAKI,+BAAgC,CAEhC,iBAEJ,CADE,CAGF,wGACE,sBACF,CAGF,mFACE,SAAU,CACV,mBAAoB,CACpB,sBAAuB,CAQvB,gDAAyC,CAFzC,oCAA6B,CAC7B,cAAe,CAJf,YAAa,CAEb,8CAAuC,CAKvC,wEAAyE,CADzE,6FAA8F,CAP9F,iBAAkB,CAElB,UAAW,CAQX,gEAAmE,CACnE,+DA8BF,CA5BE,8FACE,mEAMF,CAJE,8BAHF,8FAII,6BAA8B,CAC9B,mBAEJ,CADE,CAGF,wBA3BF,mFA4BI,qBAAsB,CACtB,yBAiBJ,CAhBE,CAQA,4IAEE,4BAA6B,CAD7B,cAMF,CAHE,8BAJF,4IAKI,YAEJ,CADE,CAIJ,kHACE,+BACF,CAEA,uIACE,sEAwBF,CApBE,kJAaE,8CAAuC,CACvC,gDAAyC,CARzC,UAAW,CADX,aAAc,CAFd,sCAAmC,CAFnC,iBAAkB,CAClB,0CAAoC,CAEpC,YAeF,CAHE,8BAhBF,kJAiBI,8BAEJ,CADE,CAIJ,gFAWE,sBAAuB,CAHvB,kCAA2B,CAP3B,YAAa,CAQb,gBAAiB,CAPjB,WAAY,CAQZ,sBAAuB,CAHvB,yEAKF,CAEA,2FACE,mEACF,CAEA,mFAEE,4DAAqD,CADrD,yDAEF,CAEA,iFACE,YAAa,CAWb,oCAA+B,CAD/B,iBAAkB,CATlB,WAAY,CAQZ,+EAAkF,CAPlF,kCAA6B,CAM7B,mFAAsF,CAFtF,gFAMF,CAEA,qFACE,aAAc,CACd,OACF,CAEA,sHACE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAEA,uHAEE,qBACF,CAEA,gFAOE,kBAAmB,CADnB,kCAA2B,CAL3B,YAAa,CAIb,uCAGF,CAEA,uFAEE,kCAA2B,CAD3B,YAAa,CAEb,uBAKF,CAHE,mGACE,aACF,CAGF,wFAEE,kCAA2B,CAD3B,YAAa,CAEb,wBACF,CAEA,8FACE,aACF,CAEA,mFAQE,+CAAsC,CACtC,mDAA2C,CAP3C,WAAY,CADZ,UASF,CAQA,qBACE,mFACE,wBACF,CAEA,yLAEE,+CACF,CACF,CAEA,mFAEE,8DAAuD,CADvD,YAEF,CAEA,oFAGE,UAAW,CAGX,WAAY,CACZ,eAAgB,CAHhB,SAAU,CAHV,iBAAkB,CAClB,SAAU,CAOV,kBAAsB,CAEtB,cAAe,CADf,kBAEF,CAGF,uDAEE,kBAAmB,CACnB,gBAAkB,CAFlB,YAAa,CAGb,WAyBF,CAvBE,wBANF,uDAOI,cAsBJ,CArBE,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAGF,+CACE,wCACF","file":"TreeView-0fe09f34.css","sourcesContent":[".TreeViewRootUlStyles {\n padding: 0;\n margin: 0;\n list-style: none;\n\n /*\n * WARNING: This is a performance optimization.\n *\n * We define styles for the tree items at the root level of the tree\n * to avoid recomputing the styles for each item when the tree updates.\n * We're sacrificing maintainability for performance because TreeView\n * needs to be performant enough to handle large trees (thousands of items).\n *\n * This is intended to be a temporary solution until we can improve the\n * performance of our styling patterns.\n *\n * Do NOT copy this pattern without understanding the tradeoffs.\n */\n .TreeViewItem {\n outline: none;\n\n &:focus-visible > div,\n &:global(.focus-visible) > div {\n box-shadow: var(--boxShadow-thick) var(--fgColor-accent);\n\n @media (forced-colors: active) {\n outline: 2px solid HighlightText;\n /* stylelint-disable-next-line declaration-property-value-no-unknown */\n outline-offset: -2;\n }\n }\n\n &[data-has-leading-action] {\n --has-leading-action: 1;\n }\n }\n\n .TreeViewItemContainer {\n --level: 1;\n --toggle-width: 1rem;\n --min-item-height: 2rem;\n\n position: relative;\n display: grid;\n width: 100%;\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-default);\n cursor: pointer;\n border-radius: var(--borderRadius-medium);\n grid-template-columns: var(--spacer-width) var(--leading-action-width) var(--toggle-width) 1fr;\n grid-template-areas: 'spacer leadingAction toggle content trailingAction';\n\n --leading-action-width: calc(var(--has-leading-action, 0) * 1.5rem);\n --spacer-width: calc(calc(var(--level) - 1) * (var(--toggle-width) / 2));\n\n &:hover {\n background-color: var(--control-transparent-bgColor-hover);\n\n @media (forced-colors: active) {\n outline: 2px solid transparent;\n outline-offset: -2px;\n }\n }\n\n @media (pointer: coarse) {\n --toggle-width: 1.5rem;\n --min-item-height: 2.75rem;\n }\n\n /*\n * NOTE: Uses descendant :has() - TreeViewItemSkeleton is nested inside\n * TreeViewItemContent > TreeViewItemContentText, not a direct child.\n * This is acceptable as the search is scoped to this element's subtree.\n */\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(.TreeViewItemSkeleton):hover {\n cursor: default;\n background-color: transparent;\n\n @media (forced-colors: active) {\n outline: none;\n }\n }\n }\n\n &:where([data-omit-spacer='true']) .TreeViewItemContainer {\n grid-template-columns: 0 0 0 1fr;\n }\n\n .TreeViewItem[aria-current='true'] > .TreeViewItemContainer {\n background-color: var(--control-transparent-bgColor-selected);\n\n /* Current item indicator */\n /* stylelint-disable-next-line selector-max-specificity */\n &::after {\n position: absolute;\n top: calc(50% - var(--base-size-12));\n left: calc(-1 * var(--base-size-8));\n width: 0.25rem;\n height: 1.5rem;\n content: '';\n\n /*\n * Use fgColor accent for consistency across all themes. Using the \"correct\" variable,\n * --bgColor-accent-emphasis, causes vrt failures for dark high contrast mode\n */\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--fgColor-accent);\n border-radius: var(--borderRadius-medium);\n\n @media (forced-colors: active) {\n background-color: HighlightText;\n }\n }\n }\n\n .TreeViewItemToggle {\n display: flex;\n height: 100%;\n\n /* The toggle should appear vertically centered for single-line items, but remain at the top for items that wrap\n across more lines. */\n /* stylelint-disable-next-line primer/spacing */\n padding-top: calc(var(--min-item-height) / 2 - var(--base-size-12) / 2);\n color: var(--fgColor-muted);\n grid-area: toggle;\n justify-content: center;\n align-items: flex-start;\n }\n\n .TreeViewItemToggleHover:hover {\n background-color: var(--control-transparent-bgColor-hover);\n }\n\n .TreeViewItemToggleEnd {\n border-top-left-radius: var(--borderRadius-medium);\n border-bottom-left-radius: var(--borderRadius-medium);\n }\n\n .TreeViewItemContent {\n display: flex;\n height: 100%;\n padding: 0 var(--base-size-8);\n\n /* The dynamic top and bottom padding to maintain the minimum item height for single line items */\n /* stylelint-disable-next-line primer/spacing */\n padding-top: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem)) / 2);\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem)) / 2);\n line-height: var(--custom-line-height, var(--text-body-lineHeight-medium, 1.4285));\n grid-area: content;\n gap: var(--stack-gap-condensed);\n }\n\n .TreeViewItemContentText {\n flex: 1 1 auto;\n width: 0;\n }\n\n &:where([data-truncate-text='true']) .TreeViewItemContentText {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &:where([data-truncate-text='false']) .TreeViewItemContentText {\n /* stylelint-disable-next-line declaration-property-value-keyword-no-deprecated */\n word-break: break-word;\n }\n\n .TreeViewItemVisual {\n display: flex;\n\n /* The visual icons should appear vertically centered for single-line items, but remain at the top for items that wrap\n across more lines. */\n height: var(--custom-line-height, 1.3rem);\n color: var(--fgColor-muted);\n align-items: center;\n }\n\n .TreeViewItemLeadingAction {\n display: flex;\n color: var(--fgColor-muted);\n grid-area: leadingAction;\n\n & > button {\n flex-shrink: 1;\n }\n }\n\n .TreeViewItemTrailingAction {\n display: flex;\n color: var(--fgColor-muted);\n grid-area: trailingAction;\n }\n\n .TreeViewItemTrailingActionButton {\n flex-shrink: 1;\n }\n\n .TreeViewItemLevelLine {\n width: 100%;\n height: 100%;\n\n /*\n * On devices without hover, the nesting indicator lines\n * appear at all times.\n */\n border-color: var(--borderColor-muted);\n border-right: var(--borderWidth-thin) solid;\n }\n\n /*\n * On devices with :hover support, the nesting indicator lines\n * fade in when the user mouses over the entire component,\n * or when there's focus inside the component. This makes\n * sure the component remains simple when not in use.\n */\n @media (hover: hover) {\n .TreeViewItemLevelLine {\n border-color: transparent;\n }\n\n &:hover .TreeViewItemLevelLine,\n &:focus-within .TreeViewItemLevelLine {\n border-color: var(--borderColor-muted);\n }\n }\n\n .TreeViewDirectoryIcon {\n display: grid;\n color: var(--treeViewItem-leadingVisual-iconColor-rest);\n }\n\n .TreeViewVisuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n /* stylelint-disable-next-line primer/spacing */\n margin: -1px;\n overflow: hidden;\n /* stylelint-disable-next-line property-no-deprecated */\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n}\n\n.TreeViewSkeletonItemContainerStyle {\n display: flex;\n align-items: center;\n column-gap: 0.5rem;\n height: 2rem;\n\n @media (pointer: coarse) {\n height: 2.75rem;\n }\n\n &:nth-of-type(5n + 1) {\n --tree-item-loading-width: 67%;\n }\n\n &:nth-of-type(5n + 2) {\n --tree-item-loading-width: 47%;\n }\n\n &:nth-of-type(5n + 3) {\n --tree-item-loading-width: 73%;\n }\n\n &:nth-of-type(5n + 4) {\n --tree-item-loading-width: 64%;\n }\n\n &:nth-of-type(5n + 5) {\n --tree-item-loading-width: 50%;\n }\n}\n\n.TreeItemSkeletonTextStyles {\n width: var(--tree-item-loading-width, 67%);\n}\n"]}
@@ -1,32 +0,0 @@
1
- import { isMacOS } from '@primer/behaviors/utils';
2
- import { useSyncExternalStore } from 'react';
3
-
4
- // No-op. The platform never changes at runtime, so there is nothing to
5
- // subscribe to. Hoisted to avoid creating a new function on every call.
6
- const subscribe = () => () => {};
7
-
8
- // Safe default for SSR since we can't detect the platform on the server.
9
- const getServerSnapshot = () => false;
10
-
11
- /**
12
- * SSR-safe hook for determining if the current platform is MacOS.
13
- *
14
- * Uses `useSyncExternalStore` to read the platform value:
15
- *
16
- * - On the **client**, `ssrUnsafeIsMacOS` reads `navigator.userAgent` and
17
- * returns the real value immediately, with no extra render pass.
18
- *
19
- * - On the **server**, returns `false`. During hydration, if the snapshots
20
- * differ, React handles the mismatch internally in a single synchronous
21
- * pass, avoiding the layout shift that a deferred `useEffect` + `setState`
22
- * would cause.
23
- *
24
- * Previous implementation used `useState` + `useEffect`, which caused an
25
- * unconditional second render on every mount (even on the client where the
26
- * initial value was already correct).
27
- */
28
- function useIsMacOS() {
29
- return useSyncExternalStore(subscribe, isMacOS, getServerSnapshot);
30
- }
31
-
32
- export { useIsMacOS };