@primer/react 0.0.0-20261113153150 → 0.0.0-20261113163104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20261113153150
3
+ ## 0.0.0-20261113163104
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - [#8592](https://github.com/primer/react/pull/8592) [`0ae18d3`](https://github.com/primer/react/commit/0ae18d38f09044c40c1a181288c2783e93629b4e) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add optional shadows, regular (16px) and spacious (24px) padding in either layout, and heading links and buttons with opt-in full-card hit areas using fullCardHitArea. Existing normal padding and defaults are unchanged.
8
8
 
9
+ - [#8749](https://github.com/primer/react/pull/8749) [`ba03cb6`](https://github.com/primer/react/commit/ba03cb6524b86b59b997896b31ca7bcd7b8465fb) Thanks [@adierkens](https://github.com/adierkens)! - Tooltip, ActionMenu: Add custom trigger rendering to compose multiple behaviors on a single interactive element. AnchoredOverlay and SelectPanel expose the anchor ref in the render callback's second argument.
10
+
9
11
  - [#8692](https://github.com/primer/react/pull/8692) [`918d7cf`](https://github.com/primer/react/commit/918d7cf82d3884ab134e9b074e0a595198a1c033) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Stack: Add `balance` as a value for the `wrap` prop.
10
12
 
11
13
  ### Patch Changes
12
14
 
13
- - [#8748](https://github.com/primer/react/pull/8748) [`a3d58eb`](https://github.com/primer/react/commit/a3d58ebf31ce2c36c3ae5d16899bea6da2d7bbcc) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Breadcrumbs: Collapse crumbs that render more than one element (such as a link with a sibling button) when they no longer fit, instead of overflowing the container.
14
-
15
15
  - [#8683](https://github.com/primer/react/pull/8683) [`32d5061`](https://github.com/primer/react/commit/32d50618c58cceddf66d83716ac9742c2134b790) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Breadcrumbs: Improve the performance of `overflow="menu"` and `"menu-with-root"` on mount, resize and navigation. Server-rendered markup now applies the collapse rules before hydration, and the overflow menu trigger is a `<button>`.
16
16
 
17
17
  - [#8592](https://github.com/primer/react/pull/8592) [`0ae18d3`](https://github.com/primer/react/commit/0ae18d38f09044c40c1a181288c2783e93629b4e) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Improve shrinking and equal-height layouts, keep secondary controls accessible in custom whole-card compositions, and keep images edge-to-edge across padding options.
@@ -9,6 +9,11 @@ import { AnchorPosition } from "@primer/behaviors";
9
9
 
10
10
  //#region src/ActionMenu/ActionMenu.d.ts
11
11
  type ActionMenuProps = {
12
+ /**
13
+ * Render a custom trigger instead of ActionMenu.Button or ActionMenu.Anchor.
14
+ * Forward all supplied props, including ref, to a single interactive element.
15
+ */
16
+ renderAnchor?: (props: ActionMenuAnchorRenderProps) => React.ReactElement;
12
17
  /**
13
18
  * Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
14
19
  */
@@ -22,6 +27,9 @@ type ActionMenuProps = {
22
27
  */
23
28
  onOpenChange?: (s: boolean) => void;
24
29
  } & Pick<AnchoredOverlayProps, 'anchorRef'>;
30
+ type ActionMenuAnchorRenderProps = Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'aria-labelledby'> & {
31
+ ref: React.RefCallback<HTMLElement>;
32
+ };
25
33
  type ActionMenuAnchorProps = {
26
34
  children: React.ReactElement<any>;
27
35
  id?: string;
@@ -49,4 +57,4 @@ declare const ActionMenu: React.FC<React.PropsWithChildren<ActionMenuProps>> & S
49
57
  Divider: FCWithSlotMarker<React.PropsWithChildren<ActionListDividerProps>>;
50
58
  };
51
59
  //#endregion
52
- export { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps };
60
+ export { ActionMenu, ActionMenuAnchorProps, ActionMenuAnchorRenderProps, ActionMenuButtonProps, ActionMenuProps };
@@ -1,3 +1,4 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
4
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
@@ -44,7 +45,7 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
44
45
  if (buttonProps.className) mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
45
46
  return mergedAnchorProps;
46
47
  };
47
- const Menu = ({ anchorRef: externalAnchorRef, open, onOpenChange, children }) => {
48
+ const Menu = ({ anchorRef: externalAnchorRef, open, onOpenChange, children, renderAnchor: customRenderAnchor }) => {
48
49
  const parentMenuContext = useContext(MenuContext);
49
50
  const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate(open, onOpenChange, false);
50
51
  const onOpen = React.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
@@ -66,9 +67,14 @@ const Menu = ({ anchorRef: externalAnchorRef, open, onOpenChange, children }) =>
66
67
  const menuButtonChild = React.Children.toArray(children).find((child) => /*#__PURE__*/ React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton)));
67
68
  const menuButtonChildId = /*#__PURE__*/ React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : void 0;
68
69
  const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
70
+ const callbackAnchorRef = useMergedRefs(anchorRef, void 0);
69
71
  const anchorId = useId$1(menuButtonChildId);
70
- let renderAnchor = null;
72
+ let renderAnchor = useMemo(() => customRenderAnchor ? (props) => customRenderAnchor({
73
+ ...props,
74
+ ref: callbackAnchorRef
75
+ }) : null, [customRenderAnchor, callbackAnchorRef]);
71
76
  const contents = React.Children.map(children, (child) => {
77
+ if (customRenderAnchor) return child;
72
78
  if (child.type === Tooltip || isSlot(child, Tooltip)) {
73
79
  const anchorChildren = child.props.children;
74
80
  if (anchorChildren.type === MenuButton || isSlot(anchorChildren, MenuButton)) renderAnchor = (anchorProps) => {
@@ -1,2 +1,2 @@
1
- import { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu.js";
2
- export { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps };
1
+ import { ActionMenu, ActionMenuAnchorProps, ActionMenuAnchorRenderProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu.js";
2
+ export { ActionMenu, ActionMenuAnchorProps, ActionMenuAnchorRenderProps, ActionMenuButtonProps, ActionMenuProps };
@@ -7,12 +7,18 @@ import React, { JSX } from "react";
7
7
  import { AnchorPosition, PositionSettings } from "@primer/behaviors";
8
8
 
9
9
  //#region src/AnchoredOverlay/AnchoredOverlay.d.ts
10
+ type AnchoredOverlayAnchorContext = {
11
+ ref: {
12
+ readonly current: HTMLElement | null;
13
+ };
14
+ };
10
15
  interface AnchoredOverlayPropsWithAnchor {
11
16
  /**
12
17
  * A custom function component used to render the anchor element.
13
18
  * Will receive the selected text as `children` prop when an item is activated.
19
+ * The second argument exposes the anchor's object ref for composing behaviors.
14
20
  */
15
- renderAnchor: <T extends Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'aria-labelledby'>>(props: T) => JSX.Element;
21
+ renderAnchor: <T extends Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'aria-labelledby'>>(props: T, context?: AnchoredOverlayAnchorContext) => JSX.Element;
16
22
  /**
17
23
  * An override to the internal ref that will be spread on to the renderAnchor
18
24
  */
@@ -125,4 +131,4 @@ type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWith
125
131
  */
126
132
  declare const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayProps>>;
127
133
  //#endregion
128
- export { AnchoredOverlay, AnchoredOverlayProps, AnchoredOverlayWrapperAnchorProps };
134
+ export { AnchoredOverlay, AnchoredOverlayAnchorContext, AnchoredOverlayProps, AnchoredOverlayWrapperAnchorProps };
@@ -173,7 +173,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
173
173
  onClick: onAnchorClick,
174
174
  onKeyDown: onAnchorKeyDown,
175
175
  ...popoverTargetProps
176
- }), open ? /* @__PURE__ */ jsxs(Overlay, {
176
+ }, { ref: anchorRef }), open ? /* @__PURE__ */ jsxs(Overlay, {
177
177
  returnFocusRef: anchorRef,
178
178
  onClickOutside,
179
179
  ignoreClickRefs: [anchorRef],
@@ -1,2 +1,2 @@
1
- import { AnchoredOverlay, AnchoredOverlayProps } from "./AnchoredOverlay.js";
2
- export { AnchoredOverlay, type AnchoredOverlayProps };
1
+ import { AnchoredOverlay, AnchoredOverlayAnchorContext, AnchoredOverlayProps } from "./AnchoredOverlay.js";
2
+ export { AnchoredOverlay, type AnchoredOverlayAnchorContext, type AnchoredOverlayProps };
@@ -61,12 +61,6 @@ function getContentWidth(nav) {
61
61
  const { paddingLeft, paddingRight } = getComputedStyle(nav);
62
62
  return nav.clientWidth - parseFloat(paddingLeft) - parseFloat(paddingRight);
63
63
  }
64
- function getCrumbWidth(li, range) {
65
- range.selectNodeContents(li);
66
- const last = li.lastElementChild;
67
- if (last !== null && last !== void 0 && last.classList.contains(Breadcrumbs_module_css_default.ItemSeparator)) range.setEndBefore(last);
68
- return range.getBoundingClientRect().width;
69
- }
70
64
  const sameFit = (a, b) => a.extra === b.extra && a.rootCollapsed === b.rootCollapsed && a.narrow === b.narrow;
71
65
  function getValidChildren(children) {
72
66
  return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
@@ -251,7 +245,6 @@ function Breadcrumbs(t0) {
251
245
  const previous = widthsRef.current;
252
246
  const widths_0 = /* @__PURE__ */ new Map();
253
247
  let separators = separatorsRef.current;
254
- const range = nav.ownerDocument.createRange();
255
248
  for (const item_0 of items) {
256
249
  var _item_0$key;
257
250
  const width = previous.get((_item_0$key = item_0.key) !== null && _item_0$key !== void 0 ? _item_0$key : "");
@@ -263,8 +256,9 @@ function Breadcrumbs(t0) {
263
256
  for (const li of nav.querySelectorAll(":scope > ol > li[data-index]")) {
264
257
  var _items$Number;
265
258
  const key = (_items$Number = items[Number(li.getAttribute("data-index"))]) === null || _items$Number === void 0 ? void 0 : _items$Number.key;
266
- if (key == null) continue;
267
- const crumbWidth = getCrumbWidth(li, range);
259
+ const crumb = li.firstElementChild;
260
+ if (key == null || !crumb) continue;
261
+ const crumbWidth = crumb.getBoundingClientRect().width;
268
262
  widths_0.set(key, crumbWidth);
269
263
  if (li.nextElementSibling && !li.hasAttribute("data-collapsed")) {
270
264
  const separator = li.getBoundingClientRect().width - crumbWidth;
@@ -336,7 +336,7 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
336
336
  const selectedItems = Array.isArray(selected) ? selected : [...selected ? [selected] : []];
337
337
  const selectedValueText = selectedItems.length ? selectedItems.map((item) => item.text).join(", ") : placeholder;
338
338
  const shouldAutoWireLabel = isReferenced === false && Boolean(labelId) && Boolean(selectedValueId);
339
- return (props) => {
339
+ return (props, context) => {
340
340
  return renderAnchor({
341
341
  ...props,
342
342
  ...shouldAutoWireLabel ? { "aria-labelledby": [labelId, selectedValueId].filter(Boolean).join(" ") } : {},
@@ -344,7 +344,7 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
344
344
  id: selectedValueId,
345
345
  children: selectedValueText
346
346
  }) : selectedValueText
347
- });
347
+ }, context);
348
348
  };
349
349
  }, [
350
350
  placeholder,
@@ -5,6 +5,11 @@ import React, { ForwardRefExoticComponent } from "react";
5
5
  //#region src/TooltipV2/Tooltip.d.ts
6
6
  type TooltipDirection = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
7
7
  type TooltipProps = React.PropsWithChildren<{
8
+ /**
9
+ * Render a single interactive trigger instead of passing children.
10
+ * Forward all supplied props, including ref, to that element.
11
+ */
12
+ renderAnchor?: (props: TooltipAnchorProps) => React.ReactElement;
8
13
  direction?: TooltipDirection;
9
14
  text: string;
10
15
  type?: 'label' | 'description';
@@ -27,6 +32,9 @@ type TooltipProps = React.PropsWithChildren<{
27
32
  */
28
33
  _privateDisableTooltip?: boolean;
29
34
  }> & React.HTMLAttributes<HTMLElement>;
35
+ type TooltipAnchorProps = React.HTMLAttributes<HTMLElement> & {
36
+ ref: React.RefCallback<HTMLElement>;
37
+ };
30
38
  declare const Tooltip: ForwardRefExoticComponent<React.PropsWithoutRef<TooltipProps> & React.RefAttributes<HTMLElement>> & SlotMarker;
31
39
  //#endregion
32
- export { Tooltip, TooltipDirection, TooltipProps };
40
+ export { Tooltip, TooltipAnchorProps, TooltipDirection, TooltipProps };
@@ -1,4 +1,3 @@
1
- import { c } from "../utils/react-compiler-runtime.js";
2
1
  import { reactMajorVersion } from "../utils/environment.js";
3
2
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
4
3
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
@@ -14,7 +13,7 @@ import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
14
13
  import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
15
14
  import useSafeTimeout from "../hooks/useSafeTimeout.js";
16
15
  import { TooltipContext } from "./TooltipContext.js";
17
- import React, { Children, useEffect, useRef, useState } from "react";
16
+ import React, { Children, useEffect, useMemo, useRef, useState } from "react";
18
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
19
18
  import { clsx } from "clsx";
20
19
  import { getAnchoredPosition } from "@primer/behaviors";
@@ -81,50 +80,10 @@ const isInteractive = (element) => {
81
80
  return interactiveElements.some((selector) => element.matches(selector)) || element.hasAttribute("role") && element.getAttribute("role") === "button";
82
81
  };
83
82
  const emptyKeybindingHints = [];
84
- const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
85
- const $ = c(60);
86
- let children;
87
- let className;
88
- let id;
89
- let rest;
90
- let t1;
91
- let t2;
92
- let t3;
93
- let t4;
94
- let t5;
95
- let text;
96
- if ($[0] !== t0) {
97
- ({direction: t1, text, type: t2, children, id, className, keybindingHint: t3, delay: t4, _privateDisableTooltip: t5, ...rest} = t0);
98
- $[0] = t0;
99
- $[1] = children;
100
- $[2] = className;
101
- $[3] = id;
102
- $[4] = rest;
103
- $[5] = t1;
104
- $[6] = t2;
105
- $[7] = t3;
106
- $[8] = t4;
107
- $[9] = t5;
108
- $[10] = text;
109
- } else {
110
- children = $[1];
111
- className = $[2];
112
- id = $[3];
113
- rest = $[4];
114
- t1 = $[5];
115
- t2 = $[6];
116
- t3 = $[7];
117
- t4 = $[8];
118
- t5 = $[9];
119
- text = $[10];
120
- }
121
- const direction = t1 === void 0 ? "s" : t1;
122
- const type = t2 === void 0 ? "description" : t2;
123
- const keybindingHint = t3 === void 0 ? emptyKeybindingHints : t3;
124
- const delay = t4 === void 0 ? "short" : t4;
125
- const _privateDisableTooltip = t5 === void 0 ? false : t5;
83
+ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, renderAnchor, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
126
84
  const tooltipId = useId$1(id);
127
- const child = Children.only(children);
85
+ renderAnchor && children != null && invariant(false, "Pass either `children` or `renderAnchor` to `Tooltip`, not both.");
86
+ const child = renderAnchor ? void 0 : Children.only(children);
128
87
  const isFragmentTrigger = /*#__PURE__*/ React.isValidElement(child) && child.type === React.Fragment;
129
88
  warning(isFragmentTrigger, "The `Tooltip` component does not support a React Fragment as its trigger. Pass a single interactive element instead.");
130
89
  const elementChild = /*#__PURE__*/ React.isValidElement(child) ? child : void 0;
@@ -133,281 +92,163 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
133
92
  const triggerRef = useRef(null);
134
93
  const mergedTriggerRef = useMergedRefs(triggerRef, useMergedRefs(forwardedRef, childRef));
135
94
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : childRef);
136
- const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
137
- const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
95
+ const readTriggerRef = renderAnchor || mergedRefEnabled ? triggerRef : providedOrCreatedRef;
96
+ const appliedTriggerRef = renderAnchor || mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
138
97
  const tooltipElRef = useRef(null);
139
98
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
140
99
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
141
100
  const openTimeoutRef = React.useRef(null);
142
101
  const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
143
- let t6;
144
- if ($[11] !== _privateDisableTooltip || $[12] !== direction || $[13] !== readTriggerRef) {
145
- t6 = () => {
146
- try {
147
- if (tooltipElRef.current && readTriggerRef.current instanceof HTMLElement && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
148
- const tooltip = tooltipElRef.current;
149
- const trigger = readTriggerRef.current;
150
- tooltip.showPopover();
151
- setIsPopoverOpen(true);
152
- const settings = {
153
- side: directionToPosition[direction].side,
154
- align: directionToPosition[direction].align
155
- };
156
- const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, settings);
157
- const calculatedDirection_0 = positionToDirection[`${anchorSide}-${anchorAlign}`];
158
- setCalculatedDirection(calculatedDirection_0);
159
- tooltip.style.top = `${top}px`;
160
- tooltip.style.left = `${left}px`;
161
- }
162
- } catch (t7) {
163
- const error = t7;
164
- if (error && typeof error === "object" && "message" in error && typeof error.message === "string" && error.message.includes("not a valid selector")) {} else throw error;
165
- }
166
- };
167
- $[11] = _privateDisableTooltip;
168
- $[12] = direction;
169
- $[13] = readTriggerRef;
170
- $[14] = t6;
171
- } else t6 = $[14];
172
- const openTooltip = t6;
173
- let t7;
174
- if ($[15] !== readTriggerRef || $[16] !== safeClearTimeout) {
175
- t7 = () => {
176
- if (openTimeoutRef.current) {
177
- safeClearTimeout(openTimeoutRef.current);
178
- openTimeoutRef.current = null;
179
- }
180
- try {
181
- if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
182
- tooltipElRef.current.hidePopover();
183
- setIsPopoverOpen(false);
184
- } else setIsPopoverOpen(false);
185
- } catch (t8) {
186
- const error_0 = t8;
187
- if (error_0 && typeof error_0 === "object" && "message" in error_0 && typeof error_0.message === "string" && error_0.message.includes("not a valid selector")) {} else throw error_0;
102
+ const openTooltip = () => {
103
+ try {
104
+ if (tooltipElRef.current && readTriggerRef.current instanceof HTMLElement && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
105
+ const tooltip = tooltipElRef.current;
106
+ const trigger = readTriggerRef.current;
107
+ tooltip.showPopover();
108
+ setIsPopoverOpen(true);
109
+ const settings = {
110
+ side: directionToPosition[direction].side,
111
+ align: directionToPosition[direction].align
112
+ };
113
+ const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, settings);
114
+ const calculatedDirection = positionToDirection[`${anchorSide}-${anchorAlign}`];
115
+ setCalculatedDirection(calculatedDirection);
116
+ tooltip.style.top = `${top}px`;
117
+ tooltip.style.left = `${left}px`;
188
118
  }
189
- };
190
- $[15] = readTriggerRef;
191
- $[16] = safeClearTimeout;
192
- $[17] = t7;
193
- } else t7 = $[17];
194
- const closeTooltip = t7;
195
- let t8;
196
- if ($[18] !== tooltipId) {
197
- t8 = { tooltipId };
198
- $[18] = tooltipId;
199
- $[19] = t8;
200
- } else t8 = $[19];
201
- const value = t8;
202
- let t9;
203
- if ($[20] !== readTriggerRef || $[21] !== type) {
204
- t9 = () => {
205
- if (!tooltipElRef.current || !readTriggerRef.current) return;
206
- const trigger_0 = readTriggerRef.current;
207
- const isInvalidTrigger = !(trigger_0 instanceof HTMLElement);
208
- warning(isInvalidTrigger, "The `Tooltip` component expects its trigger ref to resolve to an HTML element. Ensure the trigger forwards its ref to a single interactive element instead of a React Fragment.");
209
- if (isInvalidTrigger) return;
210
- const isTriggerInteractive = isInteractive(trigger_0);
211
- const triggerChildren = trigger_0.childNodes;
212
- const hasInteractiveDescendant = Array.from(triggerChildren).some(_temp2);
213
- !(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.");
214
- if (type === "label") {
215
- const hasAriaLabel = trigger_0.hasAttribute("aria-label");
216
- const hasAriaLabelInChildren = Array.from(trigger_0.childNodes).some(_temp3);
217
- 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.");
218
- }
219
- if (typeof window !== "undefined") {
220
- if (!isSupported()) apply();
221
- }
222
- tooltipElRef.current.setAttribute("popover", "auto");
223
- };
224
- $[20] = readTriggerRef;
225
- $[21] = type;
226
- $[22] = t9;
227
- } else t9 = $[22];
228
- let t10;
229
- if ($[23] !== direction || $[24] !== readTriggerRef || $[25] !== type) {
230
- t10 = [
231
- tooltipElRef,
232
- readTriggerRef,
233
- direction,
234
- type
235
- ];
236
- $[23] = direction;
237
- $[24] = readTriggerRef;
238
- $[25] = type;
239
- $[26] = t10;
240
- } else t10 = $[26];
241
- useEffect(t9, t10);
242
- let t11;
243
- if ($[27] !== _privateDisableTooltip || $[28] !== closeTooltip || $[29] !== isPopoverOpen) {
244
- t11 = (event) => {
245
- if (isPopoverOpen) {
246
- if (!_privateDisableTooltip) {
247
- event.stopImmediatePropagation();
248
- event.preventDefault();
249
- }
250
- closeTooltip();
119
+ } catch (error) {
120
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string" && error.message.includes("not a valid selector")) {} else throw error;
121
+ }
122
+ };
123
+ const closeTooltip = () => {
124
+ if (openTimeoutRef.current) {
125
+ safeClearTimeout(openTimeoutRef.current);
126
+ openTimeoutRef.current = null;
127
+ }
128
+ try {
129
+ if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
130
+ tooltipElRef.current.hidePopover();
131
+ setIsPopoverOpen(false);
132
+ } else setIsPopoverOpen(false);
133
+ } catch (error) {
134
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string" && error.message.includes("not a valid selector")) {} else throw error;
135
+ }
136
+ };
137
+ const value = useMemo(() => ({ tooltipId }), [tooltipId]);
138
+ useEffect(() => {
139
+ if (!tooltipElRef.current || !readTriggerRef.current) return;
140
+ const trigger = readTriggerRef.current;
141
+ const isInvalidTrigger = !(trigger instanceof HTMLElement);
142
+ warning(isInvalidTrigger, "The `Tooltip` component expects its trigger ref to resolve to an HTML element. Ensure the trigger forwards its ref to a single interactive element instead of a React Fragment.");
143
+ if (isInvalidTrigger) return;
144
+ const isTriggerInteractive = isInteractive(trigger);
145
+ const triggerChildren = trigger.childNodes;
146
+ const hasInteractiveDescendant = Array.from(triggerChildren).some((child) => {
147
+ return child instanceof HTMLElement && isInteractive(child) || Array.from(child.childNodes).some((grandChild) => grandChild instanceof HTMLElement && isInteractive(grandChild));
148
+ });
149
+ !(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.");
150
+ if (type === "label") {
151
+ const hasAriaLabel = trigger.hasAttribute("aria-label");
152
+ const hasAriaLabelInChildren = Array.from(trigger.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
153
+ 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.");
154
+ }
155
+ if (typeof window !== "undefined") {
156
+ if (!isSupported()) apply();
157
+ }
158
+ tooltipElRef.current.setAttribute("popover", "auto");
159
+ }, [
160
+ tooltipElRef,
161
+ readTriggerRef,
162
+ direction,
163
+ type
164
+ ]);
165
+ useOnEscapePress((event) => {
166
+ if (isPopoverOpen) {
167
+ if (!_privateDisableTooltip) {
168
+ event.stopImmediatePropagation();
169
+ event.preventDefault();
251
170
  }
252
- };
253
- $[27] = _privateDisableTooltip;
254
- $[28] = closeTooltip;
255
- $[29] = isPopoverOpen;
256
- $[30] = t11;
257
- } else t11 = $[30];
258
- let t12;
259
- if ($[31] !== _privateDisableTooltip || $[32] !== isPopoverOpen) {
260
- t12 = [isPopoverOpen, _privateDisableTooltip];
261
- $[31] = _privateDisableTooltip;
262
- $[32] = isPopoverOpen;
263
- $[33] = t12;
264
- } else t12 = $[33];
265
- useOnEscapePress(t11, t12);
171
+ closeTooltip();
172
+ }
173
+ }, [isPopoverOpen, _privateDisableTooltip]);
266
174
  const platform = usePlatform();
267
- const hasAriaLabel_0 = "aria-label" in rest;
268
- let t13;
269
- if ($[34] !== keybindingHint) {
270
- t13 = Array.isArray(keybindingHint) ? keybindingHint : [keybindingHint];
271
- $[34] = keybindingHint;
272
- $[35] = t13;
273
- } else t13 = $[35];
274
- const keybindingHints = t13;
175
+ const hasAriaLabel = "aria-label" in rest;
176
+ const keybindingHints = Array.isArray(keybindingHint) ? keybindingHint : [keybindingHint];
275
177
  if (isFragmentTrigger) return child;
276
- const t14 = TooltipContext;
277
- const t15 = /*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
178
+ const triggerProps = {
278
179
  ref: appliedTriggerRef,
279
- "aria-describedby": (() => {
280
- if (type !== "description") return child.props["aria-describedby"];
281
- const existingDescribedBy = child.props["aria-describedby"];
282
- if (existingDescribedBy) return `${existingDescribedBy} ${tooltipId}`;
283
- return tooltipId;
284
- })(),
285
- "aria-labelledby": type === "label" ? tooltipId : child.props["aria-labelledby"],
286
- onBlur: (event_0) => {
287
- var _child$props$onBlur, _child$props;
180
+ ...type === "description" ? { "aria-describedby": [elementChild === null || elementChild === void 0 ? void 0 : elementChild.props["aria-describedby"], tooltipId].filter(Boolean).join(" ") } : {},
181
+ ...type === "label" ? { "aria-labelledby": tooltipId } : {},
182
+ onBlur: (event) => {
183
+ var _elementChild$props$o, _elementChild$props;
288
184
  closeTooltip();
289
- (_child$props$onBlur = (_child$props = child.props).onBlur) === null || _child$props$onBlur === void 0 || _child$props$onBlur.call(_child$props, event_0);
185
+ elementChild === null || elementChild === void 0 || (_elementChild$props$o = (_elementChild$props = elementChild.props).onBlur) === null || _elementChild$props$o === void 0 || _elementChild$props$o.call(_elementChild$props, event);
290
186
  },
291
- onTouchEnd: (event_1) => {
292
- var _child$props$onTouchE, _child$props2;
293
- (_child$props$onTouchE = (_child$props2 = child.props).onTouchEnd) === null || _child$props$onTouchE === void 0 || _child$props$onTouchE.call(_child$props2, event_1);
187
+ onTouchEnd: (event) => {
188
+ var _elementChild$props$o2, _elementChild$props2;
189
+ elementChild === null || elementChild === void 0 || (_elementChild$props$o2 = (_elementChild$props2 = elementChild.props).onTouchEnd) === null || _elementChild$props$o2 === void 0 || _elementChild$props$o2.call(_elementChild$props2, event);
294
190
  safeSetTimeout(() => closeTooltip(), 10);
295
191
  },
296
- onFocus: (event_2) => {
297
- var _child$props$onFocus, _child$props3;
192
+ onFocus: (event) => {
193
+ var _elementChild$props$o3, _elementChild$props3;
298
194
  try {
299
- if (!event_2.target.matches(":focus-visible")) return;
300
- } catch (t16) {}
195
+ if (!event.target.matches(":focus-visible")) return;
196
+ } catch (_error) {}
301
197
  openTooltip();
302
- (_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event_2);
198
+ elementChild === null || elementChild === void 0 || (_elementChild$props$o3 = (_elementChild$props3 = elementChild.props).onFocus) === null || _elementChild$props$o3 === void 0 || _elementChild$props$o3.call(_elementChild$props3, event);
303
199
  },
304
- onMouseOverCapture: (event_3) => {
200
+ onMouseOverCapture: (event) => {
305
201
  const delayTime = delayTimeMap[delay] || 50;
306
202
  openTimeoutRef.current = safeSetTimeout(() => {
307
- var _child$props$onMouseE, _child$props4;
203
+ var _elementChild$props$o4, _elementChild$props4;
308
204
  if (!openTimeoutRef.current) return;
309
205
  openTooltip();
310
- (_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 || _child$props$onMouseE.call(_child$props4, event_3);
206
+ elementChild === null || elementChild === void 0 || (_elementChild$props$o4 = (_elementChild$props4 = elementChild.props).onMouseEnter) === null || _elementChild$props$o4 === void 0 || _elementChild$props$o4.call(_elementChild$props4, event);
311
207
  }, delayTime);
312
208
  },
313
- onMouseLeave: (event_4) => {
314
- var _child$props$onMouseL, _child$props5;
209
+ onMouseLeave: (event) => {
210
+ var _elementChild$props$o5, _elementChild$props5;
315
211
  closeTooltip();
316
- (_child$props$onMouseL = (_child$props5 = child.props).onMouseLeave) === null || _child$props$onMouseL === void 0 || _child$props$onMouseL.call(_child$props5, event_4);
212
+ elementChild === null || elementChild === void 0 || (_elementChild$props$o5 = (_elementChild$props5 = elementChild.props).onMouseLeave) === null || _elementChild$props$o5 === void 0 || _elementChild$props$o5.call(_elementChild$props5, event);
317
213
  }
318
- });
319
- let t17;
320
- if ($[36] !== className) {
321
- t17 = clsx(className, Tooltip_module_css_default.Tooltip);
322
- $[36] = className;
323
- $[37] = t17;
324
- } else t17 = $[37];
325
- const t18 = type === "description" ? "tooltip" : void 0;
326
- const t19 = hasAriaLabel_0 || keybindingHints.length === 0 ? tooltipId : void 0;
327
- let t20;
328
- if ($[38] !== hasAriaLabel_0 || $[39] !== keybindingHints || $[40] !== platform || $[41] !== text || $[42] !== tooltipId) {
329
- t20 = keybindingHints.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
330
- id: hasAriaLabel_0 ? void 0 : tooltipId,
331
- children: [text, /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
332
- "(",
333
- keybindingHints.map((hint) => getAccessibleKeybindingHintString(hint, platform)).join(" or "),
334
- ")"
335
- ] })]
336
- }), /* @__PURE__ */ jsx("span", {
337
- className: clsx(Tooltip_module_css_default.KeybindingHintContainer, text && Tooltip_module_css_default.HasTextBefore, keybindingHints.length > 1 && Tooltip_module_css_default.HasMultipleHints),
338
- "aria-hidden": true,
339
- "data-component": "Tooltip.KeybindingHintContainer",
340
- children: keybindingHints.map(_temp4)
341
- })] }) : text;
342
- $[38] = hasAriaLabel_0;
343
- $[39] = keybindingHints;
344
- $[40] = platform;
345
- $[41] = text;
346
- $[42] = tooltipId;
347
- $[43] = t20;
348
- } else t20 = $[43];
349
- let t21;
350
- if ($[44] !== calculatedDirection || $[45] !== closeTooltip || $[46] !== openTooltip || $[47] !== rest || $[48] !== t17 || $[49] !== t18 || $[50] !== t19 || $[51] !== t20) {
351
- t21 = /* @__PURE__ */ jsx("span", {
352
- className: t17,
214
+ };
215
+ return /* @__PURE__ */ jsx(TooltipContext.Provider, {
216
+ value,
217
+ children: /* @__PURE__ */ jsxs(Fragment$1, { children: [renderAnchor ? renderAnchor({
218
+ ...triggerProps,
219
+ ref: mergedTriggerRef
220
+ }) : /*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, triggerProps), /* @__PURE__ */ jsx("span", {
221
+ className: clsx(className, Tooltip_module_css_default.Tooltip),
353
222
  ref: tooltipElRef,
354
223
  "data-direction": calculatedDirection,
355
224
  "data-component": "Tooltip",
356
225
  ...rest,
357
- role: t18,
226
+ role: type === "description" ? "tooltip" : void 0,
358
227
  "aria-hidden": true,
359
228
  onMouseEnter: openTooltip,
360
229
  onMouseLeave: closeTooltip,
361
- id: t19,
362
- children: t20
363
- });
364
- $[44] = calculatedDirection;
365
- $[45] = closeTooltip;
366
- $[46] = openTooltip;
367
- $[47] = rest;
368
- $[48] = t17;
369
- $[49] = t18;
370
- $[50] = t19;
371
- $[51] = t20;
372
- $[52] = t21;
373
- } else t21 = $[52];
374
- let t22;
375
- if ($[53] !== t15 || $[54] !== t21) {
376
- t22 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t15, t21] });
377
- $[53] = t15;
378
- $[54] = t21;
379
- $[55] = t22;
380
- } else t22 = $[55];
381
- let t23;
382
- if ($[56] !== t14.Provider || $[57] !== t22 || $[58] !== value) {
383
- t23 = /* @__PURE__ */ jsx(t14.Provider, {
384
- value,
385
- children: t22
386
- });
387
- $[56] = t14.Provider;
388
- $[57] = t22;
389
- $[58] = value;
390
- $[59] = t23;
391
- } else t23 = $[59];
392
- return t23;
230
+ id: hasAriaLabel || keybindingHints.length === 0 ? tooltipId : void 0,
231
+ children: keybindingHints.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
232
+ id: hasAriaLabel ? void 0 : tooltipId,
233
+ children: [text, /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
234
+ "(",
235
+ keybindingHints.map((hint) => getAccessibleKeybindingHintString(hint, platform)).join(" or "),
236
+ ")"
237
+ ] })]
238
+ }), /* @__PURE__ */ jsx("span", {
239
+ className: clsx(Tooltip_module_css_default.KeybindingHintContainer, text && Tooltip_module_css_default.HasTextBefore, keybindingHints.length > 1 && Tooltip_module_css_default.HasMultipleHints),
240
+ "aria-hidden": true,
241
+ "data-component": "Tooltip.KeybindingHintContainer",
242
+ children: keybindingHints.map((hint, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && " or ", /* @__PURE__ */ jsx(KeybindingHint, {
243
+ keys: hint,
244
+ format: "condensed",
245
+ variant: "onEmphasis",
246
+ size: "small"
247
+ })] }, `${i}-${hint}`))
248
+ })] }) : text
249
+ })] })
250
+ });
393
251
  });
394
252
  Tooltip.__SLOT__ = Symbol("Tooltip");
395
- function _temp(grandChild) {
396
- return grandChild instanceof HTMLElement && isInteractive(grandChild);
397
- }
398
- function _temp2(child_0) {
399
- return child_0 instanceof HTMLElement && isInteractive(child_0) || Array.from(child_0.childNodes).some(_temp);
400
- }
401
- function _temp3(child_1) {
402
- return child_1 instanceof HTMLElement && child_1.hasAttribute("aria-label");
403
- }
404
- function _temp4(hint_0, i) {
405
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && " or ", /* @__PURE__ */ jsx(KeybindingHint, {
406
- keys: hint_0,
407
- format: "condensed",
408
- variant: "onEmphasis",
409
- size: "small"
410
- })] }, `${i}-${hint_0}`);
411
- }
412
253
  //#endregion
413
254
  export { Tooltip };
@@ -1,2 +1,2 @@
1
- import { Tooltip, TooltipDirection, TooltipProps } from "./Tooltip.js";
2
- export { Tooltip, type TooltipDirection, type TooltipProps };
1
+ import { Tooltip, TooltipAnchorProps, TooltipDirection, TooltipProps } from "./Tooltip.js";
2
+ export { Tooltip, type TooltipAnchorProps, type TooltipDirection, type TooltipProps };
@@ -82,11 +82,11 @@ const ActionMenuBase = (t0) => {
82
82
  }
83
83
  let t5;
84
84
  if ($[14] !== anchorContent || $[15] !== renderAnchor) {
85
- t5 = (props) => renderAnchor({
85
+ t5 = (props, context) => renderAnchor({
86
86
  "aria-label": "menu",
87
87
  children: anchorContent,
88
88
  ...props
89
- });
89
+ }, context);
90
90
  $[14] = anchorContent;
91
91
  $[15] = renderAnchor;
92
92
  $[16] = t5;
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { AriaStatus, AriaStatusProps } from "./live-region/AriaStatus.js";
11
11
  import BaseStyles, { BaseStylesProps } from "./BaseStyles.js";
12
12
  import { ThemeProvider, ThemeProviderProps } from "./ThemeProvider.js";
13
13
  import { useColorSchemeVar, useTheme } from "./useTheme.js";
14
- import { Tooltip, TooltipProps } from "./TooltipV2/Tooltip.js";
14
+ import { Tooltip, TooltipAnchorProps, TooltipProps } from "./TooltipV2/Tooltip.js";
15
15
  import { ButtonBaseProps, ButtonProps, IconButtonProps } from "./Button/types.js";
16
16
  import { IconButton } from "./Button/IconButton.js";
17
17
  import { LinkButton, LinkButtonProps } from "./Button/LinkButton.js";
@@ -49,7 +49,7 @@ import { ActionListDividerProps } from "./ActionList/Divider.js";
49
49
  import { ActionListDescriptionProps } from "./ActionList/Description.js";
50
50
  import { ActionListLeadingVisualProps, ActionListTrailingVisualProps } from "./ActionList/Visuals.js";
51
51
  import { ActionList } from "./ActionList/index.js";
52
- import { AnchoredOverlay, AnchoredOverlayProps } from "./AnchoredOverlay/AnchoredOverlay.js";
52
+ import { AnchoredOverlay, AnchoredOverlayAnchorContext, AnchoredOverlayProps } from "./AnchoredOverlay/AnchoredOverlay.js";
53
53
  import { AutocompleteMenuProps } from "./Autocomplete/AutocompleteMenu.js";
54
54
  import { AutocompleteOverlayProps } from "./Autocomplete/AutocompleteOverlay.js";
55
55
  import _default$15, { TextInputProps } from "./TextInput/TextInput.js";
@@ -121,6 +121,6 @@ import { StackItemProps, StackProps } from "./Stack/Stack.js";
121
121
  import { Stack } from "./Stack/index.js";
122
122
  import { ActionsProps, ChildrenPropTypes, PageHeader, PageHeaderProps, TitleAreaProps, TitleProps } from "./PageHeader/PageHeader.js";
123
123
  import { SkeletonBox, SkeletonBoxProps } from "./Skeleton/SkeletonBox.js";
124
- import { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu/ActionMenu.js";
124
+ import { ActionMenu, ActionMenuAnchorProps, ActionMenuAnchorRenderProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu/ActionMenu.js";
125
125
  import Overlay, { OverlayProps } from "./Overlay/Overlay.js";
126
- export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayProps, type AnchoredPositionHookSettings, AriaAlert, type AriaAlertProps, AriaStatus, type AriaStatusProps, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps, type CustomWidthOptions, Details, type DetailsProps, Dialog, type DialogButtonProps, type DialogHeaderProps, type DialogHeight, type DialogProps, type DialogWidth, DragHandle, type DragHandleProps, type FCWithSlotMarker, Flash, type FlashProps, FocusKeys, type FocusTrapHookSettings, type FocusZoneHookSettings, _default$6 as FormControl, type FormControlCaptionProps, type Props as FormControlLabelProps, type FormControlProps, type FormControlValidationProps, _default$7 as Header, type HeaderItemProps, type HeaderLinkProps, type HeaderProps, Heading, type HeadingProps, IconButton, type IconButtonProps, IssueLabelToken, type IssueLabelTokenProps, Label, type LabelColorOptions, LabelGroup, type LabelGroupProps, type LabelProps, Link, LinkButton, type LinkButtonProps, type LinkProps, NavList, type NavListDividerProps, type NavListGroupHeadingProps, type NavListGroupProps, type NavListItemProps, type NavListLeadingVisualProps, type NavListProps, type NavListSubNavProps, type NavListTrailingVisualProps, Overlay, type OverlayProps, PageHeader, type ActionsProps as PageHeaderActionsProps, type ChildrenPropTypes as PageHeaderChildrenPropTypes, type PageHeaderProps, type TitleAreaProps as PageHeaderTitleAreaProps, type TitleProps as PageHeaderTitleProps, PageLayout, type PageLayoutContentProps, type PageLayoutFooterProps, type PageLayoutHeaderProps, type PageLayoutPaneProps, type PageLayoutProps, Pagination, type PaginationProps, type PaneWidth, type PaneWidthValue, _default$8 as Popover, type PopoverContentProps, type PopoverProps, Portal, PortalContext, type PortalProps, ProgressBar, type ProgressBarItemProps, type ProgressBarProps, _default$9 as Radio, _default$10 as RadioGroup, type RadioGroupProps, type RadioProps, RelativeTime, type RelativeTimeProps, type ResponsiveValue, SegmentedControl, type SegmentedControlActionProps, type SegmentedControlButtonProps, type SegmentedControlDividerProps, type SegmentedControlIconButtonProps, type SegmentedControlProps, _default$11 as Select, SelectPanel, type GroupedListProps as SelectPanelGroupedListProps, type ItemInput as SelectPanelItemInput, type FilteredActionListItemProps as SelectPanelItemProps, type SelectPanelProps, type SelectProps, _default$12 as SideNav, type SideNavLinkProps, type SideNavProps, SkeletonBox, type SkeletonBoxProps, type SlotMarker, Spinner, type SpinnerProps, SplitPageLayout, type SplitPageLayoutContentProps, type SplitPageLayoutFooterProps, type SplitPageLayoutHeaderProps, type SplitPageLayoutPaneProps, type SplitPageLayoutProps, Stack, type StackItemProps, type StackProps, StateLabel, type StateLabelProps, _default$13 as SubNav, type SubNavLinkProps, type SubNavLinksProps, type SubNavProps, _default$14 as Text, _default$15 as TextInput, type TextInputActionProps, type TextInputProps, _default$16 as TextInputWithTokens, type TextInputWithTokensProps, type TextProps, _default$17 as Textarea, type TextareaProps, type ThemeColorPaths, ThemeProvider, type ThemeProviderProps, type ThemeShadowPaths, _default$18 as Timeline, type TimelineActionsProps, type TimelineAvatarProps, type TimelineBadgeProps, type TimelineBadgeVariant, type TimelineBodyProps, type TimelineBreakProps, type TimelineItemProps, type TimelineItemsProps, type TimelineProps, ToggleSwitch, type ToggleSwitchProps, Token, type TokenProps, Tooltip, type TooltipProps, type TouchOrMouseEvent, TreeView, type TreeViewErrorDialogProps, type TreeViewItemProps, type TreeViewProps, type TreeViewSubTreeProps, type TreeViewVisualProps, _default$19 as Truncate, type TruncateProps, UnderlineNav, type UnderlineNavItemProps, type UnderlineNavProps, type UsePaneWidthOptions, type UsePaneWidthResult, VisuallyHidden, type VisuallyHiddenProps, type WithSlotMarker, asSlot, createComponent, defaultPaneWidth, isSlot, registerPortalRoot, theme, useAnchoredPosition, useColorSchemeVar, useConfirm, useDetails, useFocusTrap, useFocusZone, useFormControlForwardedProps, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnEscapePress, useOnOutsideClick, useOpenAndCloseFocus, useOverlay, usePaneWidth, useProvidedRefOrCreate, useRefObjectAsForwardedRef, useResizeObserver, useResponsiveValue, useRovingTabIndex, useSafeTimeout, useSlots, useSyncedState, useTheme };
126
+ export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuAnchorRenderProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayAnchorContext, type AnchoredOverlayProps, type AnchoredPositionHookSettings, AriaAlert, type AriaAlertProps, AriaStatus, type AriaStatusProps, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps, type CustomWidthOptions, Details, type DetailsProps, Dialog, type DialogButtonProps, type DialogHeaderProps, type DialogHeight, type DialogProps, type DialogWidth, DragHandle, type DragHandleProps, type FCWithSlotMarker, Flash, type FlashProps, FocusKeys, type FocusTrapHookSettings, type FocusZoneHookSettings, _default$6 as FormControl, type FormControlCaptionProps, type Props as FormControlLabelProps, type FormControlProps, type FormControlValidationProps, _default$7 as Header, type HeaderItemProps, type HeaderLinkProps, type HeaderProps, Heading, type HeadingProps, IconButton, type IconButtonProps, IssueLabelToken, type IssueLabelTokenProps, Label, type LabelColorOptions, LabelGroup, type LabelGroupProps, type LabelProps, Link, LinkButton, type LinkButtonProps, type LinkProps, NavList, type NavListDividerProps, type NavListGroupHeadingProps, type NavListGroupProps, type NavListItemProps, type NavListLeadingVisualProps, type NavListProps, type NavListSubNavProps, type NavListTrailingVisualProps, Overlay, type OverlayProps, PageHeader, type ActionsProps as PageHeaderActionsProps, type ChildrenPropTypes as PageHeaderChildrenPropTypes, type PageHeaderProps, type TitleAreaProps as PageHeaderTitleAreaProps, type TitleProps as PageHeaderTitleProps, PageLayout, type PageLayoutContentProps, type PageLayoutFooterProps, type PageLayoutHeaderProps, type PageLayoutPaneProps, type PageLayoutProps, Pagination, type PaginationProps, type PaneWidth, type PaneWidthValue, _default$8 as Popover, type PopoverContentProps, type PopoverProps, Portal, PortalContext, type PortalProps, ProgressBar, type ProgressBarItemProps, type ProgressBarProps, _default$9 as Radio, _default$10 as RadioGroup, type RadioGroupProps, type RadioProps, RelativeTime, type RelativeTimeProps, type ResponsiveValue, SegmentedControl, type SegmentedControlActionProps, type SegmentedControlButtonProps, type SegmentedControlDividerProps, type SegmentedControlIconButtonProps, type SegmentedControlProps, _default$11 as Select, SelectPanel, type GroupedListProps as SelectPanelGroupedListProps, type ItemInput as SelectPanelItemInput, type FilteredActionListItemProps as SelectPanelItemProps, type SelectPanelProps, type SelectProps, _default$12 as SideNav, type SideNavLinkProps, type SideNavProps, SkeletonBox, type SkeletonBoxProps, type SlotMarker, Spinner, type SpinnerProps, SplitPageLayout, type SplitPageLayoutContentProps, type SplitPageLayoutFooterProps, type SplitPageLayoutHeaderProps, type SplitPageLayoutPaneProps, type SplitPageLayoutProps, Stack, type StackItemProps, type StackProps, StateLabel, type StateLabelProps, _default$13 as SubNav, type SubNavLinkProps, type SubNavLinksProps, type SubNavProps, _default$14 as Text, _default$15 as TextInput, type TextInputActionProps, type TextInputProps, _default$16 as TextInputWithTokens, type TextInputWithTokensProps, type TextProps, _default$17 as Textarea, type TextareaProps, type ThemeColorPaths, ThemeProvider, type ThemeProviderProps, type ThemeShadowPaths, _default$18 as Timeline, type TimelineActionsProps, type TimelineAvatarProps, type TimelineBadgeProps, type TimelineBadgeVariant, type TimelineBodyProps, type TimelineBreakProps, type TimelineItemProps, type TimelineItemsProps, type TimelineProps, ToggleSwitch, type ToggleSwitchProps, Token, type TokenProps, Tooltip, type TooltipAnchorProps, type TooltipProps, type TouchOrMouseEvent, TreeView, type TreeViewErrorDialogProps, type TreeViewItemProps, type TreeViewProps, type TreeViewSubTreeProps, type TreeViewVisualProps, _default$19 as Truncate, type TruncateProps, UnderlineNav, type UnderlineNavItemProps, type UnderlineNavProps, type UsePaneWidthOptions, type UsePaneWidthResult, VisuallyHidden, type VisuallyHiddenProps, type WithSlotMarker, asSlot, createComponent, defaultPaneWidth, isSlot, registerPortalRoot, theme, useAnchoredPosition, useColorSchemeVar, useConfirm, useDetails, useFocusTrap, useFocusZone, useFormControlForwardedProps, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnEscapePress, useOnOutsideClick, useOpenAndCloseFocus, useOverlay, usePaneWidth, useProvidedRefOrCreate, useRefObjectAsForwardedRef, useResizeObserver, useResponsiveValue, useRovingTabIndex, useSafeTimeout, useSlots, useSyncedState, useTheme };
@@ -743,6 +743,11 @@
743
743
  ],
744
744
  "importPath": "@primer/react",
745
745
  "props": [
746
+ {
747
+ "name": "renderAnchor",
748
+ "type": "(props: ActionMenuAnchorRenderProps) => React.ReactElement",
749
+ "description": "Render a custom trigger instead of ActionMenu.Button or ActionMenu.Anchor. Forward every supplied prop, including ref, to a single interactive HTML element."
750
+ },
746
751
  {
747
752
  "name": "children",
748
753
  "type": "React.ReactElement[]",
@@ -932,9 +937,9 @@
932
937
  },
933
938
  {
934
939
  "name": "renderAnchor",
935
- "type": "<T extends React.HTMLAttributes<HTMLElement>>(props: T) => JSX.Element",
940
+ "type": "<T extends React.HTMLAttributes<HTMLElement>>(props: T, context?: AnchoredOverlayAnchorContext) => JSX.Element",
936
941
  "defaultValue": "",
937
- "description": "A custom function component used to render the anchor element. When renderAnchor is null, an anchorRef is required."
942
+ "description": "Render the anchor element. The second argument exposes the same object ref already supplied in the props, for composing trigger behaviors. Existing one-argument callbacks remain supported. When renderAnchor is null, an anchorRef is required."
938
943
  },
939
944
  {
940
945
  "name": "anchorRef",
@@ -9109,6 +9114,11 @@
9109
9114
  }
9110
9115
  ],
9111
9116
  "props": [
9117
+ {
9118
+ "name": "renderAnchor",
9119
+ "type": "(props: TooltipAnchorProps) => React.ReactElement",
9120
+ "description": "Render a single interactive trigger instead of children. Forward every supplied prop, including the callback ref, to that element. Tooltip combines its internal ref with any forwarded ref."
9121
+ },
9112
9122
  {
9113
9123
  "name": "direction",
9114
9124
  "type": "'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20261113153150",
4
+ "version": "0.0.0-20261113163104",
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",