@primer/react 0.0.0-20260408170654 → 0.0.0-20260408182140

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.
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
2
2
  import React, { useRef, useEffect } from 'react';
3
3
  import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
4
4
  import { Portal } from '../Portal/Portal.js';
5
- import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
5
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
6
6
  import classes from './Overlay.module.css.js';
7
7
  import { clsx } from 'clsx';
8
8
  import { jsx } from 'react/jsx-runtime';
@@ -116,7 +116,7 @@ const BaseOverlay = /*#__PURE__*/React.forwardRef(({
116
116
 
117
117
  */
118
118
  const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
119
- const $ = c(49);
119
+ const $ = c(50);
120
120
  let _PrivateDisablePortal;
121
121
  let anchorSide;
122
122
  let ignoreClickRefs;
@@ -202,7 +202,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
202
202
  const width = t5 === undefined ? "auto" : t5;
203
203
  const featureFlagMaxHeightClampToViewport = useFeatureFlag("primer_react_overlay_max_height_clamp_to_viewport");
204
204
  const overlayRef = useRef(null);
205
- useRefObjectAsForwardedRef(forwardedRef, overlayRef);
205
+ const mergedRef = useMergedRefs(forwardedRef, overlayRef);
206
206
  const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
207
207
  let t6;
208
208
  if ($[19] !== ignoreClickRefs || $[20] !== initialFocusRef || $[21] !== onClickOutside || $[22] !== onEscape || $[23] !== preventFocusOnOpen || $[24] !== returnFocusRef) {
@@ -286,12 +286,12 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
286
286
  t12 = $[34];
287
287
  }
288
288
  let t13;
289
- if ($[35] !== height || $[36] !== leftPosition || $[37] !== props || $[38] !== responsiveVariant || $[39] !== right || $[40] !== role || $[41] !== t11 || $[42] !== t12 || $[43] !== visibility || $[44] !== width) {
289
+ if ($[35] !== height || $[36] !== leftPosition || $[37] !== mergedRef || $[38] !== props || $[39] !== responsiveVariant || $[40] !== right || $[41] !== role || $[42] !== t11 || $[43] !== t12 || $[44] !== visibility || $[45] !== width) {
290
290
  t13 = /*#__PURE__*/jsx(BaseOverlay, {
291
291
  role: role,
292
292
  width: width,
293
293
  "data-reflow-container": t11,
294
- ref: overlayRef,
294
+ ref: mergedRef,
295
295
  left: leftPosition,
296
296
  right: right,
297
297
  height: height,
@@ -302,33 +302,34 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
302
302
  });
303
303
  $[35] = height;
304
304
  $[36] = leftPosition;
305
- $[37] = props;
306
- $[38] = responsiveVariant;
307
- $[39] = right;
308
- $[40] = role;
309
- $[41] = t11;
310
- $[42] = t12;
311
- $[43] = visibility;
312
- $[44] = width;
313
- $[45] = t13;
305
+ $[37] = mergedRef;
306
+ $[38] = props;
307
+ $[39] = responsiveVariant;
308
+ $[40] = right;
309
+ $[41] = role;
310
+ $[42] = t11;
311
+ $[43] = t12;
312
+ $[44] = visibility;
313
+ $[45] = width;
314
+ $[46] = t13;
314
315
  } else {
315
- t13 = $[45];
316
+ t13 = $[46];
316
317
  }
317
318
  const overlayContent = t13;
318
319
  if (_PrivateDisablePortal && cssAnchorPositioning) {
319
320
  return overlayContent;
320
321
  }
321
322
  let t14;
322
- if ($[46] !== overlayContent || $[47] !== portalContainerName) {
323
+ if ($[47] !== overlayContent || $[48] !== portalContainerName) {
323
324
  t14 = /*#__PURE__*/jsx(Portal, {
324
325
  containerName: portalContainerName,
325
326
  children: overlayContent
326
327
  });
327
- $[46] = overlayContent;
328
- $[47] = portalContainerName;
329
- $[48] = t14;
328
+ $[47] = overlayContent;
329
+ $[48] = portalContainerName;
330
+ $[49] = t14;
330
331
  } else {
331
- t14 = $[48];
332
+ t14 = $[49];
332
333
  }
333
334
  return t14;
334
335
  });
@@ -1,7 +1,7 @@
1
1
  import React, { useRef, memo } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import { useId } from '../hooks/useId.js';
4
- import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
4
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
5
5
  import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
6
6
  import { useSlots } from '../hooks/useSlots.js';
7
7
  import { useOverflow } from '../hooks/useOverflow.js';
@@ -581,7 +581,7 @@ const Pane = /*#__PURE__*/React.forwardRef(({
581
581
  onResizeEnd,
582
582
  currentWidth: controlledWidth
583
583
  });
584
- useRefObjectAsForwardedRef(forwardRef, paneRef);
584
+ const mergedRef = useMergedRefs(forwardRef, paneRef);
585
585
  const hasOverflow = useOverflow(paneRef);
586
586
  const paneId = useId(id);
587
587
  const labelProp = {};
@@ -615,7 +615,7 @@ const Pane = /*#__PURE__*/React.forwardRef(({
615
615
  },
616
616
  position: positionProp
617
617
  }), /*#__PURE__*/jsx("div", {
618
- ref: paneRef
618
+ ref: mergedRef
619
619
  // Suppress hydration mismatch for --pane-width when localStorage
620
620
  // provides a width that differs from the server-rendered default.
621
621
  // Not needed when onResizeEnd is provided (localStorage isn't read).
@@ -785,7 +785,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
785
785
  contentWrapperRef: sidebarContentWrapperRef,
786
786
  constrainToViewport: true
787
787
  });
788
- useRefObjectAsForwardedRef(forwardRef, sidebarRef);
788
+ const mergedRef = useMergedRefs(forwardRef, sidebarRef);
789
789
  const hasOverflow = useOverflow(sidebarRef);
790
790
  const sidebarId = useId(id);
791
791
  const labelProp = {};
@@ -824,7 +824,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
824
824
  getDefaultWidth: getDefaultWidth,
825
825
  saveWidth: saveWidth
826
826
  }), /*#__PURE__*/jsx("div", {
827
- ref: sidebarRef
827
+ ref: mergedRef
828
828
  // Suppress hydration mismatch for --pane-width when localStorage
829
829
  // provides a width that differs from the server-rendered default.
830
830
  ,
@@ -3,7 +3,7 @@ import { FocusKeys } from '@primer/behaviors';
3
3
  import { isFocusable } from '@primer/behaviors/utils';
4
4
  import React, { useRef, useState } from 'react';
5
5
  import { isValidElementType } from 'react-is';
6
- import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
6
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
7
7
  import { useFocusZone } from '../hooks/useFocusZone.js';
8
8
  import { useId } from '../hooks/useId.js';
9
9
  import Token from '../Token/Token.js';
@@ -25,7 +25,7 @@ const overflowCountClassMap = {
25
25
 
26
26
  // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
27
27
  function TextInputWithTokensInnerComponent(t0, forwardedRef) {
28
- const $ = c(151);
28
+ const $ = c(152);
29
29
  let IconComponent;
30
30
  let LeadingVisual;
31
31
  let TrailingVisual;
@@ -165,7 +165,7 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
165
165
  }
166
166
  const ref = useRef(null);
167
167
  const selectedValuesDescriptionId = useId();
168
- useRefObjectAsForwardedRef(forwardedRef, ref);
168
+ const mergedRef = useMergedRefs(forwardedRef, ref);
169
169
  const [selectedTokenIndex, setSelectedTokenIndex] = useState();
170
170
  const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
171
171
  let t6;
@@ -455,9 +455,9 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
455
455
  const t32 = validationStatus === "error" ? "true" : "false";
456
456
  const t33 = ariaDescribedBy || undefined;
457
457
  let t34;
458
- if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== role || $[86] !== t32 || $[87] !== t33) {
458
+ if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== mergedRef || $[86] !== role || $[87] !== t32 || $[88] !== t33) {
459
459
  t34 = /*#__PURE__*/jsx(UnstyledTextInput, {
460
- ref: ref,
460
+ ref: mergedRef,
461
461
  disabled: disabled,
462
462
  onFocus: handleInputFocus,
463
463
  onBlur: handleInputBlur,
@@ -474,42 +474,43 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
474
474
  $[82] = handleInputFocus;
475
475
  $[83] = handleInputKeyDown;
476
476
  $[84] = inputPropsRest;
477
- $[85] = role;
478
- $[86] = t32;
479
- $[87] = t33;
480
- $[88] = t34;
477
+ $[85] = mergedRef;
478
+ $[86] = role;
479
+ $[87] = t32;
480
+ $[88] = t33;
481
+ $[89] = t34;
481
482
  } else {
482
- t34 = $[88];
483
+ t34 = $[89];
483
484
  }
484
485
  let t35;
485
- if ($[89] !== selectedValuesDescription || $[90] !== selectedValuesDescriptionId || $[91] !== shouldExposeSelectedValuesDescription) {
486
+ if ($[90] !== selectedValuesDescription || $[91] !== selectedValuesDescriptionId || $[92] !== shouldExposeSelectedValuesDescription) {
486
487
  t35 = shouldExposeSelectedValuesDescription ? /*#__PURE__*/jsx(VisuallyHidden, {
487
488
  id: selectedValuesDescriptionId,
488
489
  children: selectedValuesDescription
489
490
  }) : null;
490
- $[89] = selectedValuesDescription;
491
- $[90] = selectedValuesDescriptionId;
492
- $[91] = shouldExposeSelectedValuesDescription;
493
- $[92] = t35;
491
+ $[90] = selectedValuesDescription;
492
+ $[91] = selectedValuesDescriptionId;
493
+ $[92] = shouldExposeSelectedValuesDescription;
494
+ $[93] = t35;
494
495
  } else {
495
- t35 = $[92];
496
+ t35 = $[93];
496
497
  }
497
498
  let t36;
498
- if ($[93] !== t34 || $[94] !== t35) {
499
+ if ($[94] !== t34 || $[95] !== t35) {
499
500
  t36 = /*#__PURE__*/jsxs("div", {
500
501
  className: styles.InputWrapper,
501
502
  children: [t34, t35]
502
503
  });
503
- $[93] = t34;
504
- $[94] = t35;
505
- $[95] = t36;
504
+ $[94] = t34;
505
+ $[95] = t35;
506
+ $[96] = t36;
506
507
  } else {
507
- t36 = $[95];
508
+ t36 = $[96];
508
509
  }
509
510
  let t37;
510
- if ($[96] !== TokenComponent || $[97] !== disabled || $[98] !== handleTokenBlur || $[99] !== handleTokenFocus || $[100] !== handleTokenRemove || $[101] !== hideTokenRemoveButtons || $[102] !== selectedTokenIndex || $[103] !== size || $[104] !== visibleTokens) {
511
+ if ($[97] !== TokenComponent || $[98] !== disabled || $[99] !== handleTokenBlur || $[100] !== handleTokenFocus || $[101] !== handleTokenRemove || $[102] !== hideTokenRemoveButtons || $[103] !== selectedTokenIndex || $[104] !== size || $[105] !== visibleTokens) {
511
512
  let t38;
512
- if ($[106] !== TokenComponent || $[107] !== disabled || $[108] !== handleTokenBlur || $[109] !== handleTokenFocus || $[110] !== handleTokenRemove || $[111] !== hideTokenRemoveButtons || $[112] !== selectedTokenIndex || $[113] !== size) {
513
+ if ($[107] !== TokenComponent || $[108] !== disabled || $[109] !== handleTokenBlur || $[110] !== handleTokenFocus || $[111] !== handleTokenRemove || $[112] !== hideTokenRemoveButtons || $[113] !== selectedTokenIndex || $[114] !== size) {
513
514
  t38 = (t39, i) => {
514
515
  const {
515
516
  id,
@@ -531,89 +532,89 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
531
532
  ...tokenRest
532
533
  }, id);
533
534
  };
534
- $[106] = TokenComponent;
535
- $[107] = disabled;
536
- $[108] = handleTokenBlur;
537
- $[109] = handleTokenFocus;
538
- $[110] = handleTokenRemove;
539
- $[111] = hideTokenRemoveButtons;
540
- $[112] = selectedTokenIndex;
541
- $[113] = size;
542
- $[114] = t38;
535
+ $[107] = TokenComponent;
536
+ $[108] = disabled;
537
+ $[109] = handleTokenBlur;
538
+ $[110] = handleTokenFocus;
539
+ $[111] = handleTokenRemove;
540
+ $[112] = hideTokenRemoveButtons;
541
+ $[113] = selectedTokenIndex;
542
+ $[114] = size;
543
+ $[115] = t38;
543
544
  } else {
544
- t38 = $[114];
545
+ t38 = $[115];
545
546
  }
546
547
  t37 = visibleTokens.map(t38);
547
- $[96] = TokenComponent;
548
- $[97] = disabled;
549
- $[98] = handleTokenBlur;
550
- $[99] = handleTokenFocus;
551
- $[100] = handleTokenRemove;
552
- $[101] = hideTokenRemoveButtons;
553
- $[102] = selectedTokenIndex;
554
- $[103] = size;
555
- $[104] = visibleTokens;
556
- $[105] = t37;
548
+ $[97] = TokenComponent;
549
+ $[98] = disabled;
550
+ $[99] = handleTokenBlur;
551
+ $[100] = handleTokenFocus;
552
+ $[101] = handleTokenRemove;
553
+ $[102] = hideTokenRemoveButtons;
554
+ $[103] = selectedTokenIndex;
555
+ $[104] = size;
556
+ $[105] = visibleTokens;
557
+ $[106] = t37;
557
558
  } else {
558
- t37 = $[105];
559
+ t37 = $[106];
559
560
  }
560
561
  let t38;
561
- if ($[115] !== size || $[116] !== tokens.length || $[117] !== tokensAreTruncated || $[118] !== visibleTokens.length) {
562
+ if ($[116] !== size || $[117] !== tokens.length || $[118] !== tokensAreTruncated || $[119] !== visibleTokens.length) {
562
563
  t38 = tokensAreTruncated && tokens.length - visibleTokens.length ? /*#__PURE__*/jsxs(Text, {
563
564
  className: overflowCountClassMap[size],
564
565
  children: ["+", tokens.length - visibleTokens.length]
565
566
  }) : null;
566
- $[115] = size;
567
- $[116] = tokens.length;
568
- $[117] = tokensAreTruncated;
569
- $[118] = visibleTokens.length;
570
- $[119] = t38;
567
+ $[116] = size;
568
+ $[117] = tokens.length;
569
+ $[118] = tokensAreTruncated;
570
+ $[119] = visibleTokens.length;
571
+ $[120] = t38;
571
572
  } else {
572
- t38 = $[119];
573
+ t38 = $[120];
573
574
  }
574
575
  let t39;
575
- if ($[120] !== preventTokenWrapping || $[121] !== t31 || $[122] !== t36 || $[123] !== t37 || $[124] !== t38) {
576
+ if ($[121] !== preventTokenWrapping || $[122] !== t31 || $[123] !== t36 || $[124] !== t37 || $[125] !== t38) {
576
577
  t39 = /*#__PURE__*/jsxs("div", {
577
578
  ref: t31,
578
579
  className: styles.Container,
579
580
  "data-prevent-token-wrapping": preventTokenWrapping,
580
581
  children: [t36, t37, t38]
581
582
  });
582
- $[120] = preventTokenWrapping;
583
- $[121] = t31;
584
- $[122] = t36;
585
- $[123] = t37;
586
- $[124] = t38;
587
- $[125] = t39;
583
+ $[121] = preventTokenWrapping;
584
+ $[122] = t31;
585
+ $[123] = t36;
586
+ $[124] = t37;
587
+ $[125] = t38;
588
+ $[126] = t39;
588
589
  } else {
589
- t39 = $[125];
590
+ t39 = $[126];
590
591
  }
591
592
  const t40 = typeof loading === "boolean";
592
593
  let t41;
593
- if ($[126] !== TrailingVisual) {
594
+ if ($[127] !== TrailingVisual) {
594
595
  t41 = typeof TrailingVisual !== "string" && isValidElementType(TrailingVisual) ? /*#__PURE__*/jsx(TrailingVisual, {}) : TrailingVisual;
595
- $[126] = TrailingVisual;
596
- $[127] = t41;
596
+ $[127] = TrailingVisual;
597
+ $[128] = t41;
597
598
  } else {
598
- t41 = $[127];
599
+ t41 = $[128];
599
600
  }
600
601
  let t42;
601
- if ($[128] !== showTrailingLoadingIndicator || $[129] !== t40 || $[130] !== t41) {
602
+ if ($[129] !== showTrailingLoadingIndicator || $[130] !== t40 || $[131] !== t41) {
602
603
  t42 = /*#__PURE__*/jsx(TextInputInnerVisualSlot, {
603
604
  hasLoadingIndicator: t40,
604
605
  visualPosition: "trailing",
605
606
  showLoadingIndicator: showTrailingLoadingIndicator,
606
607
  children: t41
607
608
  });
608
- $[128] = showTrailingLoadingIndicator;
609
- $[129] = t40;
610
- $[130] = t41;
611
- $[131] = t42;
609
+ $[129] = showTrailingLoadingIndicator;
610
+ $[130] = t40;
611
+ $[131] = t41;
612
+ $[132] = t42;
612
613
  } else {
613
- t42 = $[131];
614
+ t42 = $[132];
614
615
  }
615
616
  let t43;
616
- if ($[132] !== block || $[133] !== contrast || $[134] !== disabled || $[135] !== maxWidthProp || $[136] !== minWidthProp || $[137] !== t21 || $[138] !== t22 || $[139] !== t23 || $[140] !== t24 || $[141] !== t25 || $[142] !== t26 || $[143] !== t27 || $[144] !== t30 || $[145] !== t39 || $[146] !== t42 || $[147] !== validationStatus || $[148] !== variantProp || $[149] !== widthProp) {
617
+ if ($[133] !== block || $[134] !== contrast || $[135] !== disabled || $[136] !== maxWidthProp || $[137] !== minWidthProp || $[138] !== t21 || $[139] !== t22 || $[140] !== t23 || $[141] !== t24 || $[142] !== t25 || $[143] !== t26 || $[144] !== t27 || $[145] !== t30 || $[146] !== t39 || $[147] !== t42 || $[148] !== validationStatus || $[149] !== variantProp || $[150] !== widthProp) {
617
618
  t43 = /*#__PURE__*/jsxs(TextInputWrapper, {
618
619
  block: block,
619
620
  contrast: contrast,
@@ -632,27 +633,27 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
632
633
  style: t26,
633
634
  children: [t27, t30, t39, t42]
634
635
  });
635
- $[132] = block;
636
- $[133] = contrast;
637
- $[134] = disabled;
638
- $[135] = maxWidthProp;
639
- $[136] = minWidthProp;
640
- $[137] = t21;
641
- $[138] = t22;
642
- $[139] = t23;
643
- $[140] = t24;
644
- $[141] = t25;
645
- $[142] = t26;
646
- $[143] = t27;
647
- $[144] = t30;
648
- $[145] = t39;
649
- $[146] = t42;
650
- $[147] = validationStatus;
651
- $[148] = variantProp;
652
- $[149] = widthProp;
653
- $[150] = t43;
636
+ $[133] = block;
637
+ $[134] = contrast;
638
+ $[135] = disabled;
639
+ $[136] = maxWidthProp;
640
+ $[137] = minWidthProp;
641
+ $[138] = t21;
642
+ $[139] = t22;
643
+ $[140] = t23;
644
+ $[141] = t24;
645
+ $[142] = t25;
646
+ $[143] = t26;
647
+ $[144] = t27;
648
+ $[145] = t30;
649
+ $[146] = t39;
650
+ $[147] = t42;
651
+ $[148] = validationStatus;
652
+ $[149] = variantProp;
653
+ $[150] = widthProp;
654
+ $[151] = t43;
654
655
  } else {
655
- t43 = $[150];
656
+ t43 = $[151];
656
657
  }
657
658
  return t43;
658
659
  }
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
2
2
  import React, { forwardRef, useRef } from 'react';
3
3
  import { IconButton } from '../../Button/IconButton.js';
4
4
  import useDialog from '../../hooks/useDialog.js';
5
- import { useRefObjectAsForwardedRef } from '../../hooks/useRefObjectAsForwardedRef.js';
5
+ import { useMergedRefs } from '../../hooks/useMergedRefs.js';
6
6
  import { XIcon } from '@primer/octicons-react';
7
7
  import { clsx } from 'clsx';
8
8
  import classes from './Dialog.module.css.js';
@@ -78,7 +78,7 @@ function _temp(ch) {
78
78
  return typeof ch === "string";
79
79
  }
80
80
  const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
81
- const $ = c(25);
81
+ const $ = c(26);
82
82
  let children;
83
83
  let className;
84
84
  let initialFocusRef;
@@ -121,7 +121,7 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
121
121
  const Component = t2 === undefined ? "div" : t2;
122
122
  const overlayRef = useRef(null);
123
123
  const modalRef = useRef(null);
124
- useRefObjectAsForwardedRef(forwardedRef, modalRef);
124
+ const mergedRef = useMergedRefs(forwardedRef, modalRef);
125
125
  const closeButtonRef = useRef(null);
126
126
  let t3;
127
127
  if ($[9] !== onDismiss || $[10] !== returnFocusRef) {
@@ -161,14 +161,14 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
161
161
  getDialogProps
162
162
  } = useDialog(t4);
163
163
  let t5;
164
- if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !== getDialogProps || $[21] !== isOpen || $[22] !== onCloseClick || $[23] !== props) {
164
+ if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !== getDialogProps || $[21] !== isOpen || $[22] !== mergedRef || $[23] !== onCloseClick || $[24] !== props) {
165
165
  t5 = isOpen ? /*#__PURE__*/jsxs(Fragment, {
166
166
  children: [/*#__PURE__*/jsx("span", {
167
167
  className: classes.Overlay,
168
168
  ref: overlayRef
169
169
  }), /*#__PURE__*/jsxs(Component, {
170
170
  tabIndex: -1,
171
- ref: modalRef,
171
+ ref: mergedRef,
172
172
  role: "dialog",
173
173
  "aria-modal": "true",
174
174
  ...props,
@@ -190,11 +190,12 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
190
190
  $[19] = className;
191
191
  $[20] = getDialogProps;
192
192
  $[21] = isOpen;
193
- $[22] = onCloseClick;
194
- $[23] = props;
195
- $[24] = t5;
193
+ $[22] = mergedRef;
194
+ $[23] = onCloseClick;
195
+ $[24] = props;
196
+ $[25] = t5;
196
197
  } else {
197
- t5 = $[24];
198
+ t5 = $[25];
198
199
  }
199
200
  return t5;
200
201
  });
@@ -9,6 +9,8 @@ export { Blankslate } from '../Blankslate';
9
9
  export type { BlankslateProps } from '../Blankslate';
10
10
  export { ButtonBase } from '../Button';
11
11
  export type { ButtonBaseProps } from '../Button';
12
+ export { Card } from '../Card';
13
+ export type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardMenuProps, CardMetadataProps, } from '../Card';
12
14
  export { DataTable, Table, createColumnHelper } from '../DataTable';
13
15
  export type { DataTableProps, TableProps, TableHeadProps, TableBodyProps, TableRowProps, TableHeaderProps, TableCellProps, TableContainerProps, TableTitleProps, TableSubtitleProps, TableActionsProps, Column, CellAlignment, ColumnWidth, UniqueRow, ObjectPaths, } from '../DataTable';
14
16
  export * from '../Dialog';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,eAAe,CAAA;AAElD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AACpC,YAAY,EAAC,eAAe,EAAC,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAA;AACjE,YAAY,EACV,cAAc,EACd,U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,6 @@
1
1
  "use client";
2
2
  export { Blankslate } from '../Blankslate/index.js';
3
+ export { Card } from '../Card/index.js';
3
4
  export { Table } from '../DataTable/index.js';
4
5
  export { ActionBar } from '../ActionBar/index.js';
5
6
  export { Stack } from '../Stack/index.js';
@@ -15,18 +15,18 @@ import type { ForwardedRef, Ref as StandardRef } from 'react';
15
15
  * // React 18
16
16
  * const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
17
17
  * const ref = useRef<HTMLButtonElement>(null)
18
- * const combinedRef = useMergedRefs(forwardedRef, ref)
18
+ * const mergedRef = useMergedRefs(forwardedRef, ref)
19
19
  *
20
- * return <button ref={combinedRef} />
20
+ * return <button ref={mergedRef} />
21
21
  * })
22
22
  *
23
23
  * @example
24
24
  * // React 19
25
25
  * const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
26
26
  * const ref = useRef<HTMLButtonElement>(null)
27
- * const combinedRef = useMergedRefs(externalRef, ref)
27
+ * const mergedRef = useMergedRefs(externalRef, ref)
28
28
  *
29
- * return <button ref={combinedRef} />
29
+ * return <button ref={mergedRef} />
30
30
  * }
31
31
  */
32
32
  export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => () => void;
@@ -17,18 +17,18 @@ import 'react';
17
17
  * // React 18
18
18
  * const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
19
19
  * const ref = useRef<HTMLButtonElement>(null)
20
- * const combinedRef = useMergedRefs(forwardedRef, ref)
20
+ * const mergedRef = useMergedRefs(forwardedRef, ref)
21
21
  *
22
- * return <button ref={combinedRef} />
22
+ * return <button ref={mergedRef} />
23
23
  * })
24
24
  *
25
25
  * @example
26
26
  * // React 19
27
27
  * const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
28
28
  * const ref = useRef<HTMLButtonElement>(null)
29
- * const combinedRef = useMergedRefs(externalRef, ref)
29
+ * const mergedRef = useMergedRefs(externalRef, ref)
30
30
  *
31
- * return <button ref={combinedRef} />
31
+ * return <button ref={mergedRef} />
32
32
  * }
33
33
  */
34
34
  function useMergedRefs(refA, refB) {
@@ -2100,6 +2100,97 @@
2100
2100
  ],
2101
2101
  "subcomponents": []
2102
2102
  },
2103
+ "card": {
2104
+ "source": "https://github.com/primer/react/tree/main/packages/react/src/Card",
2105
+ "id": "card",
2106
+ "name": "Card",
2107
+ "status": "draft",
2108
+ "a11yReviewed": false,
2109
+ "importPath": "@primer/react/experimental",
2110
+ "stories": [
2111
+ {
2112
+ "id": "experimental-components-card--default",
2113
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RocketIcon} />\n <Card.Heading>Card Heading</Card.Heading>\n <Card.Description>\n This is a description of the card providing supplemental information.\n </Card.Description>\n <Card.Metadata>Updated 2 hours ago</Card.Metadata>\n </Card>\n </div>\n )\n}"
2114
+ },
2115
+ {
2116
+ "id": "experimental-components-card-features--with-image",
2117
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Image src=\"https://github.com/octocat.png\" alt=\"Octocat\" />\n <Card.Heading>Card with Image</Card.Heading>\n <Card.Description>\n This card uses an edge-to-edge image instead of an icon.\n </Card.Description>\n </Card>\n </div>\n )\n}"
2118
+ },
2119
+ {
2120
+ "id": "experimental-components-card-features--with-metadata",
2121
+ "code": "() => {\n return (\n <div\n style={{\n maxWidth: '400px',\n }}\n >\n <Card>\n <Card.Icon icon={RepoIcon} />\n <Card.Heading>primer/react</Card.Heading>\n <Card.Description>\n {\n \"GitHub's design system implemented as React components for building consistent user interfaces.\"\n }\n </Card.Description>\n <Card.Metadata>\n <StarIcon size={16} />\n 1.2k stars\n </Card.Metadata>\n </Card>\n </div>\n )\n}"
2122
+ }
2123
+ ],
2124
+ "props": [
2125
+ {
2126
+ "name": "className",
2127
+ "type": "string",
2128
+ "description": "CSS class name(s) for custom styling."
2129
+ },
2130
+ {
2131
+ "name": "padding",
2132
+ "type": "'none' | 'condensed' | 'normal'",
2133
+ "defaultValue": "'normal'",
2134
+ "description": "Controls the internal padding of the Card."
2135
+ }
2136
+ ],
2137
+ "subcomponents": [
2138
+ {
2139
+ "name": "Card.Icon",
2140
+ "props": [
2141
+ {
2142
+ "name": "icon",
2143
+ "type": "React.ElementType",
2144
+ "description": "An Octicon or custom SVG icon to render."
2145
+ },
2146
+ {
2147
+ "name": "aria-label",
2148
+ "type": "string",
2149
+ "description": "Accessible label for the icon. When omitted, the icon is treated as decorative."
2150
+ }
2151
+ ]
2152
+ },
2153
+ {
2154
+ "name": "Card.Image",
2155
+ "props": [
2156
+ {
2157
+ "name": "src",
2158
+ "type": "string",
2159
+ "description": "The image source URL."
2160
+ },
2161
+ {
2162
+ "name": "alt",
2163
+ "type": "string",
2164
+ "defaultValue": "\"\"",
2165
+ "description": "Alt text for accessibility. Defaults to empty string (decorative)."
2166
+ }
2167
+ ]
2168
+ },
2169
+ {
2170
+ "name": "Card.Heading",
2171
+ "props": [
2172
+ {
2173
+ "name": "as",
2174
+ "type": "'h2' | 'h3' | 'h4' | 'h5' | 'h6'",
2175
+ "defaultValue": "'h3'",
2176
+ "description": "The heading level to render."
2177
+ }
2178
+ ]
2179
+ },
2180
+ {
2181
+ "name": "Card.Description",
2182
+ "props": []
2183
+ },
2184
+ {
2185
+ "name": "Card.Menu",
2186
+ "props": []
2187
+ },
2188
+ {
2189
+ "name": "Card.Metadata",
2190
+ "props": []
2191
+ }
2192
+ ]
2193
+ },
2103
2194
  "checkbox": {
2104
2195
  "source": "https://github.com/primer/react/tree/main/packages/react/src/Checkbox",
2105
2196
  "id": "checkbox",