@primer/react 38.34.0-rc.ac0faffd6 → 38.34.0-rc.d17f87af7

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.
@@ -1,8 +1,8 @@
1
1
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
2
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
3
  import { useOverlay } from "../hooks/useOverlay.js";
4
- import Portal_default from "../Portal/index.js";
5
4
  import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
+ import Portal_default from "../Portal/index.js";
6
6
  import Overlay_module_css_default from "./Overlay.module.css.js";
7
7
  import { clsx } from "clsx";
8
8
  import { jsx } from "react/jsx-runtime";
@@ -1,6 +1,8 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import { warning } from "../utils/warning.js";
3
4
  import { isSlot } from "../utils/is-slot.js";
5
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
4
6
  import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
5
7
  import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
6
8
  import Heading from "../Heading/Heading.js";
@@ -10,7 +12,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
10
12
  import { c } from "react-compiler-runtime";
11
13
  import { clsx } from "clsx";
12
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- import React, { useEffect } from "react";
15
+ import React, { useEffect, useRef } from "react";
14
16
  import { ArrowLeftIcon } from "@primer/octicons-react";
15
17
  //#region src/PageHeader/PageHeader.tsx
16
18
  const hiddenOnRegularAndWide = {
@@ -27,7 +29,12 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
27
29
  const $ = c(17);
28
30
  const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
29
31
  const BaseComponent = t1 === void 0 ? "div" : t1;
30
- const rootRef = useProvidedRefOrCreate(forwardedRef);
32
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
33
+ const rootRef = useRef(null);
34
+ const mergedRef = useMergedRefs(rootRef, forwardedRef);
35
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
36
+ const readRef = mergedRefEnabled ? rootRef : providedOrCreatedRef;
37
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
31
38
  const hoistChildState = (nodes) => {
32
39
  const result = { hasNavigation: false };
33
40
  for (const child of React.Children.toArray(nodes)) {
@@ -54,12 +61,12 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
54
61
  const isInteractive = _temp;
55
62
  let t2;
56
63
  let t3;
57
- if ($[0] !== children || $[1] !== rootRef) {
64
+ if ($[0] !== children || $[1] !== readRef) {
58
65
  t2 = function validateInteractiveElementsInTitle() {
59
66
  let hasContextArea = false;
60
67
  let hasLeadingAction = false;
61
- if (!rootRef.current || rootRef.current.children.length <= 0) return;
62
- const titleArea = Array.from(rootRef.current.children).find(_temp2);
68
+ if (!readRef.current || readRef.current.children.length <= 0) return;
69
+ const titleArea = Array.from(readRef.current.children).find(_temp2);
63
70
  if (!titleArea) return;
64
71
  for (const child_1 of React.Children.toArray(children)) {
65
72
  if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === ContextArea || isSlot(child_1, ContextArea))) hasContextArea = true;
@@ -67,9 +74,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
67
74
  }
68
75
  warning(Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3))) && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
69
76
  };
70
- t3 = [children, rootRef];
77
+ t3 = [children, readRef];
71
78
  $[0] = children;
72
- $[1] = rootRef;
79
+ $[1] = readRef;
73
80
  $[2] = t2;
74
81
  $[3] = t3;
75
82
  } else {
@@ -89,9 +96,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
89
96
  const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
90
97
  const t9 = getNavHiddenDataAttributes(navigationHidden);
91
98
  let t10;
92
- if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
99
+ if ($[6] !== BaseComponent || $[7] !== appliedRef || $[8] !== ariaLabel || $[9] !== children || $[10] !== role || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
93
100
  t10 = /*#__PURE__*/ jsx(BaseComponent, {
94
- ref: rootRef,
101
+ ref: appliedRef,
95
102
  className: t4,
96
103
  "data-component": t5,
97
104
  "data-has-border": t6,
@@ -103,10 +110,10 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
103
110
  children
104
111
  });
105
112
  $[6] = BaseComponent;
106
- $[7] = ariaLabel;
107
- $[8] = children;
108
- $[9] = role;
109
- $[10] = rootRef;
113
+ $[7] = appliedRef;
114
+ $[8] = ariaLabel;
115
+ $[9] = children;
116
+ $[10] = role;
110
117
  $[11] = t4;
111
118
  $[12] = t6;
112
119
  $[13] = t7;
@@ -295,7 +302,9 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
295
302
  const { children, className, hidden: t1, variant: t2 } = t0;
296
303
  const hidden = t1 === void 0 ? false : t1;
297
304
  const variant = t2 === void 0 ? "medium" : t2;
298
- const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
305
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
306
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
307
+ const appliedRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
299
308
  let t3;
300
309
  if ($[0] !== className) {
301
310
  t3 = clsx(PageHeader_module_css_default.TitleArea, className);
@@ -315,20 +324,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
315
324
  $[5] = t5;
316
325
  } else t5 = $[5];
317
326
  let t6;
318
- if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
327
+ if ($[6] !== appliedRef || $[7] !== children || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
319
328
  t6 = /*#__PURE__*/ jsx("div", {
320
329
  className: t3,
321
- ref: titleAreaRef,
330
+ ref: appliedRef,
322
331
  "data-component": "TitleArea",
323
332
  ...t4,
324
333
  ...t5,
325
334
  children
326
335
  });
327
- $[6] = children;
328
- $[7] = t3;
329
- $[8] = t4;
330
- $[9] = t5;
331
- $[10] = titleAreaRef;
336
+ $[6] = appliedRef;
337
+ $[7] = children;
338
+ $[8] = t3;
339
+ $[9] = t4;
340
+ $[10] = t5;
332
341
  $[11] = t6;
333
342
  } else t6 = $[11];
334
343
  return t6;
@@ -2,13 +2,13 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
2
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
3
3
  import { isAlphabetKey } from "../hooks/useMnemonics.js";
4
4
  import { useId as useId$1 } from "../hooks/useId.js";
5
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
6
  import useSafeTimeout from "../hooks/useSafeTimeout.js";
6
7
  import { IconButton } from "../Button/IconButton.js";
7
8
  import { LinkButton } from "../Button/LinkButton.js";
8
9
  import { ButtonComponent } from "../Button/Button.js";
9
10
  import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
10
11
  import Heading from "../Heading/Heading.js";
11
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
12
12
  import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
13
13
  import { Banner } from "../Banner/index.js";
14
14
  import { useFormControlContext } from "../FormControl/_FormControlContext.js";
@@ -1,5 +1,7 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import { AriaStatus } from "../live-region/AriaStatus.js";
4
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
3
5
  import Text_default from "../Text/Text.js";
4
6
  import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
5
7
  import VisuallyHidden from "../_VisuallyHidden.js";
@@ -11,14 +13,19 @@ import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
11
13
  import { getCharacterCountState } from "../utils/character-counter.js";
12
14
  import { clsx } from "clsx";
13
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
- import React, { useCallback, useId, useState } from "react";
16
+ import React, { useCallback, useId, useRef, useState } from "react";
15
17
  import { isValidElementType } from "react-is";
16
18
  import { AlertFillIcon } from "@primer/octicons-react";
17
19
  //#region src/TextInput/TextInput.tsx
18
20
  const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, trailingAction, block, className, contrast, disabled, loading, loaderPosition = "auto", loaderText = "Loading", monospace, validationStatus, size: sizeProp, onFocus, onBlur, variant: variantProp, width: widthProp, minWidth: minWidthProp, maxWidth: maxWidthProp, type = "text", required, characterLimit, onChange, value, defaultValue, "data-component": dataComponent, ...inputProps }, ref) => {
19
21
  var _counter$isOverLimit;
20
22
  const [isInputFocused, setIsInputFocused] = useState(false);
21
- const inputRef = useProvidedRefOrCreate(ref);
23
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
24
+ const inputRef = useRef(null);
25
+ const mergedRef = useMergedRefs(inputRef, ref);
26
+ const providedOrCreatedRef = useProvidedRefOrCreate(ref);
27
+ const readRef = mergedRefEnabled ? inputRef : providedOrCreatedRef;
28
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
22
29
  const isControlled = value !== void 0;
23
30
  const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
24
31
  const currentLength = isControlled ? String(value).length : uncontrolledLength;
@@ -29,9 +36,9 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
29
36
  const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || Boolean(loaderPosition === "auto" && !LeadingVisual));
30
37
  const isSegmentedInputType = type === "date" || type === "time" || type === "datetime-local";
31
38
  const focusInput = (e) => {
32
- if (e.target !== inputRef.current || !isSegmentedInputType) {
33
- var _inputRef$current;
34
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
39
+ if (e.target !== readRef.current || !isSegmentedInputType) {
40
+ var _readRef$current;
41
+ (_readRef$current = readRef.current) === null || _readRef$current === void 0 || _readRef$current.focus();
35
42
  }
36
43
  };
37
44
  const leadingVisualId = useId();
@@ -88,7 +95,7 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
88
95
  children: typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/ jsx(LeadingVisual, {}) : LeadingVisual
89
96
  }),
90
97
  /*#__PURE__*/ jsx(UnstyledTextInput, {
91
- ref: inputRef,
98
+ ref: appliedRef,
92
99
  disabled,
93
100
  onFocus: handleInputFocus,
94
101
  onBlur: handleInputBlur,
@@ -1,7 +1,9 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
3
4
  import { useId as useId$1 } from "../hooks/useId.js";
4
5
  import { warning } from "../utils/warning.js";
6
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
7
  import { invariant } from "../utils/invariant.js";
6
8
  import Tooltip_module_css_default from "./Tooltip.module.css.js";
7
9
  import VisuallyHidden from "../_VisuallyHidden.js";
@@ -80,7 +82,12 @@ const emptyKeybindingHints = [];
80
82
  const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
81
83
  const tooltipId = useId$1(id);
82
84
  const child = Children.only(children);
83
- const triggerRef = useProvidedRefOrCreate(forwardedRef);
85
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
86
+ const triggerRef = useRef(null);
87
+ const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
88
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
89
+ const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
90
+ const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
84
91
  const tooltipElRef = useRef(null);
85
92
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
86
93
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
@@ -88,9 +95,9 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
88
95
  const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
89
96
  const openTooltip = () => {
90
97
  try {
91
- if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
98
+ if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
92
99
  const tooltip = tooltipElRef.current;
93
- const trigger = triggerRef.current;
100
+ const trigger = readTriggerRef.current;
94
101
  tooltip.showPopover();
95
102
  setIsPopoverOpen(true);
96
103
  const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
@@ -112,7 +119,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
112
119
  openTimeoutRef.current = null;
113
120
  }
114
121
  try {
115
- if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
122
+ if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
116
123
  tooltipElRef.current.hidePopover();
117
124
  setIsPopoverOpen(false);
118
125
  } else setIsPopoverOpen(false);
@@ -122,16 +129,16 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
122
129
  };
123
130
  const value = useMemo(() => ({ tooltipId }), [tooltipId]);
124
131
  useEffect(() => {
125
- if (!tooltipElRef.current || !triggerRef.current) return;
126
- const isTriggerInteractive = isInteractive(triggerRef.current);
127
- const triggerChildren = triggerRef.current.childNodes;
132
+ if (!tooltipElRef.current || !readTriggerRef.current) return;
133
+ const isTriggerInteractive = isInteractive(readTriggerRef.current);
134
+ const triggerChildren = readTriggerRef.current.childNodes;
128
135
  const hasInteractiveDescendant = Array.from(triggerChildren).some((child) => {
129
136
  return child instanceof HTMLElement && isInteractive(child) || Array.from(child.childNodes).some((grandChild) => grandChild instanceof HTMLElement && isInteractive(grandChild));
130
137
  });
131
138
  !(isTriggerInteractive || hasInteractiveDescendant) && invariant(false, "The `Tooltip` component expects a single React element that contains interactive content. Consider using a `<button>` or equivalent interactive element instead.");
132
139
  if (type === "label") {
133
- const hasAriaLabel = triggerRef.current.hasAttribute("aria-label");
134
- const hasAriaLabelInChildren = Array.from(triggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
140
+ const hasAriaLabel = readTriggerRef.current.hasAttribute("aria-label");
141
+ const hasAriaLabelInChildren = Array.from(readTriggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
135
142
  warning(hasAriaLabel || hasAriaLabelInChildren, "The label type `Tooltip` is going to be used here to label the trigger element. Please remove the aria-label from the trigger element.");
136
143
  }
137
144
  if (typeof window !== "undefined") {
@@ -140,7 +147,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
140
147
  tooltipElRef.current.setAttribute("popover", "auto");
141
148
  }, [
142
149
  tooltipElRef,
143
- triggerRef,
150
+ readTriggerRef,
144
151
  direction,
145
152
  type
146
153
  ]);
@@ -157,7 +164,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
157
164
  return /*#__PURE__*/ jsx(TooltipContext.Provider, {
158
165
  value,
159
166
  children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
160
- ref: triggerRef,
167
+ ref: appliedTriggerRef,
161
168
  "aria-describedby": (() => {
162
169
  if (type !== "description") return child.props["aria-describedby"];
163
170
  const existingDescribedBy = child.props["aria-describedby"];
@@ -73,7 +73,7 @@ type TabPanelProps = {
73
73
  value: string;
74
74
  };
75
75
  type TabListHookProps<T extends HTMLElement> = TabListProps & {
76
- /** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.RefObject<T>;
76
+ /** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.Ref<T | null>;
77
77
  };
78
78
  type TabListHookResult<T extends HTMLElement> = {
79
79
  /** Props to be spread onto the tablist element */tabListProps: {
@@ -81,7 +81,7 @@ type TabListHookResult<T extends HTMLElement> = {
81
81
  'aria-orientation': AriaAttributes['aria-orientation'];
82
82
  'aria-label': AriaAttributes['aria-label'];
83
83
  'aria-labelledby': AriaAttributes['aria-labelledby'];
84
- ref: React.RefObject<T | null>;
84
+ ref: React.Ref<T | null>;
85
85
  role: 'tablist';
86
86
  };
87
87
  };
@@ -1,14 +1,22 @@
1
+ import { useMergedRefs } from "../../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
3
+ import { useFeatureFlag } from "../../FeatureFlags/useFeatureFlag.js";
2
4
  import { c } from "react-compiler-runtime";
5
+ import { useRef } from "react";
3
6
  //#region src/experimental/Tabs/useTabList.ts
4
7
  function useTabList(props) {
5
8
  const $ = c(9);
6
9
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
7
- const ref = useProvidedRefOrCreate(props.ref);
10
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
11
+ const tabListRef = useRef(null);
12
+ const mergedRef = useMergedRefs(tabListRef, props.ref);
13
+ const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
14
+ const readRef = mergedRefEnabled ? tabListRef : providedOrCreatedRef;
15
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
8
16
  let t0;
9
- if ($[0] !== ariaOrientation || $[1] !== ref) {
17
+ if ($[0] !== ariaOrientation || $[1] !== readRef) {
10
18
  t0 = (event) => {
11
- const { current: tablist } = ref;
19
+ const { current: tablist } = readRef;
12
20
  if (tablist === null) return;
13
21
  const tabs = getFocusableTabs(tablist);
14
22
  const isVertical = ariaOrientation === "vertical";
@@ -33,25 +41,25 @@ function useTabList(props) {
33
41
  }
34
42
  };
35
43
  $[0] = ariaOrientation;
36
- $[1] = ref;
44
+ $[1] = readRef;
37
45
  $[2] = t0;
38
46
  } else t0 = $[2];
39
47
  const onKeyDown = t0;
40
48
  const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
41
49
  let t2;
42
- if ($[3] !== ariaLabel || $[4] !== ariaLabelledby || $[5] !== onKeyDown || $[6] !== ref || $[7] !== t1) {
50
+ if ($[3] !== appliedRef || $[4] !== ariaLabel || $[5] !== ariaLabelledby || $[6] !== onKeyDown || $[7] !== t1) {
43
51
  t2 = { tabListProps: {
44
- ref,
52
+ ref: appliedRef,
45
53
  "aria-label": ariaLabel,
46
54
  "aria-labelledby": ariaLabelledby,
47
55
  "aria-orientation": t1,
48
56
  role: "tablist",
49
57
  onKeyDown
50
58
  } };
51
- $[3] = ariaLabel;
52
- $[4] = ariaLabelledby;
53
- $[5] = onKeyDown;
54
- $[6] = ref;
59
+ $[3] = appliedRef;
60
+ $[4] = ariaLabel;
61
+ $[5] = ariaLabelledby;
62
+ $[6] = onKeyDown;
55
63
  $[7] = t1;
56
64
  $[8] = t2;
57
65
  } else t2 = $[8];
@@ -4,15 +4,15 @@ import { Announce } from "../live-region/Announce.js";
4
4
  import { AriaAlert } from "../live-region/AriaAlert.js";
5
5
  import { AriaStatus } from "../live-region/AriaStatus.js";
6
6
  import { ButtonBase } from "../Button/ButtonBase.js";
7
+ import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
8
+ import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
9
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
10
  import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
8
11
  import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
9
12
  import { Tooltip } from "../TooltipV2/Tooltip.js";
10
13
  import { useOverflow } from "../hooks/useOverflow.js";
11
14
  import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
12
15
  import { Dialog } from "../Dialog/Dialog.js";
13
- import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
14
- import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
15
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
16
16
  import { Stack } from "../Stack/index.js";
17
17
  import { SkeletonBox } from "../Skeleton/SkeletonBox.js";
18
18
  import { FilteredActionListLoadingTypes } from "../FilteredActionList/constants.js";
@@ -17,18 +17,18 @@ import { ForwardedRef, Ref } from "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
  declare function useMergedRefs<T>(refA: Ref$1<T | null>, refB: Ref$1<T | null>): (value: T | null) => (() => void) | undefined;
@@ -1,7 +1,9 @@
1
1
  import { isExperimentalReactVersion, reactMajorVersion } from "../utils/environment.js";
2
2
  import { c } from "react-compiler-runtime";
3
- import "react";
3
+ import { version } from "react";
4
4
  //#region src/hooks/useMergedRefs.ts
5
+ var _version$split$;
6
+ const majorReactVersion = parseInt((_version$split$ = version.split(".")[0]) !== null && _version$split$ !== void 0 ? _version$split$ : "18", 10);
5
7
  /**
6
8
  * Cleanup functions for refs were introduced in React 19. For feature detection,
7
9
  * we look to see if current version of React is >= 19 or if it is an
@@ -26,18 +28,18 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
26
28
  * // React 18
27
29
  * const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
28
30
  * const ref = useRef<HTMLButtonElement>(null)
29
- * const combinedRef = useMergedRefs(forwardedRef, ref)
31
+ * const mergedRef = useMergedRefs(forwardedRef, ref)
30
32
  *
31
- * return <button ref={combinedRef} />
33
+ * return <button ref={mergedRef} />
32
34
  * })
33
35
  *
34
36
  * @example
35
37
  * // React 19
36
38
  * const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
37
39
  * const ref = useRef<HTMLButtonElement>(null)
38
- * const combinedRef = useMergedRefs(externalRef, ref)
40
+ * const mergedRef = useMergedRefs(externalRef, ref)
39
41
  *
40
- * return <button ref={combinedRef} />
42
+ * return <button ref={mergedRef} />
41
43
  * }
42
44
  */
43
45
  function useMergedRefs(refA, refB) {
@@ -48,6 +50,7 @@ function useMergedRefs(refA, refB) {
48
50
  const cleanupA = setRef(refA, value);
49
51
  const cleanupB = setRef(refB, value);
50
52
  if (!supportsRefCleanup) return;
53
+ if (majorReactVersion <= 18) return;
51
54
  return () => {
52
55
  if (cleanupA) cleanupA();
53
56
  else setRef(refA, null);
@@ -9,17 +9,14 @@ import React from "react";
9
9
  * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
10
10
  * @type TRef The type of the RefObject which should be created.
11
11
  *
12
- * @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
13
- * created ref instead.
12
+ * @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
13
+ * In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
14
+ * {@linkcode useMergedRefs} instead.
14
15
  *
15
- * ```diff
16
- * - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
17
- * + const ref = useRef(null)
18
- * + const mergedRef = useMergedRefs(forwardedRef, ref)
19
- *
20
- * - return <div ref={ref} />
21
- * + return <div ref={mergedRef} />
22
- * ```
16
+ * The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
17
+ * element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
18
+ * consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
19
+ * internal element.
23
20
  */
24
21
  declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
25
22
  //#endregion
@@ -8,17 +8,14 @@ import React from "react";
8
8
  * @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
9
9
  * @type TRef The type of the RefObject which should be created.
10
10
  *
11
- * @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
12
- * created ref instead.
11
+ * @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
12
+ * In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
13
+ * {@linkcode useMergedRefs} instead.
13
14
  *
14
- * ```diff
15
- * - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
16
- * + const ref = useRef(null)
17
- * + const mergedRef = useMergedRefs(forwardedRef, ref)
18
- *
19
- * - return <div ref={ref} />
20
- * + return <div ref={mergedRef} />
21
- * ```
15
+ * The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
16
+ * element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
17
+ * consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
18
+ * internal element.
22
19
  */
23
20
  function useProvidedRefOrCreate(providedRef) {
24
21
  const createdRef = React.useRef(null);
@@ -5060,7 +5060,7 @@
5060
5060
  },
5061
5061
  {
5062
5062
  "id": "components-pagelayout-features--pull-request-page",
5063
- "code": "() => (\n <PageLayout>\n <PageLayout.Header>\n <div className={classes.HeaderStack}>\n <div>\n <Heading as=\"h1\" className={classes.TitleHeading}>\n Input validation styles{' '}\n <Text className={classes.TitleSubdued}>#1831</Text>\n </Heading>\n <div className={classes.StatusRow}>\n <StateLabel status=\"pullOpened\">Open</StateLabel>\n <Text className={classes.StatusMeta}>\n <Link href=\"#\" muted className={classes.BoldMetaLink}>\n mperrotti\n </Link>{' '}\n wants to merge 3 commits into{' '}\n <BranchName href=\"#\">main</BranchName> from{' '}\n <BranchName href=\"#\">mp/validation-styles</BranchName>\n </Text>\n </div>\n </div>\n <TabNav>\n <TabNav.Link href=\"#\" selected>\n Conversation\n </TabNav.Link>\n <TabNav.Link href=\"#\">Commits</TabNav.Link>\n <TabNav.Link href=\"#\">Checks</TabNav.Link>\n <TabNav.Link href=\"#\">Files changed</TabNav.Link>\n </TabNav>\n </div>\n </PageLayout.Header>\n <PageLayout.Content>\n <div className={classes.ContentBox}></div>\n <div className={classes.ScrollBox} tabIndex={0}>\n This box has really long content. If it is too long, it will cause x\n overflow and should show a scrollbar. When this overflows, it should not\n break to overall page layout!\n </div>\n </PageLayout.Content>\n <PageLayout.Pane aria-label=\"Side pane\">\n <div className={classes.PaneStack}>\n <div>\n <Text className={classes.PaneSectionHeading}>Assignees</Text>\n <Text className={classes.PaneMetaText}>\n No one –{' '}\n <Link href=\"#\" muted>\n assign yourself\n </Link>\n </Text>\n </div>\n <div role=\"separator\" className={classes.PaneSeparator}></div>\n <div>\n <Text className={classes.PaneSectionHeading}>Labels</Text>\n <Text className={classes.PaneMetaText}>None yet</Text>\n </div>\n </div>\n </PageLayout.Pane>\n </PageLayout>\n)"
5063
+ "code": "() => (\n <PageLayout>\n <PageLayout.Header>\n <div className={classes.HeaderStack}>\n <div>\n <Heading as=\"h1\" className={classes.TitleHeading}>\n Input validation styles{' '}\n <Text className={classes.TitleSubdued}>#1831</Text>\n </Heading>\n <div className={classes.StatusRow}>\n <StateLabel status=\"pullOpened\">Open</StateLabel>\n <Text className={classes.StatusMeta}>\n <Link href=\"#\" muted className={classes.BoldMetaLink}>\n mperrotti\n </Link>{' '}\n wants to merge 3 commits into{' '}\n <BranchName href=\"#\">main</BranchName> from{' '}\n <BranchName href=\"#\">mp/validation-styles</BranchName>\n </Text>\n </div>\n </div>\n <TabNav>\n <TabNav.Link href=\"#\" selected>\n Conversation\n </TabNav.Link>\n <TabNav.Link href=\"#\">Commits</TabNav.Link>\n <TabNav.Link href=\"#\">Checks</TabNav.Link>\n <TabNav.Link href=\"#\">Files changed</TabNav.Link>\n </TabNav>\n </div>\n </PageLayout.Header>\n <PageLayout.Content>\n <div className={classes.ContentBox}></div>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div className={classes.ScrollBox} tabIndex={0}>\n This box has really long content. If it is too long, it will cause x\n overflow and should show a scrollbar. When this overflows, it should not\n break to overall page layout!\n </div>\n </PageLayout.Content>\n <PageLayout.Pane aria-label=\"Side pane\">\n <div className={classes.PaneStack}>\n <div>\n <Text className={classes.PaneSectionHeading}>Assignees</Text>\n <Text className={classes.PaneMetaText}>\n No one –{' '}\n <Link href=\"#\" muted>\n assign yourself\n </Link>\n </Text>\n </div>\n <div role=\"separator\" className={classes.PaneSeparator}></div>\n <div>\n <Text className={classes.PaneSectionHeading}>Labels</Text>\n <Text className={classes.PaneMetaText}>None yet</Text>\n </div>\n </div>\n </PageLayout.Pane>\n </PageLayout>\n)"
5064
5064
  },
5065
5065
  {
5066
5066
  "id": "components-pagelayout-features--sticky-pane",
@@ -5068,7 +5068,7 @@
5068
5068
  },
5069
5069
  {
5070
5070
  "id": "components-pagelayout-features--nested-scroll-container",
5071
- "code": "(args) => (\n <div className={classes.NestedScrollContainer}>\n <Placeholder label=\"Above scroll container\" height={120} />\n <div className={classes.OverflowAuto}>\n <PageLayout\n rowGap=\"none\"\n columnGap=\"none\"\n padding=\"none\"\n containerWidth=\"full\"\n >\n <PageLayout.Header padding=\"normal\" divider=\"line\">\n <Placeholder label=\"Header\" height={64} />\n </PageLayout.Header>\n <PageLayout.Content padding=\"normal\" width=\"large\">\n <div\n className={classes.ContentGrid}\n tabIndex={0}\n role=\"region\"\n aria-label=\"Page content\"\n >\n {Array.from({\n length: args.numParagraphsInContent,\n }).map((_, i) => (\n <p key={i} className={classes.Paragraph}>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at\n enim id lorem tempus egestas a non ipsum. Maecenas imperdiet\n ante quam, at varius lorem molestie vel. Sed at eros consequat,\n varius tellus et, auctor felis. Donec pulvinar lacinia urna nec\n commodo. Phasellus at imperdiet risus. Donec sit amet massa\n purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus\n felis. Ut porttitor auctor tellus in imperdiet. Ut blandit\n tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum\n auctor euismod nisi. Nullam tincidunt est in mi tincidunt\n dictum. Sed consectetur aliquet velit ut ornare.\n </p>\n ))}\n </div>\n </PageLayout.Content>\n <PageLayout.Pane\n position=\"start\"\n padding=\"normal\"\n divider=\"line\"\n sticky\n aria-label=\"Side pane\"\n >\n <div className={classes.ContentGrid}>\n {Array.from({\n length: args.numParagraphsInPane,\n }).map((_, i) => (\n <p key={i} className={classes.Paragraph}>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at\n enim id lorem tempus egestas a non ipsum. Maecenas imperdiet\n ante quam, at varius lorem molestie vel. Sed at eros consequat,\n varius tellus et, auctor felis. Donec pulvinar lacinia urna nec\n commodo. Phasellus at imperdiet risus. Donec sit amet massa\n purus.\n </p>\n ))}\n </div>\n </PageLayout.Pane>\n <PageLayout.Footer padding=\"normal\" divider=\"line\">\n <Placeholder label=\"Footer\" height={64} />\n </PageLayout.Footer>\n </PageLayout>\n </div>\n <Placeholder label=\"Below scroll container\" height={120} />\n </div>\n)"
5071
+ "code": "(args) => (\n <div className={classes.NestedScrollContainer}>\n <Placeholder label=\"Above scroll container\" height={120} />\n <div className={classes.OverflowAuto}>\n <PageLayout\n rowGap=\"none\"\n columnGap=\"none\"\n padding=\"none\"\n containerWidth=\"full\"\n >\n <PageLayout.Header padding=\"normal\" divider=\"line\">\n <Placeholder label=\"Header\" height={64} />\n </PageLayout.Header>\n <PageLayout.Content padding=\"normal\" width=\"large\">\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div\n className={classes.ContentGrid}\n tabIndex={0}\n role=\"region\"\n aria-label=\"Page content\"\n >\n {Array.from({\n length: args.numParagraphsInContent,\n }).map((_, i) => (\n <p key={i} className={classes.Paragraph}>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at\n enim id lorem tempus egestas a non ipsum. Maecenas imperdiet\n ante quam, at varius lorem molestie vel. Sed at eros consequat,\n varius tellus et, auctor felis. Donec pulvinar lacinia urna nec\n commodo. Phasellus at imperdiet risus. Donec sit amet massa\n purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus\n felis. Ut porttitor auctor tellus in imperdiet. Ut blandit\n tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum\n auctor euismod nisi. Nullam tincidunt est in mi tincidunt\n dictum. Sed consectetur aliquet velit ut ornare.\n </p>\n ))}\n </div>\n </PageLayout.Content>\n <PageLayout.Pane\n position=\"start\"\n padding=\"normal\"\n divider=\"line\"\n sticky\n aria-label=\"Side pane\"\n >\n <div className={classes.ContentGrid}>\n {Array.from({\n length: args.numParagraphsInPane,\n }).map((_, i) => (\n <p key={i} className={classes.Paragraph}>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at\n enim id lorem tempus egestas a non ipsum. Maecenas imperdiet\n ante quam, at varius lorem molestie vel. Sed at eros consequat,\n varius tellus et, auctor felis. Donec pulvinar lacinia urna nec\n commodo. Phasellus at imperdiet risus. Donec sit amet massa\n purus.\n </p>\n ))}\n </div>\n </PageLayout.Pane>\n <PageLayout.Footer padding=\"normal\" divider=\"line\">\n <Placeholder label=\"Footer\" height={64} />\n </PageLayout.Footer>\n </PageLayout>\n </div>\n <Placeholder label=\"Below scroll container\" height={120} />\n </div>\n)"
5072
5072
  },
5073
5073
  {
5074
5074
  "id": "components-pagelayout-features--custom-sticky-header",
@@ -5080,7 +5080,7 @@
5080
5080
  },
5081
5081
  {
5082
5082
  "id": "components-pagelayout-features--scroll-container-within-page-layout-pane",
5083
- "code": "() => (\n <div className={classes.NestedScrollContainer}>\n <div className={classes.OverflowAuto}>\n <Placeholder label=\"Above inner scroll container\" height={120} />\n <PageLayout\n rowGap=\"none\"\n columnGap=\"none\"\n padding=\"none\"\n containerWidth=\"full\"\n >\n <PageLayout.Pane\n position=\"start\"\n padding=\"normal\"\n divider=\"line\"\n sticky\n aria-label=\"Sticky pane\"\n >\n <div className={classes.OverflowAuto}>\n <PageLayout.Pane padding=\"normal\" aria-label=\"Side pane\">\n <Placeholder label=\"Inner scroll container\" height={800} />\n </PageLayout.Pane>\n </div>\n </PageLayout.Pane>\n <PageLayout.Content padding=\"normal\" width=\"large\">\n <div\n className={classes.ContentGrid}\n tabIndex={0}\n role=\"region\"\n aria-label=\"Page content\"\n >\n <Placeholder label=\"Page content\" height={1600} />\n </div>\n </PageLayout.Content>\n </PageLayout>\n <Placeholder label=\"Beneath inner scroll container\" height={120} />\n </div>\n </div>\n)"
5083
+ "code": "() => (\n <div className={classes.NestedScrollContainer}>\n <div className={classes.OverflowAuto}>\n <Placeholder label=\"Above inner scroll container\" height={120} />\n <PageLayout\n rowGap=\"none\"\n columnGap=\"none\"\n padding=\"none\"\n containerWidth=\"full\"\n >\n <PageLayout.Pane\n position=\"start\"\n padding=\"normal\"\n divider=\"line\"\n sticky\n aria-label=\"Sticky pane\"\n >\n <div className={classes.OverflowAuto}>\n <PageLayout.Pane padding=\"normal\" aria-label=\"Side pane\">\n <Placeholder label=\"Inner scroll container\" height={800} />\n </PageLayout.Pane>\n </div>\n </PageLayout.Pane>\n <PageLayout.Content padding=\"normal\" width=\"large\">\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div\n className={classes.ContentGrid}\n tabIndex={0}\n role=\"region\"\n aria-label=\"Page content\"\n >\n <Placeholder label=\"Page content\" height={1600} />\n </div>\n </PageLayout.Content>\n </PageLayout>\n <Placeholder label=\"Beneath inner scroll container\" height={120} />\n </div>\n </div>\n)"
5084
5084
  },
5085
5085
  {
5086
5086
  "id": "components-pagelayout-features--custom-pane-widths",
@@ -8185,11 +8185,11 @@
8185
8185
  },
8186
8186
  {
8187
8187
  "id": "components-timeline-features--with-actions",
8188
- "code": "() => (\n <div\n className={classes.RealisticTimeline}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('a')) e.preventDefault()\n }}\n >\n <Timeline>\n <Timeline.Item>\n <Timeline.Badge variant=\"done\">\n <Octicon icon={GitMergeIcon} aria-label=\"Merged\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n merged via the queue into <BranchName href=\"#\">main</BranchName> with\n commit{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 01e49tb\n </Link>{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n just now\n </Link>\n <div className={classes.ChecksSubline}>28 checks passed</div>\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">View details</Button>\n <Button size=\"small\">Revert</Button>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item>\n <Timeline.Badge>\n <Octicon icon={RepoPushIcon} aria-label=\"Force-push\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n force-pushed the <BranchName href=\"#\">main</BranchName> branch from{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 01e49tb\n </Link>{' '}\n to{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 02f50uc\n </Link>{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n 2 hours ago\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">Compare</Button>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item condensed>\n <Timeline.Badge>\n <Octicon icon={GitCommitIcon} aria-label=\"Commit\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" muted>\n Update README.md\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Label\n className={`${classes.SignatureLabelVerified} ${classes.HideAtNarrow}`}\n >\n Verified\n </Label>\n <Octicon\n icon={CheckIcon}\n className={classes.IconSuccess}\n aria-label=\"All checks passed\"\n />\n <Link href=\"#\" className={classes.ShaLink} muted>\n 3fbdc0\n </Link>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item condensed>\n <Timeline.Badge>\n <Octicon icon={GitCommitIcon} aria-label=\"Commit\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" muted>\n Initial commit\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Label className={classes.HideAtNarrow}>Unverified</Label>\n <Octicon\n icon={XIcon}\n className={classes.IconDanger}\n aria-label=\"Some checks failed\"\n />\n <Link href=\"#\" className={classes.ShaLink} muted>\n 3fbdc0\n </Link>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item>\n <Timeline.Badge>\n <Octicon icon={CrossReferenceIcon} aria-label=\"Cross-reference\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Avatar\n src=\"https://avatars.githubusercontent.com/u/92997159?v=4\"\n size={20}\n className={classes.InlineAvatar}\n />\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n mentioned this pull request{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n just now\n </Link>\n <div className={classes.CrossReferenceRow}>\n <div className={classes.CrossReferenceTitle}>\n <Link href=\"#\" className={classes.CrossReferenceLink}>\n <span className={classes.CrossReferenceName}>\n Fix positioning of Autocomplete overlay menu\n </span>{' '}\n <span className={classes.CrossReferenceNumber}>\n primer/react#7431\n </span>\n </Link>\n </div>\n <Octicon\n icon={LockIcon}\n size={16}\n className={classes.CrossReferenceMeta}\n aria-label=\"Private\"\n />\n <StateLabel status=\"pullOpened\" size=\"small\">\n Open\n </StateLabel>\n </div>\n <div className={classes.CrossReferenceTaskline}>\n <Octicon icon={TasklistIcon} size={16} />\n 17 tasks\n </div>\n </Timeline.Body>\n </Timeline.Item>\n </Timeline>\n </div>\n)"
8188
+ "code": "() => (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <div\n className={classes.RealisticTimeline}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('a')) e.preventDefault()\n }}\n >\n <Timeline>\n <Timeline.Item>\n <Timeline.Badge variant=\"done\">\n <Octicon icon={GitMergeIcon} aria-label=\"Merged\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n merged via the queue into <BranchName href=\"#\">main</BranchName> with\n commit{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 01e49tb\n </Link>{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n just now\n </Link>\n <div className={classes.ChecksSubline}>28 checks passed</div>\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">View details</Button>\n <Button size=\"small\">Revert</Button>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item>\n <Timeline.Badge>\n <Octicon icon={RepoPushIcon} aria-label=\"Force-push\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n force-pushed the <BranchName href=\"#\">main</BranchName> branch from{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 01e49tb\n </Link>{' '}\n to{' '}\n <Link href=\"#\" className={classes.CommitSha}>\n 02f50uc\n </Link>{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n 2 hours ago\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">Compare</Button>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item condensed>\n <Timeline.Badge>\n <Octicon icon={GitCommitIcon} aria-label=\"Commit\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" muted>\n Update README.md\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Label\n className={`${classes.SignatureLabelVerified} ${classes.HideAtNarrow}`}\n >\n Verified\n </Label>\n <Octicon\n icon={CheckIcon}\n className={classes.IconSuccess}\n aria-label=\"All checks passed\"\n />\n <Link href=\"#\" className={classes.ShaLink} muted>\n 3fbdc0\n </Link>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item condensed>\n <Timeline.Badge>\n <Octicon icon={GitCommitIcon} aria-label=\"Commit\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" muted>\n Initial commit\n </Link>\n </Timeline.Body>\n <Timeline.Actions>\n <Label className={classes.HideAtNarrow}>Unverified</Label>\n <Octicon\n icon={XIcon}\n className={classes.IconDanger}\n aria-label=\"Some checks failed\"\n />\n <Link href=\"#\" className={classes.ShaLink} muted>\n 3fbdc0\n </Link>\n </Timeline.Actions>\n </Timeline.Item>\n <Timeline.Item>\n <Timeline.Badge>\n <Octicon icon={CrossReferenceIcon} aria-label=\"Cross-reference\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Avatar\n src=\"https://avatars.githubusercontent.com/u/92997159?v=4\"\n size={20}\n className={classes.InlineAvatar}\n />\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n Monalisa\n </Link>\n mentioned this pull request{' '}\n <Link href=\"#\" className={classes.Timestamp} muted>\n just now\n </Link>\n <div className={classes.CrossReferenceRow}>\n <div className={classes.CrossReferenceTitle}>\n <Link href=\"#\" className={classes.CrossReferenceLink}>\n <span className={classes.CrossReferenceName}>\n Fix positioning of Autocomplete overlay menu\n </span>{' '}\n <span className={classes.CrossReferenceNumber}>\n primer/react#7431\n </span>\n </Link>\n </div>\n <Octicon\n icon={LockIcon}\n size={16}\n className={classes.CrossReferenceMeta}\n aria-label=\"Private\"\n />\n <StateLabel status=\"pullOpened\" size=\"small\">\n Open\n </StateLabel>\n </div>\n <div className={classes.CrossReferenceTaskline}>\n <Octicon icon={TasklistIcon} size={16} />\n 17 tasks\n </div>\n </Timeline.Body>\n </Timeline.Item>\n </Timeline>\n </div>\n)"
8189
8189
  },
8190
8190
  {
8191
8191
  "id": "components-timeline-features--with-avatar",
8192
- "code": "() => (\n <div\n className={`${classes.RealisticTimeline} ${classes.AvatarGutter}`}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('a')) e.preventDefault()\n }}\n >\n <Timeline>\n <Timeline.Item>\n <Timeline.Avatar>\n <Avatar\n size={40}\n src=\"https://avatars.githubusercontent.com/u/92997159?v=4\"\n alt=\"\"\n />\n </Timeline.Avatar>\n <Timeline.Badge variant=\"done\">\n <Octicon icon={CheckIcon} aria-label=\"Approved\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n monalisa\n </Link>\n {'approved these changes '}\n <RelativeTime date={new Date()} format=\"relative\" />\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">View reviewed changes</Button>\n </Timeline.Actions>\n </Timeline.Item>\n </Timeline>\n </div>\n)"
8192
+ "code": "() => (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <div\n className={`${classes.RealisticTimeline} ${classes.AvatarGutter}`}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('a')) e.preventDefault()\n }}\n >\n <Timeline>\n <Timeline.Item>\n <Timeline.Avatar>\n <Avatar\n size={40}\n src=\"https://avatars.githubusercontent.com/u/92997159?v=4\"\n alt=\"\"\n />\n </Timeline.Avatar>\n <Timeline.Badge variant=\"done\">\n <Octicon icon={CheckIcon} aria-label=\"Approved\" />\n </Timeline.Badge>\n <Timeline.Body>\n <Link href=\"#\" className={classes.LinkWithBoldStyle} muted>\n monalisa\n </Link>\n {'approved these changes '}\n <RelativeTime date={new Date()} format=\"relative\" />\n </Timeline.Body>\n <Timeline.Actions>\n <Button size=\"small\">View reviewed changes</Button>\n </Timeline.Actions>\n </Timeline.Item>\n </Timeline>\n </div>\n)"
8193
8193
  }
8194
8194
  ],
8195
8195
  "importPath": "@primer/react",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.34.0-rc.ac0faffd6",
4
+ "version": "38.34.0-rc.d17f87af7",
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",