@primer/react 0.0.0-20260714202217 → 0.0.0-20260715132248
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 +15 -3
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionList/Group.js +1 -1
- package/dist/ActionList/List.js +10 -16
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -9
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/ButtonGroup/ButtonGroup.js +5 -12
- package/dist/Checkbox/Checkbox.js +3 -10
- package/dist/Dialog/Dialog.js +2 -9
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FilteredActionList/FilteredActionList.js +4 -15
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +9 -18
- package/dist/PageLayout/DragHandle.d.ts +38 -0
- package/dist/PageLayout/DragHandle.js +220 -0
- package/dist/PageLayout/PageLayout.js +53 -247
- package/dist/PageLayout/index.d.ts +3 -1
- package/dist/PageLayout/usePaneWidth.d.ts +55 -1
- package/dist/PageLayout/usePaneWidth.js +10 -5
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +3 -10
- package/dist/TooltipV2/Tooltip.js +2 -9
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +7 -15
- package/dist/experimental/index.js +3 -3
- package/dist/hooks/useAnchoredPosition.js +14 -1
- package/dist/hooks/useMergedRefs.js +1 -4
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260715132248
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8160](https://github.com/primer/react/pull/8160) [`74c731b`](https://github.com/primer/react/commit/74c731b16478bd328eb44ca87d4eb66d43f56fd8) Thanks [@TylerJDev](https://github.com/TylerJDev)! - PageLayout: Export the resize primitives `usePaneWidth` and `DragHandle` (with `defaultPaneWidth` and related types) so pane-resize behavior can be reused outside of `PageLayout`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#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`
|
|
12
|
+
|
|
13
|
+
- Fake entry to force publishing
|
|
14
|
+
|
|
15
|
+
- [#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.
|
|
16
|
+
|
|
17
|
+
## 38.32.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
6
20
|
|
|
@@ -19,8 +33,6 @@
|
|
|
19
33
|
|
|
20
34
|
### Patch Changes
|
|
21
35
|
|
|
22
|
-
- Fake entry to force publishing
|
|
23
|
-
|
|
24
36
|
- [#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.
|
|
25
37
|
|
|
26
38
|
- [#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 items",
|
|
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 { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
3
2
|
import { invariant } from "../utils/invariant.js";
|
|
4
3
|
import { useSlots } from "../hooks/useSlots.js";
|
|
5
4
|
import { ListContext } from "./shared.js";
|
|
6
5
|
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/List.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
4
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
7
5
|
import { useSlots } from "../hooks/useSlots.js";
|
|
8
6
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
@@ -10,10 +8,11 @@ import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
|
10
8
|
import { ListContext } from "./shared.js";
|
|
11
9
|
import { Heading } from "./Heading.js";
|
|
12
10
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
11
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
13
12
|
import { c } from "react-compiler-runtime";
|
|
14
13
|
import { clsx } from "clsx";
|
|
15
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import React
|
|
15
|
+
import React from "react";
|
|
17
16
|
//#region src/ActionList/List.tsx
|
|
18
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
19
18
|
var _slots$heading$props$;
|
|
@@ -61,12 +60,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
61
60
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
62
61
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
63
62
|
const listRole = role || listRoleFromContainer;
|
|
64
|
-
const
|
|
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;
|
|
63
|
+
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
70
64
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
71
65
|
let enableFocusZone = false;
|
|
72
66
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -117,7 +111,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
117
111
|
} else t9 = $[20];
|
|
118
112
|
const listContextValue = t9;
|
|
119
113
|
let t10;
|
|
120
|
-
if ($[21] !== listRef
|
|
114
|
+
if ($[21] !== listRef) {
|
|
121
115
|
t10 = () => {
|
|
122
116
|
const list = listRef.current;
|
|
123
117
|
if (!list) return;
|
|
@@ -126,7 +120,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
126
120
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
127
121
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
128
122
|
};
|
|
129
|
-
$[21] = listRef
|
|
123
|
+
$[21] = listRef;
|
|
130
124
|
$[22] = t10;
|
|
131
125
|
} else t10 = $[22];
|
|
132
126
|
useIsomorphicLayoutEffect(t10);
|
|
@@ -139,12 +133,12 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
139
133
|
} else t12 = $[24];
|
|
140
134
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
141
135
|
let t14;
|
|
142
|
-
if ($[25] !== Component || $[26] !==
|
|
136
|
+
if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
|
|
143
137
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
144
138
|
className: t12,
|
|
145
139
|
role: listRole,
|
|
146
140
|
"aria-labelledby": ariaLabelledBy,
|
|
147
|
-
ref:
|
|
141
|
+
ref: listRef,
|
|
148
142
|
"data-component": "ActionList",
|
|
149
143
|
"data-dividers": showDividers,
|
|
150
144
|
"data-variant": variant,
|
|
@@ -153,9 +147,9 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
153
147
|
children: childrenWithoutSlots
|
|
154
148
|
});
|
|
155
149
|
$[25] = Component;
|
|
156
|
-
$[26] =
|
|
157
|
-
$[27] =
|
|
158
|
-
$[28] =
|
|
150
|
+
$[26] = ariaLabelledBy;
|
|
151
|
+
$[27] = childrenWithoutSlots;
|
|
152
|
+
$[28] = listRef;
|
|
159
153
|
$[29] = listRole;
|
|
160
154
|
$[30] = restProps;
|
|
161
155
|
$[31] = showDividers;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { reactMajorVersion } from "../utils/environment.js";
|
|
2
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
|
|
5
4
|
import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
|
|
6
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
7
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
8
6
|
import { IconButton } from "../Button/IconButton.js";
|
|
9
7
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
10
8
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
9
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
11
10
|
import Overlay from "../Overlay/Overlay.js";
|
|
12
11
|
import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js";
|
|
13
12
|
import { widthMap } from "../Overlay/constants.js";
|
|
@@ -34,8 +33,6 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
34
33
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
35
34
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
36
35
|
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);
|
|
39
36
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
40
37
|
const anchorId = useId$1(externalAnchorId);
|
|
41
38
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -193,12 +190,9 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
193
190
|
...restOverlayProps,
|
|
194
191
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
195
192
|
ref: (node) => {
|
|
193
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
194
|
+
updateOverlayRef(node);
|
|
196
195
|
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
|
-
}
|
|
202
196
|
},
|
|
203
197
|
"data-anchor-position": cssAnchorPositioning,
|
|
204
198
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -20,11 +20,9 @@ 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 && onBlur(event);
|
|
24
24
|
safeSetTimeout(() => {
|
|
25
|
-
|
|
26
|
-
const menuElement = document.getElementById(`${id}-listbox`);
|
|
27
|
-
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
25
|
+
if (document.activeElement !== inputRef.current) {
|
|
28
26
|
setShowMenu(false);
|
|
29
27
|
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
|
|
30
28
|
}
|
|
@@ -35,17 +33,16 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
35
33
|
inputRef,
|
|
36
34
|
safeSetTimeout,
|
|
37
35
|
autocompleteSuggestion,
|
|
38
|
-
inputValue
|
|
39
|
-
id
|
|
36
|
+
inputValue
|
|
40
37
|
]);
|
|
41
38
|
const handleInputChange = (event) => {
|
|
42
|
-
onChange
|
|
39
|
+
onChange && onChange(event);
|
|
43
40
|
setInputValue(event.currentTarget.value);
|
|
44
41
|
if (!showMenu) setShowMenu(true);
|
|
45
42
|
};
|
|
46
43
|
const handleInputKeyDown = useCallback((event) => {
|
|
47
44
|
var _inputRef$current;
|
|
48
|
-
onKeyDown
|
|
45
|
+
onKeyDown && onKeyDown(event);
|
|
49
46
|
if (event.key === "Backspace") setHighlightRemainingText(false);
|
|
50
47
|
if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
|
51
48
|
setInputValue("");
|
|
@@ -61,11 +58,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
61
58
|
setShowMenu
|
|
62
59
|
]);
|
|
63
60
|
const handleInputKeyUp = useCallback((event) => {
|
|
64
|
-
onKeyUp
|
|
61
|
+
onKeyUp && onKeyUp(event);
|
|
65
62
|
if (event.key === "Backspace") setHighlightRemainingText(true);
|
|
66
63
|
}, [setHighlightRemainingText, onKeyUp]);
|
|
67
64
|
const onInputKeyPress = useCallback((event) => {
|
|
68
|
-
onKeyPress
|
|
65
|
+
onKeyPress && onKeyPress(event);
|
|
69
66
|
if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
|
|
70
67
|
event.preventDefault();
|
|
71
68
|
event.nativeEvent.stopImmediatePropagation();
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
4
2
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
5
3
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
6
4
|
import { c } from "react-compiler-runtime";
|
|
7
5
|
import { clsx } from "clsx";
|
|
8
6
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import React
|
|
7
|
+
import React from "react";
|
|
10
8
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
11
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
12
10
|
const $ = c(20);
|
|
@@ -31,12 +29,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
31
29
|
t1 = $[5];
|
|
32
30
|
}
|
|
33
31
|
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;
|
|
40
32
|
let t2;
|
|
41
33
|
if ($[6] !== children) {
|
|
42
34
|
t2 = React.Children.map(children, _temp);
|
|
@@ -44,6 +36,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
44
36
|
$[7] = t2;
|
|
45
37
|
} else t2 = $[7];
|
|
46
38
|
const buttons = t2;
|
|
39
|
+
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
47
40
|
const t3 = role !== "toolbar";
|
|
48
41
|
let t4;
|
|
49
42
|
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
@@ -65,9 +58,9 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
65
58
|
$[12] = t5;
|
|
66
59
|
} else t5 = $[12];
|
|
67
60
|
let t6;
|
|
68
|
-
if ($[13] !== BaseComponent || $[14] !==
|
|
61
|
+
if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
69
62
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
70
|
-
ref:
|
|
63
|
+
ref: buttonRef,
|
|
71
64
|
className: t5,
|
|
72
65
|
role,
|
|
73
66
|
...rest,
|
|
@@ -75,7 +68,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
75
68
|
children: buttons
|
|
76
69
|
});
|
|
77
70
|
$[13] = BaseComponent;
|
|
78
|
-
$[14] =
|
|
71
|
+
$[14] = buttonRef;
|
|
79
72
|
$[15] = buttons;
|
|
80
73
|
$[16] = rest;
|
|
81
74
|
$[17] = role;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
3
|
import shared_module_css_default from "./shared.module.css.js";
|
|
6
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
7
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
8
6
|
import { clsx } from "clsx";
|
|
9
7
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
import React, { useContext, useEffect
|
|
8
|
+
import React, { useContext, useEffect } from "react";
|
|
11
9
|
//#region src/Checkbox/Checkbox.tsx
|
|
12
10
|
/**
|
|
13
11
|
* An accessible, native checkbox component
|
|
14
12
|
*/
|
|
15
13
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
16
|
-
const
|
|
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;
|
|
14
|
+
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
22
15
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
23
16
|
const handleOnChange = (e) => {
|
|
24
17
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -31,7 +24,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
31
24
|
const inputProps = {
|
|
32
25
|
type: "checkbox",
|
|
33
26
|
disabled,
|
|
34
|
-
ref:
|
|
27
|
+
ref: checkboxRef,
|
|
35
28
|
checked: indeterminate ? false : checked,
|
|
36
29
|
defaultChecked,
|
|
37
30
|
required,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -3,7 +3,6 @@ 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 { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
6
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
7
|
import { ButtonComponent } from "../Button/Button.js";
|
|
9
8
|
import { useSlots } from "../hooks/useSlots.js";
|
|
@@ -245,13 +244,7 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
245
244
|
Footer.displayName = "Dialog.Footer";
|
|
246
245
|
const Buttons = ({ buttons }) => {
|
|
247
246
|
var _buttons$find;
|
|
248
|
-
const
|
|
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;
|
|
247
|
+
const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
255
248
|
let autoFocusCount = 0;
|
|
256
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
257
250
|
useEffect(() => {
|
|
@@ -266,7 +259,7 @@ const Buttons = ({ buttons }) => {
|
|
|
266
259
|
"data-component": "Dialog.FooterButton",
|
|
267
260
|
...buttonProps,
|
|
268
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
269
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
270
263
|
children: content
|
|
271
264
|
}, index);
|
|
272
265
|
}) });
|
|
@@ -7,8 +7,7 @@ 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
|
|
11
|
-
primer_react_merged_forwarded_refs: false
|
|
10
|
+
primer_react_timeline_list_semantics: false
|
|
12
11
|
});
|
|
13
12
|
//#endregion
|
|
14
13
|
export { DefaultFeatureFlags };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
5
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
8
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
9
7
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -36,17 +34,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
36
34
|
}, [onFilterChange, setInternalFilterValue]);
|
|
37
35
|
const inputAndListContainerRef = useRef(null);
|
|
38
36
|
const listRef = useRef(null);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
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;
|
|
37
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
38
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
50
39
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
51
40
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
52
41
|
const activeDescendantRef = useRef();
|
|
@@ -301,7 +290,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
301
290
|
"data-component": "FilteredActionList",
|
|
302
291
|
children: [
|
|
303
292
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
304
|
-
inputRef
|
|
293
|
+
inputRef,
|
|
305
294
|
value: filterValue,
|
|
306
295
|
onInputChange,
|
|
307
296
|
onInputKeyPress,
|
|
@@ -335,7 +324,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
335
324
|
})]
|
|
336
325
|
}),
|
|
337
326
|
/*#__PURE__*/ jsx("div", {
|
|
338
|
-
ref:
|
|
327
|
+
ref: scrollContainerRef,
|
|
339
328
|
className: FilteredActionList_module_css_default.Container,
|
|
340
329
|
children: getBodyContent()
|
|
341
330
|
})
|
|
@@ -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.RefObject<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
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 { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
4
|
import Portal_default from "../Portal/index.js";
|
|
5
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.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,5 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import { warning } from "../utils/warning.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
3
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
6
4
|
import { isSlot } from "../utils/is-slot.js";
|
|
7
5
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
@@ -12,7 +10,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
|
|
|
12
10
|
import { c } from "react-compiler-runtime";
|
|
13
11
|
import { clsx } from "clsx";
|
|
14
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React, { useEffect
|
|
13
|
+
import React, { useEffect } from "react";
|
|
16
14
|
import { ArrowLeftIcon } from "@primer/octicons-react";
|
|
17
15
|
//#region src/PageHeader/PageHeader.tsx
|
|
18
16
|
const hiddenOnRegularAndWide = {
|
|
@@ -29,12 +27,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
29
27
|
const $ = c(17);
|
|
30
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
31
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
32
|
-
const
|
|
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;
|
|
30
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
38
31
|
const hoistChildState = (nodes) => {
|
|
39
32
|
const result = { hasNavigation: false };
|
|
40
33
|
for (const child of React.Children.toArray(nodes)) {
|
|
@@ -96,9 +89,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
96
89
|
const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
|
|
97
90
|
const t9 = getNavHiddenDataAttributes(navigationHidden);
|
|
98
91
|
let t10;
|
|
99
|
-
if ($[6] !== BaseComponent || $[7] !==
|
|
92
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
|
|
100
93
|
t10 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
101
|
-
ref:
|
|
94
|
+
ref: rootRef,
|
|
102
95
|
className: t4,
|
|
103
96
|
"data-component": t5,
|
|
104
97
|
"data-has-border": t6,
|
|
@@ -110,10 +103,10 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
110
103
|
children
|
|
111
104
|
});
|
|
112
105
|
$[6] = BaseComponent;
|
|
113
|
-
$[7] =
|
|
114
|
-
$[8] =
|
|
115
|
-
$[9] =
|
|
116
|
-
$[10] =
|
|
106
|
+
$[7] = ariaLabel;
|
|
107
|
+
$[8] = children;
|
|
108
|
+
$[9] = role;
|
|
109
|
+
$[10] = rootRef;
|
|
117
110
|
$[11] = t4;
|
|
118
111
|
$[12] = t6;
|
|
119
112
|
$[13] = t7;
|
|
@@ -302,9 +295,7 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
302
295
|
const { children, className, hidden: t1, variant: t2 } = t0;
|
|
303
296
|
const hidden = t1 === void 0 ? false : t1;
|
|
304
297
|
const variant = t2 === void 0 ? "medium" : t2;
|
|
305
|
-
const
|
|
306
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
307
|
-
const titleAreaRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
|
|
298
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
308
299
|
let t3;
|
|
309
300
|
if ($[0] !== className) {
|
|
310
301
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/PageLayout/DragHandle.d.ts
|
|
4
|
+
type DragHandleProps = {
|
|
5
|
+
/** Ref for imperative ARIA updates during drag */handleRef: React.RefObject<HTMLDivElement>; /** Called once when drag starts with initial cursor X position */
|
|
6
|
+
onDragStart: (clientX: number) => void; /** Called on each drag tick with cursor position (pointer) or delta (keyboard) */
|
|
7
|
+
onDrag: (value: number, isKeyboard: boolean) => void; /** Called when drag operation completes */
|
|
8
|
+
onDragEnd: () => void; /** Reset width on double-click */
|
|
9
|
+
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>; /** ARIA slider min value */
|
|
10
|
+
'aria-valuemin'?: number; /** ARIA slider max value */
|
|
11
|
+
'aria-valuemax'?: number; /** ARIA slider current value */
|
|
12
|
+
'aria-valuenow'?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Ref to the element that receives drag-time styling/containment optimizations
|
|
15
|
+
* (e.g. the resizable pane). When omitted, those side effects are skipped.
|
|
16
|
+
*/
|
|
17
|
+
dragTargetRef?: React.RefObject<HTMLElement | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Ref to a content wrapper element that receives drag-time containment.
|
|
20
|
+
* Only needed for layouts (like PageLayout) that optimize sibling content during drag.
|
|
21
|
+
*/
|
|
22
|
+
contentWrapperRef?: React.RefObject<HTMLElement | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Formats the `aria-valuetext` announced for the current width.
|
|
25
|
+
* @default valueNow => `Pane width ${valueNow} pixels`
|
|
26
|
+
*/
|
|
27
|
+
formatValueText?: (valueNow: number) => string; /** Value for the `data-component` attribute. */
|
|
28
|
+
'data-component'?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* DragHandle - handles all pointer and keyboard interactions for resizing.
|
|
32
|
+
* ARIA values are set in JSX for SSR accessibility, then updated via DOM
|
|
33
|
+
* manipulation during drag for performance. The consumer owns writing the width
|
|
34
|
+
* (via the `onDrag` callback); this component only reports interactions.
|
|
35
|
+
*/
|
|
36
|
+
declare const DragHandle: React.NamedExoticComponent<DragHandleProps>;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DragHandle, DragHandleProps };
|