@primer/react 0.0.0-20260714190115 → 0.0.0-20260714202217
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 +3 -13
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionList/Group.js +2 -2
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +17 -11
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +10 -5
- package/dist/Autocomplete/AutocompleteInput.js +10 -7
- package/dist/Autocomplete/AutocompleteMenu.js +2 -3
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -4
- package/dist/ButtonGroup/ButtonGroup.js +12 -5
- package/dist/Checkbox/Checkbox.js +10 -3
- package/dist/Dialog/Dialog.js +10 -3
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +15 -4
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +14 -20
- package/dist/NavList/NavList.js +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +19 -10
- package/dist/PageLayout/PageLayout.js +1 -1
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +10 -3
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/TooltipV2/Tooltip.js +10 -4
- package/dist/TreeView/TreeView.js +3 -6
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -7
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +4 -4
- package/dist/hooks/useAnchoredPosition.js +1 -14
- package/dist/hooks/useDialog.js +1 -2
- package/dist/hooks/useMergedRefs.js +4 -1
- package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
- package/dist/hooks/useProvidedRefOrCreate.js +7 -10
- package/dist/hooks/useScrollFlash.js +1 -2
- package/dist/index.js +4 -4
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/warning.js +2 -3
- package/package.json +2 -2
- package/dist/internal/components/UnderlineTabbedInterface-9aca4eac.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-9aca4eac.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#8064](https://github.com/primer/react/pull/8064) [`eb447fe`](https://github.com/primer/react/commit/eb447fef0f1565934dc38d09df21d8063957aa9d) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update the ActionBar overflow menu anchor label to `More items`
|
|
8
|
-
|
|
9
|
-
- Fake entry to force publishing
|
|
10
|
-
|
|
11
|
-
- [#8116](https://github.com/primer/react/pull/8116) [`cade4af`](https://github.com/primer/react/commit/cade4af9a70f3fd2622031af585dc07dccd79e11) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useAnchoredPosition`: improve performance by caching the scrollable-ancestor walk per anchor, reducing repositioning work for overlays, menus, and tooltips.
|
|
12
|
-
|
|
13
|
-
- [#8164](https://github.com/primer/react/pull/8164) [`928816d`](https://github.com/primer/react/commit/928816d6785d50a7f7fca8d9d146a27f72bea94c) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix `UnderlineNav` tab list not filling the full width of the underline nav in Safari
|
|
14
|
-
|
|
15
|
-
## 38.32.0
|
|
3
|
+
## 0.0.0-20260714202217
|
|
16
4
|
|
|
17
5
|
### Minor Changes
|
|
18
6
|
|
|
@@ -31,6 +19,8 @@
|
|
|
31
19
|
|
|
32
20
|
### Patch Changes
|
|
33
21
|
|
|
22
|
+
- Fake entry to force publishing
|
|
23
|
+
|
|
34
24
|
- [#7901](https://github.com/primer/react/pull/7901) [`8288ed9`](https://github.com/primer/react/commit/8288ed9d88668f93cf3b1eb70ee61edac6217367) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageHeader: improve rendering performance by removing expensive `:has()` selectors. No visual or API changes.
|
|
35
25
|
|
|
36
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.
|
|
@@ -74,7 +74,7 @@ const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-l
|
|
|
74
74
|
})]
|
|
75
75
|
}), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
76
76
|
variant: "invisible",
|
|
77
|
-
"aria-label":
|
|
77
|
+
"aria-label": `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`,
|
|
78
78
|
icon: KebabHorizontalIcon,
|
|
79
79
|
className: ActionBar_module_css_default.MoreButton,
|
|
80
80
|
"data-more-button-inactive": overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true,
|
package/dist/ActionList/Group.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
3
3
|
import { invariant } from "../utils/invariant.js";
|
|
4
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
4
5
|
import { ListContext } from "./shared.js";
|
|
5
6
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
7
|
import Group_module_css_default from "./Group.module.css.js";
|
|
8
8
|
import { GroupHeadingTrailingAction } from "./GroupHeadingTrailingAction.js";
|
|
9
9
|
import { GroupContext } from "./GroupContext.js";
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
3
2
|
import { ConditionalWrapper } from "../internal/components/ConditionalWrapper.js";
|
|
4
3
|
import { invariant } from "../utils/invariant.js";
|
|
5
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
6
5
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
7
6
|
import { TooltipContext } from "../TooltipV2/TooltipContext.js";
|
|
8
7
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
8
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
9
9
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
10
10
|
import { ItemContext, ListContext } from "./shared.js";
|
|
11
11
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
1
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
3
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
|
-
import {
|
|
5
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
6
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
7
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
8
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
7
9
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
8
10
|
import { ListContext } from "./shared.js";
|
|
9
11
|
import { Heading } from "./Heading.js";
|
|
10
12
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
11
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
12
13
|
import { c } from "react-compiler-runtime";
|
|
13
14
|
import { clsx } from "clsx";
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React from "react";
|
|
16
|
+
import React, { useRef } from "react";
|
|
16
17
|
//#region src/ActionList/List.tsx
|
|
17
18
|
const UnwrappedList = (props, forwardedRef) => {
|
|
18
19
|
var _slots$heading$props$;
|
|
@@ -60,7 +61,12 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
60
61
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
61
62
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
62
63
|
const listRole = role || listRoleFromContainer;
|
|
63
|
-
const
|
|
64
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
65
|
+
const internalRef = useRef(null);
|
|
66
|
+
const mergedRef = useMergedRefs(forwardedRef, internalRef);
|
|
67
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
68
|
+
const listRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
69
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
64
70
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
65
71
|
let enableFocusZone = false;
|
|
66
72
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -111,7 +117,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
111
117
|
} else t9 = $[20];
|
|
112
118
|
const listContextValue = t9;
|
|
113
119
|
let t10;
|
|
114
|
-
if ($[21] !== listRef) {
|
|
120
|
+
if ($[21] !== listRef.current) {
|
|
115
121
|
t10 = () => {
|
|
116
122
|
const list = listRef.current;
|
|
117
123
|
if (!list) return;
|
|
@@ -120,7 +126,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
120
126
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
121
127
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
122
128
|
};
|
|
123
|
-
$[21] = listRef;
|
|
129
|
+
$[21] = listRef.current;
|
|
124
130
|
$[22] = t10;
|
|
125
131
|
} else t10 = $[22];
|
|
126
132
|
useIsomorphicLayoutEffect(t10);
|
|
@@ -133,12 +139,12 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
133
139
|
} else t12 = $[24];
|
|
134
140
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
135
141
|
let t14;
|
|
136
|
-
if ($[25] !== Component || $[26] !==
|
|
142
|
+
if ($[25] !== Component || $[26] !== appliedRef || $[27] !== ariaLabelledBy || $[28] !== childrenWithoutSlots || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
|
|
137
143
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
138
144
|
className: t12,
|
|
139
145
|
role: listRole,
|
|
140
146
|
"aria-labelledby": ariaLabelledBy,
|
|
141
|
-
ref:
|
|
147
|
+
ref: appliedRef,
|
|
142
148
|
"data-component": "ActionList",
|
|
143
149
|
"data-dividers": showDividers,
|
|
144
150
|
"data-variant": variant,
|
|
@@ -147,9 +153,9 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
147
153
|
children: childrenWithoutSlots
|
|
148
154
|
});
|
|
149
155
|
$[25] = Component;
|
|
150
|
-
$[26] =
|
|
151
|
-
$[27] =
|
|
152
|
-
$[28] =
|
|
156
|
+
$[26] = appliedRef;
|
|
157
|
+
$[27] = ariaLabelledBy;
|
|
158
|
+
$[28] = childrenWithoutSlots;
|
|
153
159
|
$[29] = listRole;
|
|
154
160
|
$[30] = restProps;
|
|
155
161
|
$[31] = showDividers;
|
|
@@ -2,10 +2,10 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
2
2
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
3
3
|
import { useMenuKeyboardNavigation } from "../hooks/useMenuKeyboardNavigation.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
6
5
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
7
6
|
import { ButtonComponent } from "../Button/Button.js";
|
|
8
7
|
import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
8
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
9
9
|
import { DialogContext } from "../Dialog/DialogContext.js";
|
|
10
10
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
11
11
|
import { Divider } from "../ActionList/Divider.js";
|
|
@@ -1,12 +1,13 @@
|
|
|
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";
|
|
5
6
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
7
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
8
|
import { IconButton } from "../Button/IconButton.js";
|
|
7
9
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
8
10
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
9
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
10
11
|
import Overlay from "../Overlay/Overlay.js";
|
|
11
12
|
import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js";
|
|
12
13
|
import { widthMap } from "../Overlay/constants.js";
|
|
@@ -33,6 +34,8 @@ 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 mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
38
|
+
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
36
39
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
37
40
|
const anchorId = useId$1(externalAnchorId);
|
|
38
41
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -122,8 +125,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
122
125
|
else currentOverlay.style.removeProperty("position-try-fallbacks");
|
|
123
126
|
pendingPositionFrame = requestAnimationFrame(() => {
|
|
124
127
|
pendingPositionFrame = null;
|
|
125
|
-
const
|
|
126
|
-
const result = getDefaultPosition(anchorElement, currentOverlay, fallbackWidth);
|
|
128
|
+
const result = getDefaultPosition(anchorElement, currentOverlay, width ? parseInt(widthMap[width]) : parseInt(widthMap.small));
|
|
127
129
|
currentOverlay.setAttribute("data-align", result.horizontal);
|
|
128
130
|
if (result.suggestedSide) currentOverlay.setAttribute("data-side", result.suggestedSide);
|
|
129
131
|
const offset = result.horizontal === "left" ? result.leftOffset : result.rightOffset;
|
|
@@ -191,9 +193,12 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
191
193
|
...restOverlayProps,
|
|
192
194
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
193
195
|
ref: (node) => {
|
|
194
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
195
|
-
updateOverlayRef(node);
|
|
196
196
|
setOverlayElement(node);
|
|
197
|
+
if (mergedRefEnabled) assignRef(mergedOverlayRef, node);
|
|
198
|
+
else {
|
|
199
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
200
|
+
updateOverlayRef(node);
|
|
201
|
+
}
|
|
197
202
|
},
|
|
198
203
|
"data-anchor-position": cssAnchorPositioning,
|
|
199
204
|
"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();
|
|
@@ -193,11 +193,10 @@ function AutocompleteMenu(props) {
|
|
|
193
193
|
t12 = (current, _previous, directlyActivated) => {
|
|
194
194
|
activeDescendantRef.current = current || null;
|
|
195
195
|
if (current) {
|
|
196
|
-
|
|
196
|
+
setHighlightedItem(allItemsToRenderRef.current.find((item_1) => {
|
|
197
197
|
var _current$closest;
|
|
198
198
|
return item_1.id === ((_current$closest = current.closest("li")) === null || _current$closest === void 0 ? void 0 : _current$closest.getAttribute("data-id"));
|
|
199
|
-
});
|
|
200
|
-
setHighlightedItem(selectedItem);
|
|
199
|
+
}));
|
|
201
200
|
setIsMenuDirectlyActivated(directlyActivated);
|
|
202
201
|
}
|
|
203
202
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) scrollIntoView(current, customScrollContainerRef.current, menuScrollMargins);
|
|
@@ -250,10 +250,7 @@ function Breadcrumbs(t0) {
|
|
|
250
250
|
const measuredContainerWidth = containerElement.offsetWidth;
|
|
251
251
|
setContainerWidth((prev_0) => prev_0 === measuredContainerWidth ? prev_0 : measuredContainerWidth);
|
|
252
252
|
const listElement = containerElement.querySelector("ol");
|
|
253
|
-
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length)
|
|
254
|
-
const widths = Array.from(listElement.children).map(_temp3);
|
|
255
|
-
setChildArrayWidths(widths);
|
|
256
|
-
}
|
|
253
|
+
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) setChildArrayWidths(Array.from(listElement.children).map(_temp3));
|
|
257
254
|
};
|
|
258
255
|
$[3] = childArray.length;
|
|
259
256
|
$[4] = overflow;
|
|
@@ -1,10 +1,12 @@
|
|
|
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 { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
3
5
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
4
6
|
import { c } from "react-compiler-runtime";
|
|
5
7
|
import { clsx } from "clsx";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import React from "react";
|
|
9
|
+
import React, { useRef } from "react";
|
|
8
10
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
9
11
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
10
12
|
const $ = c(20);
|
|
@@ -29,6 +31,12 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
29
31
|
t1 = $[5];
|
|
30
32
|
}
|
|
31
33
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
34
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
35
|
+
const internalRef = useRef(null);
|
|
36
|
+
const mergedRef = useMergedRefs(internalRef, forwardRef);
|
|
37
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
|
|
38
|
+
const buttonRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
39
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
32
40
|
let t2;
|
|
33
41
|
if ($[6] !== children) {
|
|
34
42
|
t2 = React.Children.map(children, _temp);
|
|
@@ -36,7 +44,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
36
44
|
$[7] = t2;
|
|
37
45
|
} else t2 = $[7];
|
|
38
46
|
const buttons = t2;
|
|
39
|
-
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
40
47
|
const t3 = role !== "toolbar";
|
|
41
48
|
let t4;
|
|
42
49
|
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
@@ -58,9 +65,9 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
58
65
|
$[12] = t5;
|
|
59
66
|
} else t5 = $[12];
|
|
60
67
|
let t6;
|
|
61
|
-
if ($[13] !== BaseComponent || $[14] !==
|
|
68
|
+
if ($[13] !== BaseComponent || $[14] !== appliedRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
62
69
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
63
|
-
ref:
|
|
70
|
+
ref: appliedRef,
|
|
64
71
|
className: t5,
|
|
65
72
|
role,
|
|
66
73
|
...rest,
|
|
@@ -68,7 +75,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
68
75
|
children: buttons
|
|
69
76
|
});
|
|
70
77
|
$[13] = BaseComponent;
|
|
71
|
-
$[14] =
|
|
78
|
+
$[14] = appliedRef;
|
|
72
79
|
$[15] = buttons;
|
|
73
80
|
$[16] = rest;
|
|
74
81
|
$[17] = role;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
1
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
3
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
4
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
3
5
|
import shared_module_css_default from "./shared.module.css.js";
|
|
4
6
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
5
7
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
6
8
|
import { clsx } from "clsx";
|
|
7
9
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import React, { useContext, useEffect } from "react";
|
|
10
|
+
import React, { useContext, useEffect, useRef } from "react";
|
|
9
11
|
//#region src/Checkbox/Checkbox.tsx
|
|
10
12
|
/**
|
|
11
13
|
* An accessible, native checkbox component
|
|
12
14
|
*/
|
|
13
15
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
14
|
-
const
|
|
16
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
17
|
+
const internalRef = useRef(null);
|
|
18
|
+
const mergedRef = useMergedRefs(internalRef, ref);
|
|
19
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
20
|
+
const checkboxRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
21
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
15
22
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
16
23
|
const handleOnChange = (e) => {
|
|
17
24
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -24,7 +31,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
24
31
|
const inputProps = {
|
|
25
32
|
type: "checkbox",
|
|
26
33
|
disabled,
|
|
27
|
-
ref:
|
|
34
|
+
ref: appliedRef,
|
|
28
35
|
checked: indeterminate ? false : checked,
|
|
29
36
|
defaultChecked,
|
|
30
37
|
required,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -3,9 +3,10 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
3
3
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
4
4
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
5
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
7
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
8
|
import { ButtonComponent } from "../Button/Button.js";
|
|
9
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
9
10
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
10
11
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
11
12
|
import Portal_default from "../Portal/index.js";
|
|
@@ -244,7 +245,13 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
244
245
|
Footer.displayName = "Dialog.Footer";
|
|
245
246
|
const Buttons = ({ buttons }) => {
|
|
246
247
|
var _buttons$find;
|
|
247
|
-
const
|
|
248
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
249
|
+
const providedButtonRef = (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref;
|
|
250
|
+
const internalRef = useRef(null);
|
|
251
|
+
const mergedRef = useMergedRefs(internalRef, providedButtonRef);
|
|
252
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
|
|
253
|
+
const autoFocusRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
254
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
248
255
|
let autoFocusCount = 0;
|
|
249
256
|
const [hasRendered, setHasRendered] = useState(0);
|
|
250
257
|
useEffect(() => {
|
|
@@ -259,7 +266,7 @@ const Buttons = ({ buttons }) => {
|
|
|
259
266
|
"data-component": "Dialog.FooterButton",
|
|
260
267
|
...buttonProps,
|
|
261
268
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
262
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
269
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, appliedRef) : null,
|
|
263
270
|
children: content
|
|
264
271
|
}, index);
|
|
265
272
|
}) });
|
|
@@ -7,7 +7,8 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
|
7
7
|
primer_react_styled_react_use_primer_theme_providers: false,
|
|
8
8
|
primer_react_action_list_group_heading_trailing_action: false,
|
|
9
9
|
primer_react_action_list_item_gap: false,
|
|
10
|
-
primer_react_timeline_list_semantics: false
|
|
10
|
+
primer_react_timeline_list_semantics: false,
|
|
11
|
+
primer_react_merged_forwarded_refs: false
|
|
11
12
|
});
|
|
12
13
|
//#endregion
|
|
13
14
|
export { DefaultFeatureFlags };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
1
2
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
2
3
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
4
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
4
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
7
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
6
8
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
7
9
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -34,8 +36,17 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
34
36
|
}, [onFilterChange, setInternalFilterValue]);
|
|
35
37
|
const inputAndListContainerRef = useRef(null);
|
|
36
38
|
const listRef = useRef(null);
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
40
|
+
const internalScrollContainerRef = useRef(null);
|
|
41
|
+
const combinedScrollContainerRef = useMergedRefs(internalScrollContainerRef, providedScrollContainerRef);
|
|
42
|
+
const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
43
|
+
const scrollContainerRef = mergedRefEnabled ? internalScrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
44
|
+
const appliedScrollContainerRef = mergedRefEnabled ? combinedScrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
45
|
+
const internalInputRef = useRef(null);
|
|
46
|
+
const combinedInputRef = useMergedRefs(internalInputRef, providedInputRef);
|
|
47
|
+
const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
|
|
48
|
+
const inputRef = mergedRefEnabled ? internalInputRef : providedOrCreatedInputRef;
|
|
49
|
+
const appliedInputRef = mergedRefEnabled ? combinedInputRef : providedOrCreatedInputRef;
|
|
39
50
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
40
51
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
41
52
|
const activeDescendantRef = useRef();
|
|
@@ -290,7 +301,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
290
301
|
"data-component": "FilteredActionList",
|
|
291
302
|
children: [
|
|
292
303
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
293
|
-
inputRef,
|
|
304
|
+
inputRef: appliedInputRef,
|
|
294
305
|
value: filterValue,
|
|
295
306
|
onInputChange,
|
|
296
307
|
onInputKeyPress,
|
|
@@ -324,7 +335,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
324
335
|
})]
|
|
325
336
|
}),
|
|
326
337
|
/*#__PURE__*/ jsx("div", {
|
|
327
|
-
ref:
|
|
338
|
+
ref: appliedScrollContainerRef,
|
|
328
339
|
className: FilteredActionList_module_css_default.Container,
|
|
329
340
|
children: getBodyContent()
|
|
330
341
|
})
|
|
@@ -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>;
|
|
@@ -31,23 +31,20 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
31
31
|
}, [enabled]);
|
|
32
32
|
useEffect(function announceInitialFocus() {
|
|
33
33
|
const focusHandler = () => {
|
|
34
|
-
if (usingRovingTabindex) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
} else window.requestAnimationFrame(() => {
|
|
34
|
+
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
35
|
+
delayMs,
|
|
36
|
+
from: liveRegion ? liveRegion : void 0
|
|
37
|
+
});
|
|
38
|
+
else window.requestAnimationFrame(() => {
|
|
41
39
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
42
40
|
if (!activeItem) return;
|
|
43
41
|
const { index, text, selected } = activeItem;
|
|
44
|
-
|
|
42
|
+
announce$1([
|
|
45
43
|
`Focus on filter text box and list of items`,
|
|
46
44
|
`Focused item: ${text}`,
|
|
47
45
|
`${selected ? "selected" : "not selected"}`,
|
|
48
46
|
`${index + 1} of ${items.length}`
|
|
49
|
-
].join(", ")
|
|
50
|
-
announce$1(announcementText, {
|
|
47
|
+
].join(", "), {
|
|
51
48
|
delayMs,
|
|
52
49
|
from: liveRegion ? liveRegion : void 0
|
|
53
50
|
});
|
|
@@ -73,23 +70,20 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
73
70
|
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
74
71
|
return;
|
|
75
72
|
}
|
|
76
|
-
if (usingRovingTabindex) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
} else window.requestAnimationFrame(() => {
|
|
73
|
+
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
74
|
+
delayMs,
|
|
75
|
+
from: liveRegion ? liveRegion : void 0
|
|
76
|
+
});
|
|
77
|
+
else window.requestAnimationFrame(() => {
|
|
83
78
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
84
79
|
if (!activeItem) return;
|
|
85
80
|
const { index, text, selected } = activeItem;
|
|
86
|
-
|
|
81
|
+
announce$1([
|
|
87
82
|
`List updated`,
|
|
88
83
|
`Focused item: ${text}`,
|
|
89
84
|
`${selected ? "selected" : "not selected"}`,
|
|
90
85
|
`${index + 1} of ${items.length}`
|
|
91
|
-
].join(", ")
|
|
92
|
-
announce$1(announcementText, {
|
|
86
|
+
].join(", "), {
|
|
93
87
|
delayMs,
|
|
94
88
|
from: liveRegion ? liveRegion : void 0
|
|
95
89
|
});
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
4
3
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
5
4
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
5
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
7
7
|
import Heading$1 from "../Heading/Heading.js";
|
|
8
8
|
import ActionList_module_css_default from "../ActionList/ActionList.module.css.js";
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -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,7 +1,9 @@
|
|
|
1
|
+
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
1
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
3
|
import { warning } from "../utils/warning.js";
|
|
3
|
-
import {
|
|
4
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
4
5
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
6
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
5
7
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
6
8
|
import Heading from "../Heading/Heading.js";
|
|
7
9
|
import Link from "../Link/Link.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
|
|
32
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
33
|
+
const internalRef = useRef(null);
|
|
34
|
+
const mergedRef = useMergedRefs(internalRef, forwardedRef);
|
|
35
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
36
|
+
const rootRef = mergedRefEnabled ? internalRef : 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)) {
|
|
@@ -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] !==
|
|
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:
|
|
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] =
|
|
107
|
-
$[8] =
|
|
108
|
-
$[9] =
|
|
109
|
-
$[10] =
|
|
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
|
|
305
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
306
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
307
|
+
const titleAreaRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
|
|
299
308
|
let t3;
|
|
300
309
|
if ($[0] !== className) {
|
|
301
310
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
3
|
import { warning } from "../utils/warning.js";
|
|
4
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
5
4
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
5
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
7
7
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
8
8
|
import PageLayout_module_css_default from "./PageLayout.module.css.js";
|
|
@@ -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
|
|
23
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
24
|
+
const internalRef = useRef(null);
|
|
25
|
+
const mergedRef = useMergedRefs(internalRef, ref);
|
|
26
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
27
|
+
const inputRef = mergedRefEnabled ? internalRef : 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;
|
|
@@ -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:
|
|
98
|
+
ref: appliedRef,
|
|
92
99
|
disabled,
|
|
93
100
|
onFocus: handleInputFocus,
|
|
94
101
|
onBlur: handleInputBlur,
|
|
@@ -12,8 +12,8 @@ import { c } from "react-compiler-runtime";
|
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { useRef, useState } from "react";
|
|
15
|
-
import { isFocusable } from "@primer/behaviors/utils";
|
|
16
15
|
import { FocusKeys } from "@primer/behaviors";
|
|
16
|
+
import { isFocusable } from "@primer/behaviors/utils";
|
|
17
17
|
import { isValidElementType } from "react-is";
|
|
18
18
|
//#region src/TextInputWithTokens/TextInputWithTokens.tsx
|
|
19
19
|
/**
|
|
@@ -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
|
|
85
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
86
|
+
const internalRef = useRef(null);
|
|
87
|
+
const mergedTriggerRef = useMergedRefs(internalRef, forwardedRef);
|
|
88
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
89
|
+
const triggerRef = mergedRefEnabled ? internalRef : 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);
|
|
@@ -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:
|
|
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"];
|
|
@@ -184,13 +191,12 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
184
191
|
(_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event);
|
|
185
192
|
},
|
|
186
193
|
onMouseOverCapture: (event) => {
|
|
187
|
-
const delayTime = delayTimeMap[delay] || 50;
|
|
188
194
|
openTimeoutRef.current = safeSetTimeout(() => {
|
|
189
195
|
var _child$props$onMouseE, _child$props4;
|
|
190
196
|
if (!openTimeoutRef.current) return;
|
|
191
197
|
openTooltip();
|
|
192
198
|
(_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 || _child$props$onMouseE.call(_child$props4, event);
|
|
193
|
-
},
|
|
199
|
+
}, delayTimeMap[delay] || 50);
|
|
194
200
|
},
|
|
195
201
|
onMouseLeave: (event) => {
|
|
196
202
|
var _child$props$onMouseL, _child$props5;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
3
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
4
2
|
import Spinner from "../Spinner/Spinner.js";
|
|
5
3
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
6
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -12,6 +10,8 @@ import useSafeTimeout from "../hooks/useSafeTimeout.js";
|
|
|
12
10
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
13
11
|
import { IconButton } from "../Button/IconButton.js";
|
|
14
12
|
import { ButtonComponent } from "../Button/Button.js";
|
|
13
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
14
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
15
15
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
16
16
|
import { ConfirmationDialog } from "../ConfirmationDialog/ConfirmationDialog.js";
|
|
17
17
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -349,10 +349,7 @@ const SubTree = ({ count, state, children, "aria-label": ariaLabel }) => {
|
|
|
349
349
|
});
|
|
350
350
|
setLoadingFocused(false);
|
|
351
351
|
}
|
|
352
|
-
} else if (state === "loading") {
|
|
353
|
-
const parentName = getAccessibleName(parentElement);
|
|
354
|
-
announceUpdate(`${parentName} content loading`);
|
|
355
|
-
}
|
|
352
|
+
} else if (state === "loading") announceUpdate(`${getAccessibleName(parentElement)} content loading`);
|
|
356
353
|
}, [
|
|
357
354
|
loadingFocused,
|
|
358
355
|
previousState,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
-
import { isSlot } from "../../utils/is-slot.js";
|
|
5
|
-
import { useSlots } from "../../hooks/useSlots.js";
|
|
6
4
|
import Spinner from "../../Spinner/Spinner.js";
|
|
7
5
|
import { AriaStatus } from "../../live-region/AriaStatus.js";
|
|
8
6
|
import { invariant } from "../../utils/invariant.js";
|
|
9
7
|
import { IconButton } from "../../Button/IconButton.js";
|
|
10
8
|
import { ButtonComponent } from "../../Button/Button.js";
|
|
11
9
|
import { useResponsiveValue } from "../../hooks/useResponsiveValue.js";
|
|
10
|
+
import { isSlot } from "../../utils/is-slot.js";
|
|
11
|
+
import { useSlots } from "../../hooks/useSlots.js";
|
|
12
12
|
import { ActionListContainerContext } from "../../ActionList/ActionListContainerContext.js";
|
|
13
13
|
import Heading from "../../Heading/Heading.js";
|
|
14
14
|
import Link from "../../Link/Link.js";
|
|
@@ -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,10 +1,18 @@
|
|
|
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
|
|
10
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
11
|
+
const internalRef = useRef(null);
|
|
12
|
+
const mergedRef = useMergedRefs(internalRef, props.ref);
|
|
13
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
|
|
14
|
+
const ref = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
15
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
8
16
|
let t0;
|
|
9
17
|
if ($[0] !== ariaOrientation || $[1] !== ref) {
|
|
10
18
|
t0 = (event) => {
|
|
@@ -39,19 +47,19 @@ function useTabList(props) {
|
|
|
39
47
|
const onKeyDown = t0;
|
|
40
48
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
41
49
|
let t2;
|
|
42
|
-
if ($[3] !==
|
|
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] =
|
|
52
|
-
$[4] =
|
|
53
|
-
$[5] =
|
|
54
|
-
$[6] =
|
|
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];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useResizeObserver } from "../../hooks/useResizeObserver.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
-
import { isSlot } from "../../utils/is-slot.js";
|
|
5
4
|
import { invariant } from "../../utils/invariant.js";
|
|
5
|
+
import { isSlot } from "../../utils/is-slot.js";
|
|
6
6
|
import { createComponent } from "../../utils/create-component.js";
|
|
7
7
|
import { UnderlineItem, UnderlineItemList, UnderlineWrapper } from "../../internal/components/UnderlineTabbedInterface.js";
|
|
8
8
|
import UnderlinePanels_module_css_default from "./UnderlinePanels.module.css.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
3
2
|
import { Announce } from "../live-region/Announce.js";
|
|
4
3
|
import { AriaAlert } from "../live-region/AriaAlert.js";
|
|
5
4
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
6
5
|
import { ButtonBase } from "../Button/ButtonBase.js";
|
|
6
|
+
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
7
|
+
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
8
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
9
|
import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
|
|
8
10
|
import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
|
|
9
11
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
12
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
10
13
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
11
14
|
import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
|
|
12
15
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
13
|
-
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
14
|
-
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
15
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
16
16
|
import { Stack } from "../Stack/index.js";
|
|
17
17
|
import { SkeletonBox } from "../Skeleton/SkeletonBox.js";
|
|
18
18
|
import { FilteredActionListLoadingTypes } from "../FilteredActionList/constants.js";
|
|
@@ -106,10 +106,6 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
106
106
|
}, [updatePosition]);
|
|
107
107
|
useResizeObserver(updatePosition, void 0, [], enabled);
|
|
108
108
|
useResizeObserver(updatePosition, floatingElementRef, [], enabled);
|
|
109
|
-
const scrollAncestorsCacheRef = React.useRef({
|
|
110
|
-
anchor: null,
|
|
111
|
-
scrollables: []
|
|
112
|
-
});
|
|
113
109
|
React.useEffect(() => {
|
|
114
110
|
if (!enabled) return;
|
|
115
111
|
const anchorEl = anchorElementRef.current;
|
|
@@ -122,16 +118,7 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
122
118
|
updatePosition();
|
|
123
119
|
});
|
|
124
120
|
};
|
|
125
|
-
const
|
|
126
|
-
let scrollables;
|
|
127
|
-
if (cache.anchor === anchorEl) scrollables = cache.scrollables;
|
|
128
|
-
else {
|
|
129
|
-
scrollables = getScrollableAncestors(anchorEl);
|
|
130
|
-
scrollAncestorsCacheRef.current = {
|
|
131
|
-
anchor: anchorEl,
|
|
132
|
-
scrollables
|
|
133
|
-
};
|
|
134
|
-
}
|
|
121
|
+
const scrollables = getScrollableAncestors(anchorEl);
|
|
135
122
|
for (const scrollable of scrollables) scrollable.addEventListener("scroll", handleScroll);
|
|
136
123
|
return () => {
|
|
137
124
|
for (const scrollable of scrollables) scrollable.removeEventListener("scroll", handleScroll);
|
package/dist/hooks/useDialog.js
CHANGED
|
@@ -91,8 +91,7 @@ function useDialog(t0) {
|
|
|
91
91
|
let t8;
|
|
92
92
|
if ($[15] !== getFocusableItem) {
|
|
93
93
|
t8 = (e_1) => {
|
|
94
|
-
const
|
|
95
|
-
const focusableItem_0 = getFocusableItem(e_1, movement_0);
|
|
94
|
+
const focusableItem_0 = getFocusableItem(e_1, e_1.shiftKey ? -1 : 1);
|
|
96
95
|
if (!focusableItem_0) return;
|
|
97
96
|
focusableItem_0.focus();
|
|
98
97
|
};
|
|
@@ -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);
|
|
@@ -15,8 +15,7 @@ function useScrollFlash(scrollContainerRef) {
|
|
|
15
15
|
if (!scrollContainer) return;
|
|
16
16
|
const id = requestAnimationFrame(() => {
|
|
17
17
|
const currentScroll = scrollContainer.scrollTop;
|
|
18
|
-
|
|
19
|
-
scrollContainer.scrollTop = altScroll;
|
|
18
|
+
scrollContainer.scrollTop = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
|
|
20
19
|
scrollContainer.scrollTop = currentScroll;
|
|
21
20
|
});
|
|
22
21
|
return () => cancelAnimationFrame(id);
|
package/dist/index.js
CHANGED
|
@@ -9,15 +9,12 @@ import { VisuallyHidden } from "./VisuallyHidden/VisuallyHidden.js";
|
|
|
9
9
|
import { useOnOutsideClick } from "./hooks/useOnOutsideClick.js";
|
|
10
10
|
import { useProvidedRefOrCreate } from "./hooks/useProvidedRefOrCreate.js";
|
|
11
11
|
import { useOnEscapePress } from "./hooks/useOnEscapePress.js";
|
|
12
|
-
import { useOpenAndCloseFocus } from "./hooks/useOpenAndCloseFocus.js";
|
|
13
12
|
import useIsomorphicLayoutEffect from "./utils/useIsomorphicLayoutEffect.js";
|
|
14
13
|
import { useResizeObserver } from "./hooks/useResizeObserver.js";
|
|
15
14
|
import { useAnchoredPosition } from "./hooks/useAnchoredPosition.js";
|
|
15
|
+
import { useOpenAndCloseFocus } from "./hooks/useOpenAndCloseFocus.js";
|
|
16
16
|
import { useOverlay } from "./hooks/useOverlay.js";
|
|
17
|
-
import { useRefObjectAsForwardedRef } from "./hooks/useRefObjectAsForwardedRef.js";
|
|
18
17
|
import { useId } from "./hooks/useId.js";
|
|
19
|
-
import { isSlot } from "./utils/is-slot.js";
|
|
20
|
-
import { useSlots } from "./hooks/useSlots.js";
|
|
21
18
|
import Spinner from "./Spinner/Spinner.js";
|
|
22
19
|
import CounterLabel from "./CounterLabel/CounterLabel.js";
|
|
23
20
|
import { ButtonBase } from "./Button/ButtonBase.js";
|
|
@@ -28,6 +25,8 @@ import { IconButton } from "./Button/IconButton.js";
|
|
|
28
25
|
import { LinkButton } from "./Button/LinkButton.js";
|
|
29
26
|
import { ButtonComponent } from "./Button/Button.js";
|
|
30
27
|
import { useResponsiveValue } from "./hooks/useResponsiveValue.js";
|
|
28
|
+
import { isSlot } from "./utils/is-slot.js";
|
|
29
|
+
import { useSlots } from "./hooks/useSlots.js";
|
|
31
30
|
import { PageLayout } from "./PageLayout/PageLayout.js";
|
|
32
31
|
import { SplitPageLayout } from "./SplitPageLayout/SplitPageLayout.js";
|
|
33
32
|
import useDetails from "./hooks/useDetails.js";
|
|
@@ -39,6 +38,7 @@ import Portal_default from "./Portal/index.js";
|
|
|
39
38
|
import { Dialog } from "./Dialog/Dialog.js";
|
|
40
39
|
import { ConfirmationDialog } from "./ConfirmationDialog/ConfirmationDialog.js";
|
|
41
40
|
import { useConfirm } from "./ConfirmationDialog/useConfirm.js";
|
|
41
|
+
import { useRefObjectAsForwardedRef } from "./hooks/useRefObjectAsForwardedRef.js";
|
|
42
42
|
import { createComponent } from "./utils/create-component.js";
|
|
43
43
|
import { asSlot } from "./utils/as-slot.js";
|
|
44
44
|
import Radio from "./Radio/Radio.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../../../hooks/useId.js";
|
|
2
|
-
import { useSlots } from "../../../hooks/useSlots.js";
|
|
3
2
|
import VisuallyHidden from "../../../_VisuallyHidden.js";
|
|
3
|
+
import { useSlots } from "../../../hooks/useSlots.js";
|
|
4
4
|
import ValidationAnimationContainer from "../ValidationAnimationContainer.js";
|
|
5
5
|
import CheckboxOrRadioGroupContext from "./CheckboxOrRadioGroupContext.js";
|
|
6
6
|
import CheckboxOrRadioGroup_module_css_default from "./CheckboxOrRadioGroup.module.css.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-components-UnderlineWrapper-eT-Yj{align-items:flex-start;box-shadow:inset 0 -1px var(--borderColor-muted,#d1d9e0b3);display:flex;justify-content:flex-start;min-height:var(--control-xlarge-size,3rem);padding-top:var(--base-size-8,.5rem);padding-inline:var(--stack-padding-normal,1rem)}.prc-components-UnderlineWrapper-eT-Yj[data-variant=flush]{padding-inline:unset}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-mode=wrap]{max-height:var(--control-xlarge-size,3rem);overflow:hidden}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-mode=wrap] .prc-components-UnderlineItemList-xKlKC{flex-wrap:wrap;overflow:hidden}.prc-components-UnderlineItemList-xKlKC{display:flex;gap:var(--stack-gap-condensed,.5rem);list-style:none;margin:0;padding:0;white-space:nowrap}.prc-components-UnderlineItem-7fP-n,.prc-components-UnderlineItemList-xKlKC{align-items:center;position:relative}.prc-components-UnderlineItem-7fP-n{appearance:none;background-color:transparent;border:0;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);height:32px;line-height:var(--text-body-lineHeight-medium,1.4285);margin-bottom:var(--base-size-8,.5rem);max-width:100%;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem);text-align:center;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.prc-components-UnderlineItem-7fP-n:hover{background-color:var(--bgColor-neutral-muted,#818b981f);-webkit-text-decoration:none;text-decoration:none;transition:background-color .12s ease-out}}.prc-components-UnderlineItem-7fP-n:focus{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n:focus:not(:focus-visible){box-shadow:none}.prc-components-UnderlineItem-7fP-n:focus-visible{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=icon]{align-items:center;color:var(--fgColor-muted,#59636e);display:inline-flex;margin-inline-end:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n [data-component=text]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=counter]{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n:after{background-color:transparent;content:"";height:2px;inset:auto 0 0;margin-bottom:calc(var(--base-size-8,.5rem)*-1);pointer-events:none;position:absolute}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]) [data-component=text],.prc-components-UnderlineItem-7fP-n[aria-selected=true] [data-component=text]{font-weight:var(--base-text-weight-semibold,600)}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73))}@media (forced-colors:active){.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:LinkText}}.prc-components-LoadingCounter-dBuLy{animation:prc-components-loadingCounterKeyFrames-8tMlf 1.2s ease-in-out infinite alternate;background-color:var(--bgColor-neutral-muted,#818b981f);border-color:var(--borderColor-default,#d1d9e0);border-radius:20px;display:inline-block;height:1rem;width:1.5rem}@keyframes prc-components-loadingCounterKeyFrames-8tMlf{0%{opacity:1}to{opacity:.2}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineTabbedInterface-25587345.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAME,sBAAuB,CAOvB,0DAAiD,CAZjD,YAAa,CAIb,0BAA2B,CAI3B,0CAAsC,CAPtC,oCAA+B,CAE/B,+CA0BF,CAfE,2DAEE,oBACF,CAEA,gEAGE,0CAAsC,CADtC,eAOF,CAJE,wGACE,cAAe,CACf,eACF,CAIJ,wCAEE,YAAa,CAMb,oCAA+B,CAF/B,eAAgB,CAFhB,QAAS,CADT,SAAU,CAEV,kBAIF,CAEA,4EAJE,kBAAmB,CANnB,iBAyCF,CA/BA,oCAmBE,eAAgB,CARhB,4BAA6B,CAC7B,QAAS,CACT,gDAAyC,CANzC,oCAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CAWvC,WAAY,CAVZ,qDAAuD,CASvD,sCAAiC,CADjC,cAAe,CAOf,wCAAiC,CADjC,uCAAkC,CAZlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAsBF,CAPE,qBACE,0CAEE,uDAA8C,CAD9C,4BAAqB,CAArB,oBAAqB,CAErB,yCACF,CACF,CAGF,0CAGE,wDAAiD,CAFjD,6BAQF,CAHE,8DACE,eACF,CAGF,kDAGE,wDAAiD,CAFjD,6BAGF,CAGA,0DAME,0BAA2B,CAL3B,aAAc,CAEd,gDAA6C,CAD7C,QAAS,CAGT,iBAAkB,CADlB,kBAGF,CAEA,0DAGE,kBAAmB,CADnB,kCAA2B,CAD3B,mBAAoB,CAGpB,0CACF,CAGA,0DACE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAEA,6DAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAEA,0CAOE,4BAA6B,CAD7B,UAAW,CAFX,UAAW,CAFX,cAAe,CACf,+CAA4C,CAE5C,mBAAoB,CAJpB,iBAOF,CAEA,gLAEE,gDACF,CAEA,gJAGE,iGAMF,CAJE,8BALF,gJAOI,yBAEJ,CADE,CAGF,qCASE,0FAAsE,CAJtE,uDAA8C,CAC9C,+CAAwC,CAExC,kBAAmB,CAPnB,oBAAqB,CAErB,WAAY,CADZ,YAQF,CAEA,wDACE,GACE,SACF,CAEA,GACE,UACF,CACF","file":"UnderlineTabbedInterface-25587345.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n padding-top: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n justify-content: flex-start;\n align-items: flex-start;\n\n /* make space for the underline */\n min-height: var(--control-xlarge-size);\n\n /* using a box-shadow instead of a border to accommodate 'overflow-y: hidden' on UnderlinePanels */\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 -1px var(--borderColor-muted);\n\n &[data-variant='flush'] {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: unset;\n }\n\n &[data-overflow-mode='wrap'] {\n /* Wrap items onto hidden next lines */\n overflow: hidden;\n max-height: var(--control-xlarge-size);\n\n .UnderlineItemList {\n flex-wrap: wrap;\n overflow: hidden;\n }\n }\n}\n\n.UnderlineItemList {\n position: relative;\n display: flex;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.UnderlineItem {\n /* underline tab specific styles */\n position: relative;\n display: inline-flex;\n font: inherit;\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n color: var(--fgColor-default);\n text-align: center;\n text-decoration: none;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--borderRadius-medium);\n max-width: 100%;\n margin-bottom: var(--base-size-8);\n height: 32px;\n\n /* button resets */\n appearance: none;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n align-items: center;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: none;\n background-color: var(--bgColor-neutral-muted);\n transition: background-color 0.12s ease-out;\n }\n }\n}\n\n.UnderlineItem:focus {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n\n /* where focus-visible is supported, remove the focus box-shadow */\n &:not(:focus-visible) {\n box-shadow: none;\n }\n}\n\n.UnderlineItem:focus-visible {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n}\n\n/* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n.UnderlineItem [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold);\n white-space: nowrap;\n visibility: hidden;\n content: attr(data-content);\n}\n\n.UnderlineItem [data-component='icon'] {\n display: inline-flex;\n color: var(--fgColor-muted);\n align-items: center;\n margin-inline-end: var(--base-size-8);\n}\n\n/* Truncate items if necessary (should only ever apply to the last item after everything else overflows) */\n.UnderlineItem [data-component='text'] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.UnderlineItem [data-component='counter'] {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n}\n\n.UnderlineItem::after {\n position: absolute;\n inset: auto 0 0;\n margin-bottom: calc(-1 * var(--base-size-8));\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'],\n.UnderlineItem[aria-selected='true'] [data-component='text'] {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false'])::after,\n.UnderlineItem[aria-selected='true']::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n}\n\n.LoadingCounter {\n display: inline-block;\n width: 1.5rem;\n height: 1rem;\n /* 16px */\n background-color: var(--bgColor-neutral-muted);\n border-color: var(--borderColor-default);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 20px;\n animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate;\n}\n\n@keyframes loadingCounterKeyFrames {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0.2;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./UnderlineTabbedInterface-
|
|
1
|
+
import "./UnderlineTabbedInterface-25587345.css";
|
|
2
2
|
//#region src/internal/components/UnderlineTabbedInterface.module.css.js
|
|
3
3
|
var UnderlineTabbedInterface_module_css_default = {
|
|
4
4
|
"UnderlineWrapper": "prc-components-UnderlineWrapper-eT-Yj",
|
package/dist/utils/warning.js
CHANGED
|
@@ -5,10 +5,9 @@ const warn = function warn(message) {
|
|
|
5
5
|
const warning = function warning(condition, format, ...args) {
|
|
6
6
|
if (condition) {
|
|
7
7
|
let index = 0;
|
|
8
|
-
|
|
8
|
+
warn(format.replace(/%s/g, () => {
|
|
9
9
|
return args[index++];
|
|
10
|
-
});
|
|
11
|
-
warn(message);
|
|
10
|
+
}));
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260714202217",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"react-is": "18.3.1",
|
|
170
170
|
"recast": "0.23.7",
|
|
171
171
|
"rimraf": "5.0.5",
|
|
172
|
-
"rolldown": "^1.1.
|
|
172
|
+
"rolldown": "^1.1.2",
|
|
173
173
|
"rolldown-plugin-dts": "^0.26.0",
|
|
174
174
|
"rolldown-plugin-import-css": "^0.0.0",
|
|
175
175
|
"rolldown-plugin-preserve-directives": "^0.0.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-components-UnderlineWrapper-eT-Yj{align-items:flex-start;box-shadow:inset 0 -1px var(--borderColor-muted,#d1d9e0b3);display:flex;justify-content:flex-start;min-height:var(--control-xlarge-size,3rem);padding-top:var(--base-size-8,.5rem);padding-inline:var(--stack-padding-normal,1rem)}.prc-components-UnderlineWrapper-eT-Yj[data-variant=flush]{padding-inline:unset}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-mode=wrap]{max-height:var(--control-xlarge-size,3rem);overflow:hidden}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-mode=wrap] .prc-components-UnderlineItemList-xKlKC{flex-grow:1;flex-wrap:wrap;overflow:hidden}.prc-components-UnderlineItemList-xKlKC{display:flex;gap:var(--stack-gap-condensed,.5rem);list-style:none;margin:0;padding:0;white-space:nowrap}.prc-components-UnderlineItem-7fP-n,.prc-components-UnderlineItemList-xKlKC{align-items:center;position:relative}.prc-components-UnderlineItem-7fP-n{appearance:none;background-color:transparent;border:0;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);height:32px;line-height:var(--text-body-lineHeight-medium,1.4285);margin-bottom:var(--base-size-8,.5rem);max-width:100%;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem);text-align:center;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.prc-components-UnderlineItem-7fP-n:hover{background-color:var(--bgColor-neutral-muted,#818b981f);-webkit-text-decoration:none;text-decoration:none;transition:background-color .12s ease-out}}.prc-components-UnderlineItem-7fP-n:focus{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n:focus:not(:focus-visible){box-shadow:none}.prc-components-UnderlineItem-7fP-n:focus-visible{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=icon]{align-items:center;color:var(--fgColor-muted,#59636e);display:inline-flex;margin-inline-end:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n [data-component=text]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=counter]{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n:after{background-color:transparent;content:"";height:2px;inset:auto 0 0;margin-bottom:calc(var(--base-size-8,.5rem)*-1);pointer-events:none;position:absolute}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]) [data-component=text],.prc-components-UnderlineItem-7fP-n[aria-selected=true] [data-component=text]{font-weight:var(--base-text-weight-semibold,600)}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73))}@media (forced-colors:active){.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:LinkText}}.prc-components-LoadingCounter-dBuLy{animation:prc-components-loadingCounterKeyFrames-8tMlf 1.2s ease-in-out infinite alternate;background-color:var(--bgColor-neutral-muted,#818b981f);border-color:var(--borderColor-default,#d1d9e0);border-radius:20px;display:inline-block;height:1rem;width:1.5rem}@keyframes prc-components-loadingCounterKeyFrames-8tMlf{0%{opacity:1}to{opacity:.2}}
|
|
2
|
-
/*# sourceMappingURL=UnderlineTabbedInterface-9aca4eac.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAME,sBAAuB,CAOvB,0DAAiD,CAZjD,YAAa,CAIb,0BAA2B,CAI3B,0CAAsC,CAPtC,oCAA+B,CAE/B,+CA2BF,CAhBE,2DAEE,oBACF,CAEA,gEAGE,0CAAsC,CADtC,eAQF,CALE,wGACE,WAAY,CACZ,cAAe,CACf,eACF,CAIJ,wCAEE,YAAa,CAMb,oCAA+B,CAF/B,eAAgB,CAFhB,QAAS,CADT,SAAU,CAEV,kBAIF,CAEA,4EAJE,kBAAmB,CANnB,iBAyCF,CA/BA,oCAmBE,eAAgB,CARhB,4BAA6B,CAC7B,QAAS,CACT,gDAAyC,CANzC,oCAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CAWvC,WAAY,CAVZ,qDAAuD,CASvD,sCAAiC,CADjC,cAAe,CAOf,wCAAiC,CADjC,uCAAkC,CAZlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAsBF,CAPE,qBACE,0CAEE,uDAA8C,CAD9C,4BAAqB,CAArB,oBAAqB,CAErB,yCACF,CACF,CAGF,0CAGE,wDAAiD,CAFjD,6BAQF,CAHE,8DACE,eACF,CAGF,kDAGE,wDAAiD,CAFjD,6BAGF,CAGA,0DAME,0BAA2B,CAL3B,aAAc,CAEd,gDAA6C,CAD7C,QAAS,CAGT,iBAAkB,CADlB,kBAGF,CAEA,0DAGE,kBAAmB,CADnB,kCAA2B,CAD3B,mBAAoB,CAGpB,0CACF,CAGA,0DACE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAEA,6DAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAEA,0CAOE,4BAA6B,CAD7B,UAAW,CAFX,UAAW,CAFX,cAAe,CACf,+CAA4C,CAE5C,mBAAoB,CAJpB,iBAOF,CAEA,gLAEE,gDACF,CAEA,gJAGE,iGAMF,CAJE,8BALF,gJAOI,yBAEJ,CADE,CAGF,qCASE,0FAAsE,CAJtE,uDAA8C,CAC9C,+CAAwC,CAExC,kBAAmB,CAPnB,oBAAqB,CAErB,WAAY,CADZ,YAQF,CAEA,wDACE,GACE,SACF,CAEA,GACE,UACF,CACF","file":"UnderlineTabbedInterface-9aca4eac.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n padding-top: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n justify-content: flex-start;\n align-items: flex-start;\n\n /* make space for the underline */\n min-height: var(--control-xlarge-size);\n\n /* using a box-shadow instead of a border to accommodate 'overflow-y: hidden' on UnderlinePanels */\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 -1px var(--borderColor-muted);\n\n &[data-variant='flush'] {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: unset;\n }\n\n &[data-overflow-mode='wrap'] {\n /* Wrap items onto hidden next lines */\n overflow: hidden;\n max-height: var(--control-xlarge-size);\n\n .UnderlineItemList {\n flex-grow: 1;\n flex-wrap: wrap;\n overflow: hidden;\n }\n }\n}\n\n.UnderlineItemList {\n position: relative;\n display: flex;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.UnderlineItem {\n /* underline tab specific styles */\n position: relative;\n display: inline-flex;\n font: inherit;\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n color: var(--fgColor-default);\n text-align: center;\n text-decoration: none;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--borderRadius-medium);\n max-width: 100%;\n margin-bottom: var(--base-size-8);\n height: 32px;\n\n /* button resets */\n appearance: none;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n align-items: center;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: none;\n background-color: var(--bgColor-neutral-muted);\n transition: background-color 0.12s ease-out;\n }\n }\n}\n\n.UnderlineItem:focus {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n\n /* where focus-visible is supported, remove the focus box-shadow */\n &:not(:focus-visible) {\n box-shadow: none;\n }\n}\n\n.UnderlineItem:focus-visible {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n}\n\n/* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n.UnderlineItem [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold);\n white-space: nowrap;\n visibility: hidden;\n content: attr(data-content);\n}\n\n.UnderlineItem [data-component='icon'] {\n display: inline-flex;\n color: var(--fgColor-muted);\n align-items: center;\n margin-inline-end: var(--base-size-8);\n}\n\n/* Truncate items if necessary (should only ever apply to the last item after everything else overflows) */\n.UnderlineItem [data-component='text'] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.UnderlineItem [data-component='counter'] {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n}\n\n.UnderlineItem::after {\n position: absolute;\n inset: auto 0 0;\n margin-bottom: calc(-1 * var(--base-size-8));\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'],\n.UnderlineItem[aria-selected='true'] [data-component='text'] {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false'])::after,\n.UnderlineItem[aria-selected='true']::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n}\n\n.LoadingCounter {\n display: inline-block;\n width: 1.5rem;\n height: 1rem;\n /* 16px */\n background-color: var(--bgColor-neutral-muted);\n border-color: var(--borderColor-default);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 20px;\n animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate;\n}\n\n@keyframes loadingCounterKeyFrames {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0.2;\n }\n}\n"]}
|