@primer/react 0.0.0-20260814135639 → 0.0.0-20260819123220

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.
@@ -6,6 +6,7 @@ declare const ActionBar: import("react").FC<import("react").PropsWithChildren<Ac
6
6
  IconButton: import("react").ForwardRefExoticComponent<ActionBarIconButtonProps & import("react").RefAttributes<unknown>>;
7
7
  Button: import("react").ForwardRefExoticComponent<{
8
8
  disabled?: boolean;
9
+ activeAnchorRef?: React.Ref<HTMLButtonElement>;
9
10
  } & {
10
11
  alignContent?: AlignContent;
11
12
  icon?: React.FunctionComponent<import("@primer/octicons-react").IconProps> | React.ElementType | React.ReactElement<any> | null;
@@ -10,9 +10,10 @@ import { AnchorPosition, PositionSettings } from "@primer/behaviors";
10
10
  interface AnchoredOverlayPropsWithAnchor {
11
11
  /**
12
12
  * A custom function component used to render the anchor element.
13
+ * The optional second argument is a reactive ref for the current anchor element.
13
14
  * Will receive the selected text as `children` prop when an item is activated.
14
15
  */
15
- renderAnchor: <T extends Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'aria-labelledby'>>(props: T) => JSX.Element;
16
+ renderAnchor: <T extends Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'aria-labelledby'>>(props: T, anchorRef?: React.RefCallback<HTMLElement>) => JSX.Element;
16
17
  /**
17
18
  * An override to the internal ref that will be spread on to the renderAnchor
18
19
  */
@@ -1,6 +1,7 @@
1
1
  import { reactMajorVersion } from "../utils/environment.js";
2
2
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
3
3
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
4
+ import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
4
5
  import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
5
6
  import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
6
7
  import { useId as useId$1 } from "../hooks/useId.js";
@@ -13,7 +14,7 @@ import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js"
13
14
  import { widthMap } from "../Overlay/constants.js";
14
15
  import { clsx } from "clsx";
15
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
- import { useCallback, useEffect, useState } from "react";
17
+ import { useCallback, useEffect, useMemo, useState } from "react";
17
18
  import { XIcon } from "@primer/octicons-react";
18
19
  //#region src/AnchoredOverlay/AnchoredOverlay.tsx
19
20
  const defaultVariant = {
@@ -21,6 +22,12 @@ const defaultVariant = {
21
22
  narrow: "anchored"
22
23
  };
23
24
  const defaultCloseButtonProps = {};
25
+ function DetachedAnchorObserver({ anchorRef, anchorElement, onAnchorElementChange }) {
26
+ useIsomorphicLayoutEffect(() => {
27
+ if (anchorRef.current !== anchorElement) onAnchorElementChange(anchorRef.current);
28
+ });
29
+ return null;
30
+ }
24
31
  /**
25
32
  * An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
26
33
  * The overlay can be opened and navigated using keyboard or mouse.
@@ -32,7 +39,15 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
32
39
  const shouldRenderAsPopover = cssAnchorPositioning && renderAs === "popover";
33
40
  const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
34
41
  const [anchorElement, setAnchorElement] = useState(null);
35
- if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
42
+ const mergedAnchorRef = useMergedRefs(anchorRef, setAnchorElement);
43
+ const renderAnchorRef = useMemo(() => ({
44
+ get current() {
45
+ return anchorRef.current;
46
+ },
47
+ set current(value) {
48
+ mergedAnchorRef(value);
49
+ }
50
+ }), [anchorRef, mergedAnchorRef]);
36
51
  const [overlayRef, updateOverlayRef] = useRenderForcingRef();
37
52
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
38
53
  const [overlayElement, setOverlayElement] = useState(null);
@@ -78,7 +93,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
78
93
  displayInViewport,
79
94
  onPositionChange: positionChange,
80
95
  enabled: open && !cssAnchorPositioning
81
- }, [overlayElement]);
96
+ }, [overlayElement, anchorElement]);
82
97
  useEffect(() => {
83
98
  if (!open && overlayRef.current) updateOverlayRef(null);
84
99
  }, [
@@ -164,64 +179,72 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
164
179
  const XButtonAriaLabelledBy = closeButtonProps["aria-labelledby"];
165
180
  const XButtonAriaLabel = closeButtonProps["aria-label"];
166
181
  const { className: overlayClassName, _PrivateDisablePortal, ...restOverlayProps } = overlayProps || {};
167
- return /*#__PURE__*/ jsxs(Fragment, { children: [renderAnchor && renderAnchor({
168
- ref: anchorRef,
169
- id: anchorId,
170
- "aria-haspopup": "true",
171
- "aria-expanded": open,
172
- tabIndex: 0,
173
- onClick: onAnchorClick,
174
- onKeyDown: onAnchorKeyDown,
175
- ...popoverTargetProps
176
- }), open ? /*#__PURE__*/ jsxs(Overlay, {
177
- returnFocusRef: anchorRef,
178
- onClickOutside,
179
- ignoreClickRefs: [anchorRef],
180
- onEscape,
181
- role: "none",
182
- visibility: cssAnchorPositioning || position ? "visible" : "hidden",
183
- height,
184
- width,
185
- top: cssAnchorPositioning ? void 0 : (position === null || position === void 0 ? void 0 : position.top) || 0,
186
- left: cssAnchorPositioning ? void 0 : (position === null || position === void 0 ? void 0 : position.left) || 0,
187
- responsiveVariant: variant.narrow === "fullscreen" ? "fullscreen" : void 0,
188
- anchorSide: cssAnchorPositioning ? void 0 : position === null || position === void 0 ? void 0 : position.anchorSide,
189
- className: clsx(className, overlayClassName, cssAnchorPositioning ? AnchoredOverlay_module_css_default.AnchoredOverlay : void 0),
190
- preventOverflow,
191
- "data-component": "AnchoredOverlay",
192
- _PrivateDisablePortal,
193
- ...shouldRenderAsPopover ? { popover: "manual" } : {},
194
- ...restOverlayProps,
195
- ...shouldRenderAsPopover ? { id: popoverId } : {},
196
- ref: mergedRefEnabled ? mergedOverlayRef : (node) => {
197
- setOverlayElement(node);
198
- if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
199
- updateOverlayRef(node);
200
- },
201
- "data-anchor-position": cssAnchorPositioning,
202
- "data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
203
- children: [showXIcon ? /*#__PURE__*/ jsx("div", {
204
- className: AnchoredOverlay_module_css_default.ResponsiveCloseButtonContainer,
205
- children: /*#__PURE__*/ jsx(IconButton, {
206
- ...closeButtonProps,
207
- "data-component": "AnchoredOverlay.CloseButton",
208
- type: "button",
209
- variant: "invisible",
210
- icon: XIcon,
211
- ...XButtonAriaLabelledBy ? {
212
- "aria-labelledby": XButtonAriaLabelledBy,
213
- "aria-label": void 0
214
- } : {
215
- "aria-label": XButtonAriaLabel !== null && XButtonAriaLabel !== void 0 ? XButtonAriaLabel : "Close",
216
- "aria-labelledby": void 0
217
- },
218
- className: clsx(AnchoredOverlay_module_css_default.ResponsiveCloseButton, closeButtonProps.className),
219
- onClick: () => {
220
- onClose("close");
221
- }
222
- })
223
- }) : null, children]
224
- }) : null] });
182
+ return /*#__PURE__*/ jsxs(Fragment, { children: [
183
+ renderAnchor === null ? /*#__PURE__*/ jsx(DetachedAnchorObserver, {
184
+ anchorRef,
185
+ anchorElement,
186
+ onAnchorElementChange: setAnchorElement
187
+ }) : null,
188
+ renderAnchor && renderAnchor({
189
+ ref: renderAnchorRef,
190
+ id: anchorId,
191
+ "aria-haspopup": "true",
192
+ "aria-expanded": open,
193
+ tabIndex: 0,
194
+ onClick: onAnchorClick,
195
+ onKeyDown: onAnchorKeyDown,
196
+ ...popoverTargetProps
197
+ }, mergedAnchorRef),
198
+ open ? /*#__PURE__*/ jsxs(Overlay, {
199
+ returnFocusRef: anchorRef,
200
+ onClickOutside,
201
+ ignoreClickRefs: [anchorRef],
202
+ onEscape,
203
+ role: "none",
204
+ visibility: cssAnchorPositioning || position ? "visible" : "hidden",
205
+ height,
206
+ width,
207
+ top: cssAnchorPositioning ? void 0 : (position === null || position === void 0 ? void 0 : position.top) || 0,
208
+ left: cssAnchorPositioning ? void 0 : (position === null || position === void 0 ? void 0 : position.left) || 0,
209
+ responsiveVariant: variant.narrow === "fullscreen" ? "fullscreen" : void 0,
210
+ anchorSide: cssAnchorPositioning ? void 0 : position === null || position === void 0 ? void 0 : position.anchorSide,
211
+ className: clsx(className, overlayClassName, cssAnchorPositioning ? AnchoredOverlay_module_css_default.AnchoredOverlay : void 0),
212
+ preventOverflow,
213
+ "data-component": "AnchoredOverlay",
214
+ _PrivateDisablePortal,
215
+ ...shouldRenderAsPopover ? { popover: "manual" } : {},
216
+ ...restOverlayProps,
217
+ ...shouldRenderAsPopover ? { id: popoverId } : {},
218
+ ref: mergedRefEnabled ? mergedOverlayRef : (node) => {
219
+ setOverlayElement(node);
220
+ if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
221
+ updateOverlayRef(node);
222
+ },
223
+ "data-anchor-position": cssAnchorPositioning,
224
+ "data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
225
+ children: [showXIcon ? /*#__PURE__*/ jsx("div", {
226
+ className: AnchoredOverlay_module_css_default.ResponsiveCloseButtonContainer,
227
+ children: /*#__PURE__*/ jsx(IconButton, {
228
+ ...closeButtonProps,
229
+ "data-component": "AnchoredOverlay.CloseButton",
230
+ type: "button",
231
+ variant: "invisible",
232
+ icon: XIcon,
233
+ ...XButtonAriaLabelledBy ? {
234
+ "aria-labelledby": XButtonAriaLabelledBy,
235
+ "aria-label": void 0
236
+ } : {
237
+ "aria-label": XButtonAriaLabel !== null && XButtonAriaLabel !== void 0 ? XButtonAriaLabel : "Close",
238
+ "aria-labelledby": void 0
239
+ },
240
+ className: clsx(AnchoredOverlay_module_css_default.ResponsiveCloseButton, closeButtonProps.className),
241
+ onClick: () => {
242
+ onClose("close");
243
+ }
244
+ })
245
+ }) : null, children]
246
+ }) : null
247
+ ] });
225
248
  };
226
249
  function getDefaultPosition(anchorElement, overlayElement, fallbackWidth) {
227
250
  const anchorRect = anchorElement.getBoundingClientRect();
@@ -8,8 +8,7 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
8
8
  primer_react_action_list_group_heading_trailing_action: false,
9
9
  primer_react_action_list_item_gap: false,
10
10
  primer_react_timeline_list_semantics: false,
11
- primer_react_merged_forwarded_refs: false,
12
- primer_react_underline_panels_controlled: false
11
+ primer_react_merged_forwarded_refs: false
13
12
  });
14
13
  //#endregion
15
14
  export { DefaultFeatureFlags };
@@ -286,7 +286,7 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
286
286
  const selectedItems = Array.isArray(selected) ? selected : [...selected ? [selected] : []];
287
287
  const selectedValueText = selectedItems.length ? selectedItems.map((item) => item.text).join(", ") : placeholder;
288
288
  const shouldAutoWireLabel = isReferenced === false && Boolean(labelId) && Boolean(selectedValueId);
289
- return (props) => {
289
+ return (props, anchorRef) => {
290
290
  return renderAnchor({
291
291
  ...props,
292
292
  ...shouldAutoWireLabel ? { "aria-labelledby": [labelId, selectedValueId].filter(Boolean).join(" ") } : {},
@@ -294,7 +294,7 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
294
294
  id: selectedValueId,
295
295
  children: selectedValueText
296
296
  }) : selectedValueText
297
- });
297
+ }, anchorRef);
298
298
  };
299
299
  }, [
300
300
  placeholder,
@@ -84,11 +84,11 @@ const ActionMenuBase = (t0) => {
84
84
  }
85
85
  let t5;
86
86
  if ($[14] !== anchorContent || $[15] !== renderAnchor) {
87
- t5 = (props) => renderAnchor({
87
+ t5 = (props, anchorRef_0) => renderAnchor({
88
88
  "aria-label": "menu",
89
89
  children: anchorContent,
90
90
  ...props
91
- });
91
+ }, anchorRef_0);
92
92
  $[14] = anchorContent;
93
93
  $[15] = renderAnchor;
94
94
  $[16] = t5;
@@ -1,5 +1,4 @@
1
1
  import useIsomorphicLayoutEffect from "../../utils/useIsomorphicLayoutEffect.js";
2
- import { useFeatureFlag } from "../../FeatureFlags/useFeatureFlag.js";
3
2
  import { useControllableState } from "../../hooks/useControllableState.js";
4
3
  import { TabsContext } from "./TabsContext.js";
5
4
  import { c } from "react-compiler-runtime";
@@ -14,13 +13,11 @@ import React, { useId } from "react";
14
13
  * The `Tab`, `TabList`, and `TabPanel` components are provided for convenience to showcase the API & implementation.
15
14
  */
16
15
  function Tabs(props) {
17
- var _props$id, _props$activationMode, _props$defaultValue;
18
- const $ = c(16);
16
+ var _props$id, _props$defaultValue;
17
+ const $ = c(13);
19
18
  const { children, onValueChange } = props;
20
19
  const generatedId = useId();
21
20
  const groupId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generatedId;
22
- const controlledApiEnabled = useFeatureFlag("primer_react_underline_panels_controlled");
23
- const activationMode = controlledApiEnabled ? (_props$activationMode = props.activationMode) !== null && _props$activationMode !== void 0 ? _props$activationMode : "automatic" : "automatic";
24
21
  const t0 = (_props$defaultValue = props.defaultValue) !== null && _props$defaultValue !== void 0 ? _props$defaultValue : props.value;
25
22
  let t1;
26
23
  if ($[0] !== props.value || $[1] !== t0) {
@@ -34,60 +31,49 @@ function Tabs(props) {
34
31
  $[2] = t1;
35
32
  } else t1 = $[2];
36
33
  const [selectedValue, setSelectedValue] = useControllableState(t1);
37
- const [focusedValue, setFocusedValue] = React.useState();
38
34
  const savedOnValueChange = React.useRef(onValueChange);
39
35
  let t2;
40
- if ($[3] !== activationMode || $[4] !== controlledApiEnabled || $[5] !== focusedValue || $[6] !== groupId || $[7] !== selectedValue || $[8] !== setSelectedValue) {
36
+ if ($[3] !== groupId || $[4] !== selectedValue || $[5] !== setSelectedValue) {
41
37
  t2 = {
42
38
  groupId,
43
39
  selectedValue,
44
- activationMode,
45
- focusedValue,
46
40
  selectTab(value) {
47
41
  var _savedOnValueChange$c;
48
- setFocusedValue(void 0);
49
- if (controlledApiEnabled && value === selectedValue) return;
50
42
  setSelectedValue(value);
51
43
  (_savedOnValueChange$c = savedOnValueChange.current) === null || _savedOnValueChange$c === void 0 || _savedOnValueChange$c.call(savedOnValueChange, { value });
52
- },
53
- focusTab(value_0) {
54
- setFocusedValue(value_0);
55
44
  }
56
45
  };
57
- $[3] = activationMode;
58
- $[4] = controlledApiEnabled;
59
- $[5] = focusedValue;
60
- $[6] = groupId;
61
- $[7] = selectedValue;
62
- $[8] = setSelectedValue;
63
- $[9] = t2;
64
- } else t2 = $[9];
46
+ $[3] = groupId;
47
+ $[4] = selectedValue;
48
+ $[5] = setSelectedValue;
49
+ $[6] = t2;
50
+ } else t2 = $[6];
65
51
  const contextValue = t2;
66
52
  let t3;
67
53
  let t4;
68
- if ($[10] !== onValueChange) {
54
+ if ($[7] !== onValueChange) {
69
55
  t3 = () => {
70
56
  savedOnValueChange.current = onValueChange;
71
57
  };
72
58
  t4 = [onValueChange];
73
- $[10] = onValueChange;
74
- $[11] = t3;
75
- $[12] = t4;
59
+ $[7] = onValueChange;
60
+ $[8] = t3;
61
+ $[9] = t4;
76
62
  } else {
77
- t3 = $[11];
78
- t4 = $[12];
63
+ t3 = $[8];
64
+ t4 = $[9];
79
65
  }
80
66
  useIsomorphicLayoutEffect(t3, t4);
81
67
  let t5;
82
- if ($[13] !== children || $[14] !== contextValue) {
68
+ if ($[10] !== children || $[11] !== contextValue) {
83
69
  t5 = /*#__PURE__*/ jsx(TabsContext.Provider, {
84
70
  value: contextValue,
85
71
  children
86
72
  });
87
- $[13] = children;
88
- $[14] = contextValue;
89
- $[15] = t5;
90
- } else t5 = $[15];
73
+ $[10] = children;
74
+ $[11] = contextValue;
75
+ $[12] = t5;
76
+ } else t5 = $[12];
91
77
  return t5;
92
78
  }
93
79
  //#endregion
@@ -51,12 +51,6 @@ type CommonTabsProps = {
51
51
  * unique id is generated automatically.
52
52
  */
53
53
  id?: string;
54
- /**
55
- * `'automatic'` (default) selects on focus, so Arrow/Home/End keys select immediately. `'manual'`
56
- * only moves focus; selection commits on Enter/Space/click. Prefer `'manual'` when displaying a
57
- * panel is not instant (e.g. it triggers a network request).
58
- */
59
- activationMode?: 'automatic' | 'manual';
60
54
  };
61
55
  type TabsProps = PropsWithChildren<(ControlledTabsProps | UncontrolledTabsProps) & CommonTabsProps>;
62
56
  type Label = {
@@ -12,7 +12,6 @@ function useTab(props) {
12
12
  const selected = tabs.selectedValue === value;
13
13
  const id = `${tabs.groupId}-tab-${value}`;
14
14
  const panelId = `${tabs.groupId}-panel-${value}`;
15
- const isTabStop = tabs.activationMode === "manual" && tabs.focusedValue !== void 0 ? tabs.focusedValue === value : selected;
16
15
  let t0;
17
16
  if ($[0] !== tabs || $[1] !== value) {
18
17
  t0 = function onKeyDown(event) {
@@ -38,10 +37,6 @@ function useTab(props) {
38
37
  let t2;
39
38
  if ($[7] !== disabled || $[8] !== selected || $[9] !== tabs || $[10] !== value) {
40
39
  t2 = function onFocus() {
41
- if (tabs.activationMode === "manual") {
42
- if (!disabled) tabs.focusTab(value);
43
- return;
44
- }
45
40
  if (!selected && !disabled) tabs.selectTab(value);
46
41
  };
47
42
  $[7] = disabled;
@@ -52,7 +47,7 @@ function useTab(props) {
52
47
  } else t2 = $[11];
53
48
  const onFocus = t2;
54
49
  const t3 = disabled ? true : void 0;
55
- const t4 = isTabStop ? 0 : -1;
50
+ const t4 = selected ? 0 : -1;
56
51
  let t5;
57
52
  if ($[12] !== id || $[13] !== onFocus || $[14] !== onKeyDown || $[15] !== onMouseDown || $[16] !== panelId || $[17] !== selected || $[18] !== t3 || $[19] !== t4) {
58
53
  t5 = { tabProps: {
@@ -5,29 +5,20 @@ import { c } from "react-compiler-runtime";
5
5
  import { useRef } from "react";
6
6
  //#region src/experimental/Tabs/useTabList.ts
7
7
  function useTabList(props) {
8
- const $ = c(10);
8
+ const $ = c(9);
9
9
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
10
10
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
11
- const controlledApiEnabled = useFeatureFlag("primer_react_underline_panels_controlled");
12
11
  const tabListRef = useRef(null);
13
12
  const mergedRef = useMergedRefs(tabListRef, props.ref);
14
13
  const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
15
14
  const readRef = mergedRefEnabled ? tabListRef : providedOrCreatedRef;
16
15
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
17
16
  let t0;
18
- if ($[0] !== ariaOrientation || $[1] !== controlledApiEnabled || $[2] !== readRef) {
17
+ if ($[0] !== ariaOrientation || $[1] !== readRef) {
19
18
  t0 = (event) => {
20
19
  const { current: tablist } = readRef;
21
20
  if (tablist === null) return;
22
21
  const tabs = getFocusableTabs(tablist);
23
- const getCurrentIndex = () => {
24
- if (controlledApiEnabled) {
25
- const activeElement = tablist.ownerDocument.activeElement;
26
- const focusedIndex = activeElement instanceof HTMLElement ? tabs.indexOf(activeElement) : -1;
27
- if (focusedIndex !== -1) return focusedIndex;
28
- }
29
- return tabs.findIndex(_temp);
30
- };
31
22
  const isVertical = ariaOrientation === "vertical";
32
23
  const nextKey = isVertical ? "ArrowDown" : "ArrowRight";
33
24
  const prevKey = isVertical ? "ArrowUp" : "ArrowLeft";
@@ -36,13 +27,13 @@ function useTabList(props) {
36
27
  event.stopPropagation();
37
28
  }
38
29
  if (event.key === nextKey) {
39
- const currentTabIndex = getCurrentIndex();
40
- if (currentTabIndex === -1) return;
41
- tabs[(currentTabIndex + 1) % tabs.length].focus();
30
+ const selectedTabIndex = tabs.findIndex(_temp);
31
+ if (selectedTabIndex === -1) return;
32
+ tabs[(selectedTabIndex + 1) % tabs.length].focus();
42
33
  } else if (event.key === prevKey) {
43
- const currentTabIndex_0 = getCurrentIndex();
44
- if (currentTabIndex_0 === -1) return;
45
- tabs[(tabs.length + currentTabIndex_0 - 1) % tabs.length].focus();
34
+ const selectedTabIndex_0 = tabs.findIndex(_temp2);
35
+ if (selectedTabIndex_0 === -1) return;
36
+ tabs[(tabs.length + selectedTabIndex_0 - 1) % tabs.length].focus();
46
37
  } else if (event.key === "Home") {
47
38
  if (tabs[0]) tabs[0].focus();
48
39
  } else if (event.key === "End") {
@@ -50,14 +41,13 @@ function useTabList(props) {
50
41
  }
51
42
  };
52
43
  $[0] = ariaOrientation;
53
- $[1] = controlledApiEnabled;
54
- $[2] = readRef;
55
- $[3] = t0;
56
- } else t0 = $[3];
44
+ $[1] = readRef;
45
+ $[2] = t0;
46
+ } else t0 = $[2];
57
47
  const onKeyDown = t0;
58
48
  const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
59
49
  let t2;
60
- if ($[4] !== appliedRef || $[5] !== ariaLabel || $[6] !== ariaLabelledby || $[7] !== onKeyDown || $[8] !== t1) {
50
+ if ($[3] !== appliedRef || $[4] !== ariaLabel || $[5] !== ariaLabelledby || $[6] !== onKeyDown || $[7] !== t1) {
61
51
  t2 = { tabListProps: {
62
52
  ref: appliedRef,
63
53
  "aria-label": ariaLabel,
@@ -66,15 +56,18 @@ function useTabList(props) {
66
56
  role: "tablist",
67
57
  onKeyDown
68
58
  } };
69
- $[4] = appliedRef;
70
- $[5] = ariaLabel;
71
- $[6] = ariaLabelledby;
72
- $[7] = onKeyDown;
73
- $[8] = t1;
74
- $[9] = t2;
75
- } else t2 = $[9];
59
+ $[3] = appliedRef;
60
+ $[4] = ariaLabel;
61
+ $[5] = ariaLabelledby;
62
+ $[6] = onKeyDown;
63
+ $[7] = t1;
64
+ $[8] = t2;
65
+ } else t2 = $[8];
76
66
  return t2;
77
67
  }
68
+ function _temp2(tab_0) {
69
+ return tab_0.getAttribute("aria-selected") === "true";
70
+ }
78
71
  function _temp(tab) {
79
72
  return tab.getAttribute("aria-selected") === "true";
80
73
  }
@@ -16,31 +16,6 @@ type UnderlinePanelsProps = {
16
16
  * ID of the element containing the name for the tab list
17
17
  */
18
18
  'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
19
- /**
20
- * The value of the selected tab, keyed to each `UnderlinePanels.Tab`/`UnderlinePanels.Panel`
21
- * `value`. Provide this (with `onChange`) for a controlled component where the selected tab is
22
- * the single source of truth.
23
- */
24
- value?: string;
25
- /**
26
- * The value of the tab that should be selected by default, keyed to each tab's `value`. Use this
27
- * for an uncontrolled component. Cannot be combined with `value`.
28
- */
29
- defaultValue?: string;
30
- /**
31
- * Fires whenever the selected tab changes, for every selection method including arrow keys.
32
- * Unlike `UnderlinePanels.Tab`'s `onSelect`, which only fires on click and Enter/Space.
33
- */
34
- onChange?: ({
35
- value
36
- }: {
37
- value: string;
38
- }) => void;
39
- /**
40
- * `'automatic'` (default) selects on focus/arrow keys; `'manual'` only moves focus until
41
- * Enter/Space/click. Prefer `'manual'` when displaying a panel is not instant.
42
- */
43
- activationMode?: 'automatic' | 'manual';
44
19
  /**
45
20
  * Custom string to use when generating the IDs of tabs and `aria-labelledby` for the panels
46
21
  */
@@ -59,12 +34,6 @@ type UnderlinePanelsProps = {
59
34
  as?: React.ElementType;
60
35
  };
61
36
  type TabProps = PropsWithChildren<{
62
- /**
63
- * A value that uniquely identifies this tab, paired with the `UnderlinePanels.Panel` of the same
64
- * `value`. Provide this to use domain values (e.g. `'branch'`) with the container's controlled
65
- * `value`/`onChange` API. When omitted, tabs and panels are paired by their DOM order.
66
- */
67
- value?: string;
68
37
  /**
69
38
  * Whether this is the selected tab
70
39
  */
@@ -82,13 +51,7 @@ type TabProps = PropsWithChildren<{
82
51
  */
83
52
  icon?: FC<IconProps>;
84
53
  }>;
85
- type PanelProps = React.HTMLAttributes<HTMLDivElement> & {
86
- /**
87
- * A value that uniquely identifies this panel, paired with the `UnderlinePanels.Tab` of the same
88
- * `value`. When omitted, tabs and panels are paired by their DOM order.
89
- */
90
- value?: string;
91
- };
54
+ type PanelProps = React.HTMLAttributes<HTMLDivElement>;
92
55
  declare const _default: React.FC<UnderlinePanelsProps> & SlotMarker & {
93
56
  Panel: FCWithSlotMarker<PanelProps>;
94
57
  Tab: FCWithSlotMarker<TabProps>;