@primer/react 38.34.0-rc.f86dc8614 → 38.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/ActionList/Group.js +1 -1
  3. package/dist/ActionList/List.js +20 -14
  4. package/dist/AnchoredOverlay/AnchoredOverlay.js +6 -3
  5. package/dist/Autocomplete/AutocompleteInput.js +10 -7
  6. package/dist/ButtonGroup/ButtonGroup.js +15 -8
  7. package/dist/Checkbox/Checkbox.js +16 -9
  8. package/dist/Dialog/Dialog.js +12 -5
  9. package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
  10. package/dist/FilteredActionList/FilteredActionList.js +31 -20
  11. package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
  12. package/dist/Link/Link.js +33 -33
  13. package/dist/Overlay/Overlay.js +1 -1
  14. package/dist/PageHeader/PageHeader.js +30 -21
  15. package/dist/SegmentedControl/{SegmentedControl-a004561f.css → SegmentedControl-de65527b.css} +2 -2
  16. package/dist/SegmentedControl/{SegmentedControl-a004561f.css.map → SegmentedControl-de65527b.css.map} +1 -1
  17. package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
  18. package/dist/SegmentedControl/SegmentedControlButton.js +1 -1
  19. package/dist/SegmentedControl/SegmentedControlIconButton.js +1 -1
  20. package/dist/SelectPanel/SelectPanel.js +1 -1
  21. package/dist/TextInput/TextInput.js +13 -6
  22. package/dist/TooltipV2/Tooltip.js +18 -11
  23. package/dist/experimental/Tabs/Tabs.js +3 -2
  24. package/dist/experimental/Tabs/types.d.ts +10 -3
  25. package/dist/experimental/Tabs/useTabList.js +18 -10
  26. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +69 -42
  27. package/dist/experimental/index.js +5 -5
  28. package/dist/hooks/useMergedRefs.d.ts +4 -4
  29. package/dist/hooks/useMergedRefs.js +8 -5
  30. package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
  31. package/dist/hooks/useProvidedRefOrCreate.js +7 -10
  32. package/package.json +1 -2
package/dist/Link/Link.js CHANGED
@@ -8,74 +8,74 @@ import { jsx } from "react/jsx-runtime";
8
8
  import React from "react";
9
9
  //#region src/Link/Link.tsx
10
10
  const UnwrappedLink = (props, ref) => {
11
- const $ = c(19);
11
+ const $ = c(17);
12
12
  let className;
13
- let hoverColor;
14
13
  let inline;
15
14
  let muted;
16
15
  let restProps;
17
16
  let t0;
18
17
  if ($[0] !== props) {
19
- ({as: t0, className, inline, muted, hoverColor, ...restProps} = props);
18
+ const { as: t1, className: t2, inline: t3, muted: t4, hoverColor: _hoverColor, ...t5 } = props;
19
+ t0 = t1;
20
+ className = t2;
21
+ inline = t3;
22
+ muted = t4;
23
+ restProps = t5;
20
24
  $[0] = props;
21
25
  $[1] = className;
22
- $[2] = hoverColor;
23
- $[3] = inline;
24
- $[4] = muted;
25
- $[5] = restProps;
26
- $[6] = t0;
26
+ $[2] = inline;
27
+ $[3] = muted;
28
+ $[4] = restProps;
29
+ $[5] = t0;
27
30
  } else {
28
31
  className = $[1];
29
- hoverColor = $[2];
30
- inline = $[3];
31
- muted = $[4];
32
- restProps = $[5];
33
- t0 = $[6];
32
+ inline = $[2];
33
+ muted = $[3];
34
+ restProps = $[4];
35
+ t0 = $[5];
34
36
  }
35
37
  const Component = t0 === void 0 ? "a" : t0;
36
38
  const innerRef = React.useRef(null);
37
39
  const mergedRef = useMergedRefs(ref, innerRef);
38
40
  let t1;
39
41
  let t2;
40
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
42
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
41
43
  t1 = () => {
42
44
  if (innerRef.current && !(innerRef.current instanceof HTMLButtonElement) && !(innerRef.current instanceof HTMLAnchorElement)) console.error("Error: Found `Link` component that renders an inaccessible element", innerRef.current, "Please ensure `Link` always renders as <a> or <button>");
43
45
  };
44
46
  t2 = [innerRef];
45
- $[7] = t1;
46
- $[8] = t2;
47
+ $[6] = t1;
48
+ $[7] = t2;
47
49
  } else {
48
- t1 = $[7];
49
- t2 = $[8];
50
+ t1 = $[6];
51
+ t2 = $[7];
50
52
  }
51
53
  useDevOnlyEffect(t1, t2);
52
54
  let t3;
53
- if ($[9] !== className) {
55
+ if ($[8] !== className) {
54
56
  t3 = clsx(className, Link_module_css_default.Link);
55
- $[9] = className;
56
- $[10] = t3;
57
- } else t3 = $[10];
57
+ $[8] = className;
58
+ $[9] = t3;
59
+ } else t3 = $[9];
58
60
  const t4 = mergedRef;
59
61
  let t5;
60
- if ($[11] !== Component || $[12] !== hoverColor || $[13] !== inline || $[14] !== muted || $[15] !== restProps || $[16] !== t3 || $[17] !== t4) {
62
+ if ($[10] !== Component || $[11] !== inline || $[12] !== muted || $[13] !== restProps || $[14] !== t3 || $[15] !== t4) {
61
63
  t5 = /*#__PURE__*/ jsx(Component, {
62
64
  className: t3,
63
65
  "data-component": "Link",
64
66
  "data-muted": muted,
65
67
  "data-inline": inline,
66
- "data-hover-color": hoverColor,
67
68
  ...restProps,
68
69
  ref: t4
69
70
  });
70
- $[11] = Component;
71
- $[12] = hoverColor;
72
- $[13] = inline;
73
- $[14] = muted;
74
- $[15] = restProps;
75
- $[16] = t3;
76
- $[17] = t4;
77
- $[18] = t5;
78
- } else t5 = $[18];
71
+ $[10] = Component;
72
+ $[11] = inline;
73
+ $[12] = muted;
74
+ $[13] = restProps;
75
+ $[14] = t3;
76
+ $[15] = t4;
77
+ $[16] = t5;
78
+ } else t5 = $[16];
79
79
  return t5;
80
80
  };
81
81
  const LinkComponent = fixedForwardRef(UnwrappedLink);
@@ -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;
@@ -1,2 +1,2 @@
1
- .prc-SegmentedControl-SegmentedControl-lqIXp{--segmented-control-icon-width:32px;background-color:var(--controlTrack-bgColor-rest,#e6eaef);border:var(--borderWidth-thin,.0625rem) solid var(--controlTrack-borderColor-rest,transparent);border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;font-size:var(--text-body-size-medium,.875rem);height:32px;margin:0;padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]:not([data-full-width-wide=true]),.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);height:28px}.prc-SegmentedControl-DropdownContainer-ZaPMn{display:none}.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant=dropdown]{display:block}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-narrow=dropdown]{display:block}}@media (min-width:48rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-regular=dropdown]{display:block}}@media (min-width:87.5rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-wide=dropdown]{display:block}}.prc-SegmentedControl-Item-tSCQh{display:block;flex-grow:1;margin-bottom:-1px;margin-top:-1px;position:relative}.prc-SegmentedControl-Item-tSCQh:not(:last-child){margin-right:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:var(--borderColor-default,#d1d9e0);bottom:var(--base-size-8,.5rem);content:"";position:absolute;right:calc(var(--base-size-2,.125rem)*-1);top:var(--base-size-8,.5rem);width:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):has(+[data-selected]):after,.prc-SegmentedControl-Item-tSCQh:not(:last-child):where([data-selected]):after{background-color:transparent}.prc-SegmentedControl-Item-tSCQh:first-child{margin-left:-1px}.prc-SegmentedControl-Item-tSCQh:last-child{margin-right:-1px}.prc-SegmentedControl-Item-tSCQh .prc-SegmentedControl-Counter-GmZOI{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-SegmentedControl-Button-E48xz{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:var(--borderRadius-medium,0.375rem);background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:var(--base-text-weight-normal,400);height:100%;padding:var(--segmented-control-button-bg-inset);width:100%}.prc-SegmentedControl-Button-E48xz svg{fill:var(--fgColor-muted,#59636e);color:var(--fgColor-muted,#59636e)}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled):not(:focus-visible){outline:1px solid transparent}.prc-SegmentedControl-Button-E48xz:focus-visible:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:focus-visible:not(:last-child):after{width:0}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-current=true]){background-color:transparent;color:var(--fgColor-disabled,#818b98);cursor:not-allowed}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-current=true]) svg{fill:var(--fgColor-disabled,#818b98);color:var(--fgColor-disabled,#818b98)}@media (pointer:coarse){.prc-SegmentedControl-Button-E48xz:before{content:"";left:0;min-height:44px;position:absolute;right:0;top:50%;transform:translateY(-50%)}}.prc-SegmentedControl-IconButton-tlzDE{width:var(--segmented-control-icon-width,32px)}.prc-SegmentedControl-Content-1COlk{align-items:center;border-color:transparent;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset)/2);border-style:solid;border-width:var(--borderWidth-thin,.0625rem);display:flex;height:100%;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset))}.prc-SegmentedControl-Button-E48xz[aria-current=true]{font-weight:var(--base-text-weight-semibold,600);padding:0}.prc-SegmentedControl-Button-E48xz[aria-current=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--controlKnob-bgColor-rest,#fff);border-color:var(--controlKnob-borderColor-rest,#d1d9e0);border-radius:var(--segmented-control-outer-radius);padding-left:var(--segmented-control-button-inner-padding);padding-right:var(--segmented-control-button-inner-padding)}.prc-SegmentedControl-Button-E48xz:not([aria-current=true],[aria-disabled=true]):hover .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-hover,#e0e6eb)}.prc-SegmentedControl-Button-E48xz:not([aria-current=true],[aria-disabled=true]):active .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-active,#dae0e7)}.prc-SegmentedControl-Text-7S2y2:after{content:attr(data-text);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none;visibility:hidden}.prc-SegmentedControl-LeadingIcon-74n5s{margin-right:var(--base-size-4,.25rem)}
2
- /*# sourceMappingURL=SegmentedControl-a004561f.css.map */
1
+ .prc-SegmentedControl-SegmentedControl-lqIXp{--segmented-control-icon-width:32px;background-color:var(--controlTrack-bgColor-rest,#e6eaef);border:var(--borderWidth-thin,.0625rem) solid var(--controlTrack-borderColor-rest,transparent);border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;font-size:var(--text-body-size-medium,.875rem);height:32px;margin:0;padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]:not([data-full-width-wide=true]),.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);height:28px}.prc-SegmentedControl-DropdownContainer-ZaPMn{display:none}.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant=dropdown]{display:block}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-narrow=dropdown]{display:block}}@media (min-width:48rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-regular=dropdown]{display:block}}@media (min-width:87.5rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-wide=dropdown]{display:block}}.prc-SegmentedControl-Item-tSCQh{display:block;flex-grow:1;margin-bottom:-1px;margin-top:-1px;position:relative}.prc-SegmentedControl-Item-tSCQh:not(:last-child){margin-right:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:var(--borderColor-default,#d1d9e0);bottom:var(--base-size-8,.5rem);content:"";position:absolute;right:calc(var(--base-size-2,.125rem)*-1);top:var(--base-size-8,.5rem);width:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):has(+[data-selected]):after,.prc-SegmentedControl-Item-tSCQh:not(:last-child):where([data-selected]):after{background-color:transparent}.prc-SegmentedControl-Item-tSCQh:first-child{margin-left:-1px}.prc-SegmentedControl-Item-tSCQh:last-child{margin-right:-1px}.prc-SegmentedControl-Item-tSCQh .prc-SegmentedControl-Counter-GmZOI{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-SegmentedControl-Button-E48xz{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:var(--borderRadius-medium,0.375rem);background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:var(--base-text-weight-normal,400);height:100%;padding:var(--segmented-control-button-bg-inset);width:100%}.prc-SegmentedControl-Button-E48xz svg{fill:var(--fgColor-muted,#59636e);color:var(--fgColor-muted,#59636e)}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled):not(:focus-visible){outline:1px solid transparent}.prc-SegmentedControl-Button-E48xz:focus-visible:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:focus-visible:not(:last-child):after{width:0}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-pressed=true]){background-color:transparent;color:var(--fgColor-disabled,#818b98);cursor:not-allowed}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-pressed=true]) svg{fill:var(--fgColor-disabled,#818b98);color:var(--fgColor-disabled,#818b98)}@media (pointer:coarse){.prc-SegmentedControl-Button-E48xz:before{content:"";left:0;min-height:44px;position:absolute;right:0;top:50%;transform:translateY(-50%)}}.prc-SegmentedControl-IconButton-tlzDE{width:var(--segmented-control-icon-width,32px)}.prc-SegmentedControl-Content-1COlk{align-items:center;border-color:transparent;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset)/2);border-style:solid;border-width:var(--borderWidth-thin,.0625rem);display:flex;height:100%;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset))}.prc-SegmentedControl-Button-E48xz[aria-pressed=true]{font-weight:var(--base-text-weight-semibold,600);padding:0}.prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--controlKnob-bgColor-rest,#fff);border-color:var(--controlKnob-borderColor-rest,#d1d9e0);border-radius:var(--segmented-control-outer-radius);padding-left:var(--segmented-control-button-inner-padding);padding-right:var(--segmented-control-button-inner-padding)}.prc-SegmentedControl-Button-E48xz:not([aria-pressed=true],[aria-disabled=true]):hover .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-hover,#e0e6eb)}.prc-SegmentedControl-Button-E48xz:not([aria-pressed=true],[aria-disabled=true]):active .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-active,#dae0e7)}.prc-SegmentedControl-Text-7S2y2:after{content:attr(data-text);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none;visibility:hidden}.prc-SegmentedControl-LeadingIcon-74n5s{margin-right:var(--base-size-4,.25rem)}
2
+ /*# sourceMappingURL=SegmentedControl-de65527b.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AAAA,6CAEE,mCAAoC,CASpC,yDAAkD,CAClD,8FAAuF,CACvF,gDAAyC,CATzC,mBAAoB,CAMpB,8CAAuC,CAHvC,WAAY,CAEZ,QAAS,CADT,SA0HF,CAlHE,mEACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,oEACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CAEA,wCACE,0EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,2EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,yBACE,2EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,4EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,2BACE,wEACE,YAAa,CACb,UAAW,CAEX,mCACF,CASA,qLACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAQA,2KACE,YACF,CAEA,wCAKE,yLACE,YACF,CACF,CAEA,yBAKE,2LACE,YACF,CACF,CAEA,2BAKE,qLACE,YACF,CACF,CAEA,sEAGE,4CAAsC,CADtC,WAEF,CAGF,8CACE,YAwBF,CArBE,qEACE,aACF,CAEA,wCACE,4EACE,aACF,CACF,CAEA,yBACE,6EACE,aACF,CACF,CAEA,2BACE,0EACE,aACF,CACF,CAGF,iCAEE,aAAc,CAKd,WAAY,CADZ,kBAAmB,CAFnB,eAAgB,CAHhB,iBA6CF,CArCE,kDAEE,gBAkBF,CAhBE,wDAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CALX,iBAAkB,CAElB,yCAAoC,CADpC,4BAAuB,CAGvB,SAIF,CAGA,6JAEE,4BACF,CAGF,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAGF,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAW5D,4BAA6B,CAC7B,wBAAyB,CAGzB,mDAAoD,CAFpD,cAAe,CAJf,kBAAmB,CACnB,cAAe,CAJf,mBAAoB,CACpB,iBAAkB,CAClB,8CAA2C,CAL3C,WAAY,CAEZ,gDAAiD,CAHjD,UAmEF,CApDE,uCACE,iCAA0B,CAC1B,kCACF,CAGA,wDAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAOF,CAHE,4EACE,6BACF,CAIF,gEAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAEF,CAGA,8EAEE,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAiBE,kBAAmB,CAVnB,wBAAyB,CASzB,sGAAyG,CARzG,kBAAmB,CACnB,6CAAqC,CARrC,YAAa,CACb,WAAY,CAgBZ,sBAAuB,CAZvB,2GAA4G,CAF5G,4GAeF,CAEA,sDAEE,gDAA6C,CAD7C,SAaF,CAVE,0FAKE,qDAAiD,CACjD,wDAAiD,CAEjD,mDAAoD,CAJpD,0DAA2D,CAF3D,2DAOF,CAIA,2HACE,0DACF,CAEA,4HACE,2DACF,CAGF,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,sCACF","file":"SegmentedControl-a004561f.css","sourcesContent":[".SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n\n display: inline-flex;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-current='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: flex;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-current='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n}\n\n.Button:not([aria-current='true'], [aria-disabled='true']) {\n &:hover .Content {\n background-color: var(--controlTrack-bgColor-hover);\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n margin-right: var(--base-size-4);\n}\n"]}
1
+ {"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AAAA,6CAEE,mCAAoC,CASpC,yDAAkD,CAClD,8FAAuF,CACvF,gDAAyC,CATzC,mBAAoB,CAMpB,8CAAuC,CAHvC,WAAY,CAEZ,QAAS,CADT,SA0HF,CAlHE,mEACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,oEACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CAEA,wCACE,0EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,2EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,yBACE,2EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,4EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,2BACE,wEACE,YAAa,CACb,UAAW,CAEX,mCACF,CASA,qLACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAQA,2KACE,YACF,CAEA,wCAKE,yLACE,YACF,CACF,CAEA,yBAKE,2LACE,YACF,CACF,CAEA,2BAKE,qLACE,YACF,CACF,CAEA,sEAGE,4CAAsC,CADtC,WAEF,CAGF,8CACE,YAwBF,CArBE,qEACE,aACF,CAEA,wCACE,4EACE,aACF,CACF,CAEA,yBACE,6EACE,aACF,CACF,CAEA,2BACE,0EACE,aACF,CACF,CAGF,iCAEE,aAAc,CAKd,WAAY,CADZ,kBAAmB,CAFnB,eAAgB,CAHhB,iBA6CF,CArCE,kDAEE,gBAkBF,CAhBE,wDAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CALX,iBAAkB,CAElB,yCAAoC,CADpC,4BAAuB,CAGvB,SAIF,CAGA,6JAEE,4BACF,CAGF,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAGF,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAW5D,4BAA6B,CAC7B,wBAAyB,CAGzB,mDAAoD,CAFpD,cAAe,CAJf,kBAAmB,CACnB,cAAe,CAJf,mBAAoB,CACpB,iBAAkB,CAClB,8CAA2C,CAL3C,WAAY,CAEZ,gDAAiD,CAHjD,UAmEF,CApDE,uCACE,iCAA0B,CAC1B,kCACF,CAGA,wDAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAOF,CAHE,4EACE,6BACF,CAIF,gEAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAEF,CAGA,8EAEE,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAiBE,kBAAmB,CAVnB,wBAAyB,CASzB,sGAAyG,CARzG,kBAAmB,CACnB,6CAAqC,CARrC,YAAa,CACb,WAAY,CAgBZ,sBAAuB,CAZvB,2GAA4G,CAF5G,4GAeF,CAEA,sDAEE,gDAA6C,CAD7C,SAaF,CAVE,0FAKE,qDAAiD,CACjD,wDAAiD,CAEjD,mDAAoD,CAJpD,0DAA2D,CAF3D,2DAOF,CAIA,2HACE,0DACF,CAEA,4HACE,2DACF,CAGF,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,sCACF","file":"SegmentedControl-de65527b.css","sourcesContent":[".SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n\n display: inline-flex;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-pressed='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: flex;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-pressed='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n}\n\n.Button:not([aria-pressed='true'], [aria-disabled='true']) {\n &:hover .Content {\n background-color: var(--controlTrack-bgColor-hover);\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n margin-right: var(--base-size-4);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import "./SegmentedControl-a004561f.css";
1
+ import "./SegmentedControl-de65527b.css";
2
2
  //#region src/SegmentedControl/SegmentedControl.module.css.js
3
3
  var SegmentedControl_module_css_default = {
4
4
  "SegmentedControl": "prc-SegmentedControl-SegmentedControl-lqIXp",
@@ -126,7 +126,7 @@ const SegmentedControlButton = (t0) => {
126
126
  let t11;
127
127
  if ($[27] !== rest || $[28] !== selected || $[29] !== t10 || $[30] !== t3 || $[31] !== t4) {
128
128
  t11 = /*#__PURE__*/ jsx("button", {
129
- "aria-current": selected,
129
+ "aria-pressed": selected,
130
130
  "aria-disabled": t3,
131
131
  className: t4,
132
132
  type: "button",
@@ -87,7 +87,7 @@ const SegmentedControlIconButton = (t0) => {
87
87
  if ($[20] !== rest || $[21] !== selected || $[22] !== t10 || $[23] !== t5 || $[24] !== t6) {
88
88
  t11 = /*#__PURE__*/ jsx("button", {
89
89
  type: "button",
90
- "aria-current": selected,
90
+ "aria-pressed": selected,
91
91
  "aria-label": t5,
92
92
  "aria-disabled": t6,
93
93
  className: t7,
@@ -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"];
@@ -13,10 +13,11 @@ import React, { useId } from "react";
13
13
  * The `Tab`, `TabList`, and `TabPanel` components are provided for convenience to showcase the API & implementation.
14
14
  */
15
15
  function Tabs(props) {
16
- var _props$defaultValue;
16
+ var _props$id, _props$defaultValue;
17
17
  const $ = c(13);
18
18
  const { children, onValueChange } = props;
19
- const groupId = useId();
19
+ const generatedId = useId();
20
+ const groupId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generatedId;
20
21
  const t0 = (_props$defaultValue = props.defaultValue) !== null && _props$defaultValue !== void 0 ? _props$defaultValue : props.value;
21
22
  let t1;
22
23
  if ($[0] !== props.value || $[1] !== t0) {
@@ -45,7 +45,14 @@ type UncontrolledTabsProps = {
45
45
  value: string;
46
46
  }) => void;
47
47
  };
48
- type TabsProps = PropsWithChildren<ControlledTabsProps | UncontrolledTabsProps>;
48
+ type CommonTabsProps = {
49
+ /**
50
+ * Optional id used as the base for generated tab and panel ids. If omitted, a
51
+ * unique id is generated automatically.
52
+ */
53
+ id?: string;
54
+ };
55
+ type TabsProps = PropsWithChildren<(ControlledTabsProps | UncontrolledTabsProps) & CommonTabsProps>;
49
56
  type Label = {
50
57
  'aria-label': string;
51
58
  };
@@ -73,7 +80,7 @@ type TabPanelProps = {
73
80
  value: string;
74
81
  };
75
82
  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>;
83
+ /** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.Ref<T | null>;
77
84
  };
78
85
  type TabListHookResult<T extends HTMLElement> = {
79
86
  /** Props to be spread onto the tablist element */tabListProps: {
@@ -81,7 +88,7 @@ type TabListHookResult<T extends HTMLElement> = {
81
88
  'aria-orientation': AriaAttributes['aria-orientation'];
82
89
  'aria-label': AriaAttributes['aria-label'];
83
90
  'aria-labelledby': AriaAttributes['aria-labelledby'];
84
- ref: React.RefObject<T | null>;
91
+ ref: React.Ref<T | null>;
85
92
  role: 'tablist';
86
93
  };
87
94
  };
@@ -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];