@primer/react 0.0.0-20260710131543 → 0.0.0-20260710171225
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 +1 -3
- package/dist/ActionList/List.js +45 -46
- package/dist/AnchoredOverlay/AnchoredOverlay.js +4 -2
- package/dist/Autocomplete/AutocompleteInput.js +10 -7
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +5 -4
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FilteredActionList/FilteredActionList.js +7 -5
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/PageHeader/PageHeader.js +33 -34
- package/dist/SegmentedControl/SegmentedControl-a004561f.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-a004561f.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/TextInput/TextInput.js +5 -4
- package/dist/TooltipV2/Tooltip.js +4 -3
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +16 -15
- package/dist/hooks/useMergedRefs.js +4 -1
- package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
- package/dist/hooks/useProvidedRefOrCreate.js +7 -10
- package/package.json +1 -1
- package/dist/SegmentedControl/SegmentedControl-66516913.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-66516913.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260710171225
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -25,8 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
- [#8115](https://github.com/primer/react/pull/8115) [`07c530a`](https://github.com/primer/react/commit/07c530a1686ef16b68b2f2fe692b7a3327bdc02b) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve rendering performance in Safari by removing expensive `:has()` selectors from ActionList/NavList, Breadcrumbs, SelectPanel, and SegmentedControl. No visual or API changes.
|
|
27
27
|
|
|
28
|
-
- [#7903](https://github.com/primer/react/pull/7903) [`6d3da65`](https://github.com/primer/react/commit/6d3da6556c26b40b106e92ffd6b120e66a281deb) Thanks [@mattcosta7](https://github.com/mattcosta7)! - SegmentedControl: improve rendering performance by removing an expensive `:has()` selector used for the inter-item divider. No visual or API changes.
|
|
29
|
-
|
|
30
28
|
- [#8024](https://github.com/primer/react/pull/8024) [`18e3b7d`](https://github.com/primer/react/commit/18e3b7d7a7b54275b99d2562eb279722f5cdd60e) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ToggleSwitch: Fire `onChange` from the user interaction instead of an effect, so it no longer fires on mount or when a controlled `checked` value changes externally.
|
|
31
29
|
|
|
32
30
|
- [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -12,11 +12,11 @@ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
|
12
12
|
import { c } from "react-compiler-runtime";
|
|
13
13
|
import { clsx } from "clsx";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React from "react";
|
|
15
|
+
import React, { useRef } from "react";
|
|
16
16
|
//#region src/ActionList/List.tsx
|
|
17
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
18
18
|
var _slots$heading$props$;
|
|
19
|
-
const $ = c(
|
|
19
|
+
const $ = c(38);
|
|
20
20
|
let className;
|
|
21
21
|
let restProps;
|
|
22
22
|
let role;
|
|
@@ -60,7 +60,8 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
60
60
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
61
61
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
62
62
|
const listRole = role || listRoleFromContainer;
|
|
63
|
-
const listRef =
|
|
63
|
+
const listRef = useRef(null);
|
|
64
|
+
const mergedRef = useMergedRefs(forwardedRef, listRef);
|
|
64
65
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
65
66
|
let enableFocusZone = false;
|
|
66
67
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -79,22 +80,21 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
79
80
|
const t5 = !enableFocusZone;
|
|
80
81
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
|
|
81
82
|
let t7;
|
|
82
|
-
if ($[11] !==
|
|
83
|
+
if ($[11] !== t5 || $[12] !== t6) {
|
|
83
84
|
t7 = {
|
|
84
85
|
disabled: t5,
|
|
85
86
|
containerRef: listRef,
|
|
86
87
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
87
88
|
focusOutBehavior: t6
|
|
88
89
|
};
|
|
89
|
-
$[11] =
|
|
90
|
-
$[12] =
|
|
91
|
-
$[13] =
|
|
92
|
-
|
|
93
|
-
} else t7 = $[14];
|
|
90
|
+
$[11] = t5;
|
|
91
|
+
$[12] = t6;
|
|
92
|
+
$[13] = t7;
|
|
93
|
+
} else t7 = $[13];
|
|
94
94
|
useFocusZone(t7);
|
|
95
95
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
96
96
|
let t9;
|
|
97
|
-
if ($[
|
|
97
|
+
if ($[14] !== headingId || $[15] !== listRole || $[16] !== showDividers || $[17] !== t8 || $[18] !== variant) {
|
|
98
98
|
t9 = {
|
|
99
99
|
variant,
|
|
100
100
|
selectionVariant: t8,
|
|
@@ -102,16 +102,16 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
102
102
|
role: listRole,
|
|
103
103
|
headingId
|
|
104
104
|
};
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t9 = $[
|
|
105
|
+
$[14] = headingId;
|
|
106
|
+
$[15] = listRole;
|
|
107
|
+
$[16] = showDividers;
|
|
108
|
+
$[17] = t8;
|
|
109
|
+
$[18] = variant;
|
|
110
|
+
$[19] = t9;
|
|
111
|
+
} else t9 = $[19];
|
|
112
112
|
const listContextValue = t9;
|
|
113
113
|
let t10;
|
|
114
|
-
if ($[
|
|
114
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
115
115
|
t10 = () => {
|
|
116
116
|
const list = listRef.current;
|
|
117
117
|
if (!list) return;
|
|
@@ -120,25 +120,24 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
120
120
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
121
121
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
122
122
|
};
|
|
123
|
-
$[
|
|
124
|
-
|
|
125
|
-
} else t10 = $[22];
|
|
123
|
+
$[20] = t10;
|
|
124
|
+
} else t10 = $[20];
|
|
126
125
|
useIsomorphicLayoutEffect(t10);
|
|
127
126
|
const t11 = slots.heading;
|
|
128
127
|
let t12;
|
|
129
|
-
if ($[
|
|
128
|
+
if ($[21] !== className) {
|
|
130
129
|
t12 = clsx(ActionList_module_css_default.ActionList, className);
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
} else t12 = $[
|
|
130
|
+
$[21] = className;
|
|
131
|
+
$[22] = t12;
|
|
132
|
+
} else t12 = $[22];
|
|
134
133
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
135
134
|
let t14;
|
|
136
|
-
if ($[
|
|
135
|
+
if ($[23] !== Component || $[24] !== ariaLabelledBy || $[25] !== childrenWithoutSlots || $[26] !== listRole || $[27] !== mergedRef || $[28] !== restProps || $[29] !== showDividers || $[30] !== t12 || $[31] !== t13 || $[32] !== variant) {
|
|
137
136
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
138
137
|
className: t12,
|
|
139
138
|
role: listRole,
|
|
140
139
|
"aria-labelledby": ariaLabelledBy,
|
|
141
|
-
ref:
|
|
140
|
+
ref: mergedRef,
|
|
142
141
|
"data-component": "ActionList",
|
|
143
142
|
"data-dividers": showDividers,
|
|
144
143
|
"data-variant": variant,
|
|
@@ -146,29 +145,29 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
146
145
|
...restProps,
|
|
147
146
|
children: childrenWithoutSlots
|
|
148
147
|
});
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else t14 = $[
|
|
148
|
+
$[23] = Component;
|
|
149
|
+
$[24] = ariaLabelledBy;
|
|
150
|
+
$[25] = childrenWithoutSlots;
|
|
151
|
+
$[26] = listRole;
|
|
152
|
+
$[27] = mergedRef;
|
|
153
|
+
$[28] = restProps;
|
|
154
|
+
$[29] = showDividers;
|
|
155
|
+
$[30] = t12;
|
|
156
|
+
$[31] = t13;
|
|
157
|
+
$[32] = variant;
|
|
158
|
+
$[33] = t14;
|
|
159
|
+
} else t14 = $[33];
|
|
161
160
|
let t15;
|
|
162
|
-
if ($[
|
|
161
|
+
if ($[34] !== listContextValue || $[35] !== slots.heading || $[36] !== t14) {
|
|
163
162
|
t15 = /*#__PURE__*/ jsxs(ListContext.Provider, {
|
|
164
163
|
value: listContextValue,
|
|
165
164
|
children: [t11, t14]
|
|
166
165
|
});
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
} else t15 = $[
|
|
166
|
+
$[34] = listContextValue;
|
|
167
|
+
$[35] = slots.heading;
|
|
168
|
+
$[36] = t14;
|
|
169
|
+
$[37] = t15;
|
|
170
|
+
} else t15 = $[37];
|
|
172
171
|
return t15;
|
|
173
172
|
};
|
|
174
173
|
const List = fixedForwardRef(UnwrappedList);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reactMajorVersion } from "../utils/environment.js";
|
|
2
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
3
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
4
|
import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
|
|
4
5
|
import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
|
|
@@ -33,6 +34,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
33
34
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
34
35
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
35
36
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
37
|
+
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
36
38
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
37
39
|
const anchorId = useId$1(externalAnchorId);
|
|
38
40
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -189,10 +191,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
189
191
|
...shouldRenderAsPopover ? { popover: "manual" } : {},
|
|
190
192
|
...restOverlayProps,
|
|
191
193
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
194
|
+
...cssAnchorPositioning ? { id: popoverId } : {},
|
|
192
195
|
ref: (node) => {
|
|
193
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
194
|
-
updateOverlayRef(node);
|
|
195
196
|
setOverlayElement(node);
|
|
197
|
+
assignRef(mergedOverlayRef, node);
|
|
196
198
|
},
|
|
197
199
|
"data-anchor-position": cssAnchorPositioning,
|
|
198
200
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -20,9 +20,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
20
20
|
if (openOnFocus) setShowMenu(true);
|
|
21
21
|
};
|
|
22
22
|
const handleInputBlur = useCallback((event) => {
|
|
23
|
-
onBlur
|
|
23
|
+
onBlur === null || onBlur === void 0 || onBlur(event);
|
|
24
24
|
safeSetTimeout(() => {
|
|
25
|
-
|
|
25
|
+
const nextFocusedElement = event.relatedTarget;
|
|
26
|
+
const menuElement = document.getElementById(`${id}-listbox`);
|
|
27
|
+
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
26
28
|
setShowMenu(false);
|
|
27
29
|
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
|
|
28
30
|
}
|
|
@@ -33,16 +35,17 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
33
35
|
inputRef,
|
|
34
36
|
safeSetTimeout,
|
|
35
37
|
autocompleteSuggestion,
|
|
36
|
-
inputValue
|
|
38
|
+
inputValue,
|
|
39
|
+
id
|
|
37
40
|
]);
|
|
38
41
|
const handleInputChange = (event) => {
|
|
39
|
-
onChange
|
|
42
|
+
onChange === null || onChange === void 0 || onChange(event);
|
|
40
43
|
setInputValue(event.currentTarget.value);
|
|
41
44
|
if (!showMenu) setShowMenu(true);
|
|
42
45
|
};
|
|
43
46
|
const handleInputKeyDown = useCallback((event) => {
|
|
44
47
|
var _inputRef$current;
|
|
45
|
-
onKeyDown
|
|
48
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
46
49
|
if (event.key === "Backspace") setHighlightRemainingText(false);
|
|
47
50
|
if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
|
48
51
|
setInputValue("");
|
|
@@ -58,11 +61,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
58
61
|
setShowMenu
|
|
59
62
|
]);
|
|
60
63
|
const handleInputKeyUp = useCallback((event) => {
|
|
61
|
-
onKeyUp
|
|
64
|
+
onKeyUp === null || onKeyUp === void 0 || onKeyUp(event);
|
|
62
65
|
if (event.key === "Backspace") setHighlightRemainingText(true);
|
|
63
66
|
}, [setHighlightRemainingText, onKeyUp]);
|
|
64
67
|
const onInputKeyPress = useCallback((event) => {
|
|
65
|
-
onKeyPress
|
|
68
|
+
onKeyPress === null || onKeyPress === void 0 || onKeyPress(event);
|
|
66
69
|
if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
|
|
67
70
|
event.preventDefault();
|
|
68
71
|
event.nativeEvent.stopImmediatePropagation();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
3
3
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
4
4
|
import { c } from "react-compiler-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { useRef } from "react";
|
|
8
8
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
9
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(19);
|
|
11
11
|
let children;
|
|
12
12
|
let className;
|
|
13
13
|
let rest;
|
|
@@ -29,6 +29,8 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
29
29
|
t1 = $[5];
|
|
30
30
|
}
|
|
31
31
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
32
|
+
const buttonRef = useRef(null);
|
|
33
|
+
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
32
34
|
let t2;
|
|
33
35
|
if ($[6] !== children) {
|
|
34
36
|
t2 = React.Children.map(children, _temp);
|
|
@@ -36,45 +38,43 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
36
38
|
$[7] = t2;
|
|
37
39
|
} else t2 = $[7];
|
|
38
40
|
const buttons = t2;
|
|
39
|
-
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
40
41
|
const t3 = role !== "toolbar";
|
|
41
42
|
let t4;
|
|
42
|
-
if ($[8] !==
|
|
43
|
+
if ($[8] !== t3) {
|
|
43
44
|
t4 = {
|
|
44
45
|
containerRef: buttonRef,
|
|
45
46
|
disabled: t3,
|
|
46
47
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
47
48
|
focusOutBehavior: "wrap"
|
|
48
49
|
};
|
|
49
|
-
$[8] =
|
|
50
|
-
$[9] =
|
|
51
|
-
|
|
52
|
-
} else t4 = $[10];
|
|
50
|
+
$[8] = t3;
|
|
51
|
+
$[9] = t4;
|
|
52
|
+
} else t4 = $[9];
|
|
53
53
|
useFocusZone(t4);
|
|
54
54
|
let t5;
|
|
55
|
-
if ($[
|
|
55
|
+
if ($[10] !== className) {
|
|
56
56
|
t5 = clsx(className, ButtonGroup_module_css_default.ButtonGroup);
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t5 = $[
|
|
57
|
+
$[10] = className;
|
|
58
|
+
$[11] = t5;
|
|
59
|
+
} else t5 = $[11];
|
|
60
60
|
let t6;
|
|
61
|
-
if ($[
|
|
61
|
+
if ($[12] !== BaseComponent || $[13] !== buttons || $[14] !== mergedRef || $[15] !== rest || $[16] !== role || $[17] !== t5) {
|
|
62
62
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
63
|
-
ref:
|
|
63
|
+
ref: mergedRef,
|
|
64
64
|
className: t5,
|
|
65
65
|
role,
|
|
66
66
|
...rest,
|
|
67
67
|
"data-component": "ButtonGroup",
|
|
68
68
|
children: buttons
|
|
69
69
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
} else t6 = $[
|
|
70
|
+
$[12] = BaseComponent;
|
|
71
|
+
$[13] = buttons;
|
|
72
|
+
$[14] = mergedRef;
|
|
73
|
+
$[15] = rest;
|
|
74
|
+
$[16] = role;
|
|
75
|
+
$[17] = t5;
|
|
76
|
+
$[18] = t6;
|
|
77
|
+
} else t6 = $[18];
|
|
78
78
|
return t6;
|
|
79
79
|
});
|
|
80
80
|
ButtonGroup.displayName = "ButtonGroup";
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import shared_module_css_default from "./shared.module.css.js";
|
|
4
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
5
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import React, { useContext, useEffect } from "react";
|
|
8
|
+
import React, { useContext, useEffect, useRef } from "react";
|
|
9
9
|
//#region src/Checkbox/Checkbox.tsx
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
12
12
|
*/
|
|
13
13
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
14
|
-
const checkboxRef =
|
|
14
|
+
const checkboxRef = useRef(null);
|
|
15
|
+
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
15
16
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
16
17
|
const handleOnChange = (e) => {
|
|
17
18
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -24,7 +25,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
24
25
|
const inputProps = {
|
|
25
26
|
type: "checkbox",
|
|
26
27
|
disabled,
|
|
27
|
-
ref:
|
|
28
|
+
ref: mergedRef,
|
|
28
29
|
checked: indeterminate ? false : checked,
|
|
29
30
|
defaultChecked,
|
|
30
31
|
required,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
4
3
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
5
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
@@ -244,7 +243,8 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
244
243
|
Footer.displayName = "Dialog.Footer";
|
|
245
244
|
const Buttons = ({ buttons }) => {
|
|
246
245
|
var _buttons$find;
|
|
247
|
-
const autoFocusRef =
|
|
246
|
+
const autoFocusRef = useRef(null);
|
|
247
|
+
const mergedRef = useMergedRefs(autoFocusRef, (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
248
248
|
let autoFocusCount = 0;
|
|
249
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
250
250
|
useEffect(() => {
|
|
@@ -259,7 +259,7 @@ const Buttons = ({ buttons }) => {
|
|
|
259
259
|
"data-component": "Dialog.FooterButton",
|
|
260
260
|
...buttonProps,
|
|
261
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
262
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, mergedRef) : null,
|
|
263
263
|
children: content
|
|
264
264
|
}, index);
|
|
265
265
|
}) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
1
2
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
2
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
@@ -34,8 +34,10 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
34
34
|
}, [onFilterChange, setInternalFilterValue]);
|
|
35
35
|
const inputAndListContainerRef = useRef(null);
|
|
36
36
|
const listRef = useRef(null);
|
|
37
|
-
const scrollContainerRef =
|
|
38
|
-
const
|
|
37
|
+
const scrollContainerRef = useRef(null);
|
|
38
|
+
const combinedScrollContainerRef = useMergedRefs(scrollContainerRef, providedScrollContainerRef);
|
|
39
|
+
const inputRef = useRef(null);
|
|
40
|
+
const combinedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
39
41
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
40
42
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
41
43
|
const activeDescendantRef = useRef();
|
|
@@ -290,7 +292,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
290
292
|
"data-component": "FilteredActionList",
|
|
291
293
|
children: [
|
|
292
294
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
293
|
-
inputRef,
|
|
295
|
+
inputRef: combinedInputRef,
|
|
294
296
|
value: filterValue,
|
|
295
297
|
onInputChange,
|
|
296
298
|
onInputKeyPress,
|
|
@@ -324,7 +326,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
324
326
|
})]
|
|
325
327
|
}),
|
|
326
328
|
/*#__PURE__*/ jsx("div", {
|
|
327
|
-
ref:
|
|
329
|
+
ref: combinedScrollContainerRef,
|
|
328
330
|
className: FilteredActionList_module_css_default.Container,
|
|
329
331
|
children: getBodyContent()
|
|
330
332
|
})
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/FilteredActionList/FilteredActionListInput.d.ts
|
|
5
5
|
interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
6
|
-
inputRef: React.
|
|
6
|
+
inputRef: React.Ref<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { warning } from "../utils/warning.js";
|
|
3
3
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
4
4
|
import { isSlot } from "../utils/is-slot.js";
|
|
@@ -10,7 +10,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
|
|
|
10
10
|
import { c } from "react-compiler-runtime";
|
|
11
11
|
import { clsx } from "clsx";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import React, { useEffect } from "react";
|
|
13
|
+
import React, { useEffect, useRef } from "react";
|
|
14
14
|
import { ArrowLeftIcon } from "@primer/octicons-react";
|
|
15
15
|
//#region src/PageHeader/PageHeader.tsx
|
|
16
16
|
const hiddenOnRegularAndWide = {
|
|
@@ -24,10 +24,11 @@ const hiddenOnNarrow = {
|
|
|
24
24
|
wide: false
|
|
25
25
|
};
|
|
26
26
|
const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
27
|
-
const $ = c(
|
|
27
|
+
const $ = c(16);
|
|
28
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
29
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
30
|
-
const rootRef =
|
|
30
|
+
const rootRef = useRef(null);
|
|
31
|
+
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
31
32
|
const hoistChildState = (nodes) => {
|
|
32
33
|
const result = { hasNavigation: false };
|
|
33
34
|
for (const child of React.Children.toArray(nodes)) {
|
|
@@ -54,7 +55,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
54
55
|
const isInteractive = _temp;
|
|
55
56
|
let t2;
|
|
56
57
|
let t3;
|
|
57
|
-
if ($[0] !== children
|
|
58
|
+
if ($[0] !== children) {
|
|
58
59
|
t2 = function validateInteractiveElementsInTitle() {
|
|
59
60
|
let hasContextArea = false;
|
|
60
61
|
let hasLeadingAction = false;
|
|
@@ -69,29 +70,28 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
69
70
|
};
|
|
70
71
|
t3 = [children, rootRef];
|
|
71
72
|
$[0] = children;
|
|
72
|
-
$[1] =
|
|
73
|
-
$[2] =
|
|
74
|
-
$[3] = t3;
|
|
73
|
+
$[1] = t2;
|
|
74
|
+
$[2] = t3;
|
|
75
75
|
} else {
|
|
76
|
-
t2 = $[
|
|
77
|
-
t3 = $[
|
|
76
|
+
t2 = $[1];
|
|
77
|
+
t3 = $[2];
|
|
78
78
|
}
|
|
79
79
|
useEffect(t2, t3);
|
|
80
80
|
let t4;
|
|
81
|
-
if ($[
|
|
81
|
+
if ($[3] !== className) {
|
|
82
82
|
t4 = clsx(PageHeader_module_css_default.PageHeader, className);
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
} else t4 = $[
|
|
83
|
+
$[3] = className;
|
|
84
|
+
$[4] = t4;
|
|
85
|
+
} else t4 = $[4];
|
|
86
86
|
const t5 = "PageHeader";
|
|
87
87
|
const t6 = hasBorder ? "true" : void 0;
|
|
88
88
|
const t7 = hasNavigation ? "" : void 0;
|
|
89
89
|
const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
|
|
90
90
|
const t9 = getNavHiddenDataAttributes(navigationHidden);
|
|
91
91
|
let t10;
|
|
92
|
-
if ($[
|
|
92
|
+
if ($[5] !== BaseComponent || $[6] !== ariaLabel || $[7] !== children || $[8] !== mergedRef || $[9] !== role || $[10] !== t4 || $[11] !== t6 || $[12] !== t7 || $[13] !== t8 || $[14] !== t9) {
|
|
93
93
|
t10 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
94
|
-
ref:
|
|
94
|
+
ref: mergedRef,
|
|
95
95
|
className: t4,
|
|
96
96
|
"data-component": t5,
|
|
97
97
|
"data-has-border": t6,
|
|
@@ -102,18 +102,18 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
102
102
|
role,
|
|
103
103
|
children
|
|
104
104
|
});
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
105
|
+
$[5] = BaseComponent;
|
|
106
|
+
$[6] = ariaLabel;
|
|
107
|
+
$[7] = children;
|
|
108
|
+
$[8] = mergedRef;
|
|
108
109
|
$[9] = role;
|
|
109
|
-
$[10] =
|
|
110
|
-
$[11] =
|
|
111
|
-
$[12] =
|
|
112
|
-
$[13] =
|
|
113
|
-
$[14] =
|
|
114
|
-
$[15] =
|
|
115
|
-
|
|
116
|
-
} else t10 = $[16];
|
|
110
|
+
$[10] = t4;
|
|
111
|
+
$[11] = t6;
|
|
112
|
+
$[12] = t7;
|
|
113
|
+
$[13] = t8;
|
|
114
|
+
$[14] = t9;
|
|
115
|
+
$[15] = t10;
|
|
116
|
+
} else t10 = $[15];
|
|
117
117
|
return t10;
|
|
118
118
|
});
|
|
119
119
|
const ContextArea = (t0) => {
|
|
@@ -295,7 +295,6 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
295
295
|
const { children, className, hidden: t1, variant: t2 } = t0;
|
|
296
296
|
const hidden = t1 === void 0 ? false : t1;
|
|
297
297
|
const variant = t2 === void 0 ? "medium" : t2;
|
|
298
|
-
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
299
298
|
let t3;
|
|
300
299
|
if ($[0] !== className) {
|
|
301
300
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -315,20 +314,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
315
314
|
$[5] = t5;
|
|
316
315
|
} else t5 = $[5];
|
|
317
316
|
let t6;
|
|
318
|
-
if ($[6] !== children || $[7] !==
|
|
317
|
+
if ($[6] !== children || $[7] !== forwardedRef || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
|
|
319
318
|
t6 = /*#__PURE__*/ jsx("div", {
|
|
320
319
|
className: t3,
|
|
321
|
-
ref:
|
|
320
|
+
ref: forwardedRef,
|
|
322
321
|
"data-component": "TitleArea",
|
|
323
322
|
...t4,
|
|
324
323
|
...t5,
|
|
325
324
|
children
|
|
326
325
|
});
|
|
327
326
|
$[6] = children;
|
|
328
|
-
$[7] =
|
|
329
|
-
$[8] =
|
|
330
|
-
$[9] =
|
|
331
|
-
$[10] =
|
|
327
|
+
$[7] = forwardedRef;
|
|
328
|
+
$[8] = t3;
|
|
329
|
+
$[9] = t4;
|
|
330
|
+
$[10] = t5;
|
|
332
331
|
$[11] = t6;
|
|
333
332
|
} else t6 = $[11];
|
|
334
333
|
return t6;
|
|
@@ -0,0 +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 */
|
|
@@ -0,0 +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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
3
3
|
import Text_default from "../Text/Text.js";
|
|
4
4
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
@@ -11,14 +11,15 @@ import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
|
|
|
11
11
|
import { getCharacterCountState } from "../utils/character-counter.js";
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import React, { useCallback, useId, useState } from "react";
|
|
14
|
+
import React, { useCallback, useId, useRef, useState } from "react";
|
|
15
15
|
import { isValidElementType } from "react-is";
|
|
16
16
|
import { AlertFillIcon } from "@primer/octicons-react";
|
|
17
17
|
//#region src/TextInput/TextInput.tsx
|
|
18
18
|
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
19
|
var _counter$isOverLimit;
|
|
20
20
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
21
|
-
const inputRef =
|
|
21
|
+
const inputRef = useRef(null);
|
|
22
|
+
const mergedRef = useMergedRefs(inputRef, ref);
|
|
22
23
|
const isControlled = value !== void 0;
|
|
23
24
|
const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
|
|
24
25
|
const currentLength = isControlled ? String(value).length : uncontrolledLength;
|
|
@@ -88,7 +89,7 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
|
|
|
88
89
|
children: typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/ jsx(LeadingVisual, {}) : LeadingVisual
|
|
89
90
|
}),
|
|
90
91
|
/*#__PURE__*/ jsx(UnstyledTextInput, {
|
|
91
|
-
ref:
|
|
92
|
+
ref: mergedRef,
|
|
92
93
|
disabled,
|
|
93
94
|
onFocus: handleInputFocus,
|
|
94
95
|
onBlur: handleInputBlur,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
3
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
4
|
import { warning } from "../utils/warning.js";
|
|
@@ -80,7 +80,8 @@ const emptyKeybindingHints = [];
|
|
|
80
80
|
const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
|
|
81
81
|
const tooltipId = useId$1(id);
|
|
82
82
|
const child = Children.only(children);
|
|
83
|
-
const triggerRef =
|
|
83
|
+
const triggerRef = useRef(null);
|
|
84
|
+
const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
|
|
84
85
|
const tooltipElRef = useRef(null);
|
|
85
86
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
86
87
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -157,7 +158,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
157
158
|
return /*#__PURE__*/ jsx(TooltipContext.Provider, {
|
|
158
159
|
value,
|
|
159
160
|
children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
|
|
160
|
-
ref:
|
|
161
|
+
ref: mergedTriggerRef,
|
|
161
162
|
"aria-describedby": (() => {
|
|
162
163
|
if (type !== "description") return child.props["aria-describedby"];
|
|
163
164
|
const existingDescribedBy = child.props["aria-describedby"];
|
|
@@ -73,7 +73,7 @@ type TabPanelProps = {
|
|
|
73
73
|
value: string;
|
|
74
74
|
};
|
|
75
75
|
type TabListHookProps<T extends HTMLElement> = TabListProps & {
|
|
76
|
-
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.
|
|
76
|
+
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.Ref<T | null>;
|
|
77
77
|
};
|
|
78
78
|
type TabListHookResult<T extends HTMLElement> = {
|
|
79
79
|
/** Props to be spread onto the tablist element */tabListProps: {
|
|
@@ -81,7 +81,7 @@ type TabListHookResult<T extends HTMLElement> = {
|
|
|
81
81
|
'aria-orientation': AriaAttributes['aria-orientation'];
|
|
82
82
|
'aria-label': AriaAttributes['aria-label'];
|
|
83
83
|
'aria-labelledby': AriaAttributes['aria-labelledby'];
|
|
84
|
-
ref: React.
|
|
84
|
+
ref: React.Ref<T | null>;
|
|
85
85
|
role: 'tablist';
|
|
86
86
|
};
|
|
87
87
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMergedRefs } from "../../hooks/useMergedRefs.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
3
4
|
//#region src/experimental/Tabs/useTabList.ts
|
|
4
5
|
function useTabList(props) {
|
|
5
|
-
const $ = c(
|
|
6
|
+
const $ = c(8);
|
|
6
7
|
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
|
|
7
|
-
const ref =
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const mergedRef = useMergedRefs(ref, props.ref);
|
|
8
10
|
let t0;
|
|
9
|
-
if ($[0] !== ariaOrientation
|
|
11
|
+
if ($[0] !== ariaOrientation) {
|
|
10
12
|
t0 = (event) => {
|
|
11
13
|
const { current: tablist } = ref;
|
|
12
14
|
if (tablist === null) return;
|
|
@@ -33,28 +35,27 @@ function useTabList(props) {
|
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
$[0] = ariaOrientation;
|
|
36
|
-
$[1] =
|
|
37
|
-
|
|
38
|
-
} else t0 = $[2];
|
|
38
|
+
$[1] = t0;
|
|
39
|
+
} else t0 = $[1];
|
|
39
40
|
const onKeyDown = t0;
|
|
40
41
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
41
42
|
let t2;
|
|
42
|
-
if ($[
|
|
43
|
+
if ($[2] !== ariaLabel || $[3] !== ariaLabelledby || $[4] !== mergedRef || $[5] !== onKeyDown || $[6] !== t1) {
|
|
43
44
|
t2 = { tabListProps: {
|
|
44
|
-
ref,
|
|
45
|
+
ref: mergedRef,
|
|
45
46
|
"aria-label": ariaLabel,
|
|
46
47
|
"aria-labelledby": ariaLabelledby,
|
|
47
48
|
"aria-orientation": t1,
|
|
48
49
|
role: "tablist",
|
|
49
50
|
onKeyDown
|
|
50
51
|
} };
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
52
|
+
$[2] = ariaLabel;
|
|
53
|
+
$[3] = ariaLabelledby;
|
|
54
|
+
$[4] = mergedRef;
|
|
53
55
|
$[5] = onKeyDown;
|
|
54
|
-
$[6] =
|
|
55
|
-
$[7] =
|
|
56
|
-
|
|
57
|
-
} else t2 = $[8];
|
|
56
|
+
$[6] = t1;
|
|
57
|
+
$[7] = t2;
|
|
58
|
+
} else t2 = $[7];
|
|
58
59
|
return t2;
|
|
59
60
|
}
|
|
60
61
|
function _temp2(tab_0) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isExperimentalReactVersion, reactMajorVersion } from "../utils/environment.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import "react";
|
|
3
|
+
import { version } from "react";
|
|
4
4
|
//#region src/hooks/useMergedRefs.ts
|
|
5
|
+
var _version$split$;
|
|
6
|
+
const majorReactVersion = parseInt((_version$split$ = version.split(".")[0]) !== null && _version$split$ !== void 0 ? _version$split$ : "18", 10);
|
|
5
7
|
/**
|
|
6
8
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
7
9
|
* we look to see if current version of React is >= 19 or if it is an
|
|
@@ -48,6 +50,7 @@ function useMergedRefs(refA, refB) {
|
|
|
48
50
|
const cleanupA = setRef(refA, value);
|
|
49
51
|
const cleanupB = setRef(refB, value);
|
|
50
52
|
if (!supportsRefCleanup) return;
|
|
53
|
+
if (majorReactVersion <= 18) return;
|
|
51
54
|
return () => {
|
|
52
55
|
if (cleanupA) cleanupA();
|
|
53
56
|
else setRef(refA, null);
|
|
@@ -9,17 +9,14 @@ import React from "react";
|
|
|
9
9
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
10
10
|
* @type TRef The type of the RefObject which should be created.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
12
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
13
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
14
|
+
* {@linkcode useMergedRefs} instead.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - return <div ref={ref} />
|
|
21
|
-
* + return <div ref={mergedRef} />
|
|
22
|
-
* ```
|
|
16
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
17
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
18
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
19
|
+
* internal element.
|
|
23
20
|
*/
|
|
24
21
|
declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
25
22
|
//#endregion
|
|
@@ -8,17 +8,14 @@ import React from "react";
|
|
|
8
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
9
|
* @type TRef The type of the RefObject which should be created.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
11
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
12
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
13
|
+
* {@linkcode useMergedRefs} instead.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - return <div ref={ref} />
|
|
20
|
-
* + return <div ref={mergedRef} />
|
|
21
|
-
* ```
|
|
15
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
16
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
17
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
18
|
+
* internal element.
|
|
22
19
|
*/
|
|
23
20
|
function useProvidedRefOrCreate(providedRef) {
|
|
24
21
|
const createdRef = React.useRef(null);
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
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(:first-child):before{background-color:var(--borderColor-default,#d1d9e0);bottom:var(--base-size-8,.5rem);content:"";left:0;position:absolute;top:var(--base-size-8,.5rem);width:1px}.prc-SegmentedControl-Item-tSCQh[data-selected]:before{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,.prc-SegmentedControl-Item-tSCQh[data-selected]+.prc-SegmentedControl-Item-tSCQh:before{background-color:transparent}.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);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-66516913.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
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,iBA0DF,CAlDE,kDAEE,gBACF,CAWA,0DAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CAHX,MAAO,CAFP,iBAAkB,CAClB,4BAAuB,CAGvB,SAIF,CAQA,uDACE,4BACF,CAEA,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAaF,2HAHE,4BA4EF,CAzEA,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAY5D,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-66516913.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\n /*\n * Divider is drawn on the LEADING edge of each non-first item (rather than\n * the trailing edge of each non-last item) so the \"hide divider before the\n * selected item\" case can be expressed as a plain adjacent-sibling selector\n * instead of `:has(+ [data-selected])`. Visual position is unchanged: the\n * original `::after` at `right: -2px` (1px wide) on item N sat in the first\n * 1px of item N+1's column (the previous item has `margin-right: 1px`), so\n * the equivalent ::before on item N+1 lives at `left: 0`.\n */\n &:not(:first-child)::before {\n position: absolute;\n top: var(--base-size-8);\n left: 0;\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 /*\n * Hide the divider on the leading edge of the selected item itself. Uses a\n * plain `[data-selected]` (not `:where()`) so specificity matches the divider\n * rule above (0,2,1) and wins by source order; `:where()` would drop to\n * (0,1,1) and lose, leaving the divider visible.\n */\n &[data-selected]::before {\n background-color: transparent;\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/*\n * Hide the divider on the leading edge of the item that immediately follows\n * the selected item. Adjacent-sibling combinator avoids the previous\n * `:has(+ [data-selected])::after` which forced a sibling-direction `:has()`\n * re-evaluation on every selection change.\n */\n.Item[data-selected] + .Item::before {\n background-color: transparent;\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"]}
|