@primer/react 0.0.0-20260310144829 → 0.0.0-20260310163541
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -3
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +10 -7
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts +2 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +7 -17
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox/Checkbox.js +5 -5
- package/dist/Dialog/Dialog.js +4 -6
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +8 -8
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +30 -31
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +4 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -6
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/deprecated/ActionMenu.d.ts.map +1 -1
- package/dist/deprecated/ActionMenu.js +8 -7
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +5 -4
- package/dist/experimental/Tabs/Tabs.d.ts +1 -1
- package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.js +16 -16
- package/dist/hooks/useAnchoredPosition.js +1 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -1
- package/dist/hooks/useProvidedRefOrCreate.d.ts +12 -0
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260310163541
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#7645](https://github.com/primer/react/pull/7645) [`bdb0e39`](https://github.com/primer/react/commit/bdb0e39d56bfb13ab3e321622402369251cc3207) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `useCombinedRefs` hook and deprecate `useRefObjectAsForwardedRef`
|
|
8
|
-
|
|
9
7
|
- [#7524](https://github.com/primer/react/pull/7524) [`f7bdd1c`](https://github.com/primer/react/commit/f7bdd1c04f8cbb17b6a913ba55f7d0855c8eebf1) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: always render ActionMenu in viewport when inside Dialog under feature flag
|
|
10
8
|
|
|
11
9
|
- [#7594](https://github.com/primer/react/pull/7594) [`1e54bdf`](https://github.com/primer/react/commit/1e54bdf72c9466f23c567cfdc73b7b5c243782a4) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `align` and `style` props to Dialog component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAoF7C,QAAA,MAAM,IAAI,GAxEa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDAwER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
3
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
4
4
|
import { ActionListContainerContext } from './ActionListContainerContext.js';
|
|
5
5
|
import { useSlots } from '../hooks/useSlots.js';
|
|
@@ -10,12 +10,12 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
11
|
import classes from './ActionList.module.css.js';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
14
14
|
import { FocusKeys } from '@primer/behaviors';
|
|
15
15
|
|
|
16
16
|
const UnwrappedList = (props, forwardedRef) => {
|
|
17
17
|
var _slots$heading$props$;
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(36);
|
|
19
19
|
let className;
|
|
20
20
|
let restProps;
|
|
21
21
|
let role;
|
|
@@ -78,7 +78,8 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
78
78
|
} = React.useContext(ActionListContainerContext);
|
|
79
79
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
80
80
|
const listRole = role || listRoleFromContainer;
|
|
81
|
-
const listRef =
|
|
81
|
+
const listRef = useRef(null);
|
|
82
|
+
const combinedRef = useCombinedRefs(forwardedRef, listRef);
|
|
82
83
|
let enableFocusZone = false;
|
|
83
84
|
if (enableFocusZoneFromContainer !== undefined) {
|
|
84
85
|
enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -97,24 +98,23 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
97
98
|
const t5 = !enableFocusZone;
|
|
98
99
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
|
|
99
100
|
let t7;
|
|
100
|
-
if ($[11] !==
|
|
101
|
+
if ($[11] !== t5 || $[12] !== t6) {
|
|
101
102
|
t7 = {
|
|
102
103
|
disabled: t5,
|
|
103
104
|
containerRef: listRef,
|
|
104
105
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
105
106
|
focusOutBehavior: t6
|
|
106
107
|
};
|
|
107
|
-
$[11] =
|
|
108
|
-
$[12] =
|
|
109
|
-
$[13] =
|
|
110
|
-
$[14] = t7;
|
|
108
|
+
$[11] = t5;
|
|
109
|
+
$[12] = t6;
|
|
110
|
+
$[13] = t7;
|
|
111
111
|
} else {
|
|
112
|
-
t7 = $[
|
|
112
|
+
t7 = $[13];
|
|
113
113
|
}
|
|
114
114
|
useFocusZone(t7);
|
|
115
115
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
116
116
|
let t9;
|
|
117
|
-
if ($[
|
|
117
|
+
if ($[14] !== headingId || $[15] !== listRole || $[16] !== showDividers || $[17] !== t8 || $[18] !== variant) {
|
|
118
118
|
t9 = {
|
|
119
119
|
variant,
|
|
120
120
|
selectionVariant: t8,
|
|
@@ -122,61 +122,61 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
122
122
|
role: listRole,
|
|
123
123
|
headingId
|
|
124
124
|
};
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
125
|
+
$[14] = headingId;
|
|
126
|
+
$[15] = listRole;
|
|
127
|
+
$[16] = showDividers;
|
|
128
|
+
$[17] = t8;
|
|
129
|
+
$[18] = variant;
|
|
130
|
+
$[19] = t9;
|
|
131
131
|
} else {
|
|
132
|
-
t9 = $[
|
|
132
|
+
t9 = $[19];
|
|
133
133
|
}
|
|
134
134
|
const t10 = slots.heading;
|
|
135
135
|
let t11;
|
|
136
|
-
if ($[
|
|
136
|
+
if ($[20] !== className) {
|
|
137
137
|
t11 = clsx(classes.ActionList, className);
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
138
|
+
$[20] = className;
|
|
139
|
+
$[21] = t11;
|
|
140
140
|
} else {
|
|
141
|
-
t11 = $[
|
|
141
|
+
t11 = $[21];
|
|
142
142
|
}
|
|
143
143
|
let t12;
|
|
144
|
-
if ($[
|
|
144
|
+
if ($[22] !== Component || $[23] !== ariaLabelledBy || $[24] !== childrenWithoutSlots || $[25] !== combinedRef || $[26] !== listRole || $[27] !== restProps || $[28] !== showDividers || $[29] !== t11 || $[30] !== variant) {
|
|
145
145
|
t12 = /*#__PURE__*/jsx(Component, {
|
|
146
146
|
className: t11,
|
|
147
147
|
role: listRole,
|
|
148
148
|
"aria-labelledby": ariaLabelledBy,
|
|
149
|
-
ref:
|
|
149
|
+
ref: combinedRef,
|
|
150
150
|
"data-dividers": showDividers,
|
|
151
151
|
"data-variant": variant,
|
|
152
152
|
...restProps,
|
|
153
153
|
children: childrenWithoutSlots
|
|
154
154
|
});
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
155
|
+
$[22] = Component;
|
|
156
|
+
$[23] = ariaLabelledBy;
|
|
157
|
+
$[24] = childrenWithoutSlots;
|
|
158
|
+
$[25] = combinedRef;
|
|
159
|
+
$[26] = listRole;
|
|
160
|
+
$[27] = restProps;
|
|
161
|
+
$[28] = showDividers;
|
|
162
|
+
$[29] = t11;
|
|
163
|
+
$[30] = variant;
|
|
164
|
+
$[31] = t12;
|
|
165
165
|
} else {
|
|
166
|
-
t12 = $[
|
|
166
|
+
t12 = $[31];
|
|
167
167
|
}
|
|
168
168
|
let t13;
|
|
169
|
-
if ($[
|
|
169
|
+
if ($[32] !== slots.heading || $[33] !== t12 || $[34] !== t9) {
|
|
170
170
|
t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
171
171
|
value: t9,
|
|
172
172
|
children: [t10, t12]
|
|
173
173
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
174
|
+
$[32] = slots.heading;
|
|
175
|
+
$[33] = t12;
|
|
176
|
+
$[34] = t9;
|
|
177
|
+
$[35] = t13;
|
|
178
178
|
} else {
|
|
179
|
-
t13 = $[
|
|
179
|
+
t13 = $[35];
|
|
180
180
|
}
|
|
181
181
|
return t13;
|
|
182
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAE1F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAI1E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,KAClG,IAAI,CAAA;AAET,MA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1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
1
|
+
import React, { useContext, useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
3
3
|
import { Divider } from '../ActionList/Divider.js';
|
|
4
4
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -10,7 +10,7 @@ import { isSlot } from '../utils/is-slot.js';
|
|
|
10
10
|
import { DialogContext } from '../Dialog/Dialog.js';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
|
|
13
|
-
import {
|
|
13
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
14
14
|
import { useMenuKeyboardNavigation } from '../hooks/useMenuKeyboardNavigation.js';
|
|
15
15
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
16
16
|
import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
|
|
@@ -72,7 +72,8 @@ const Menu = ({
|
|
|
72
72
|
}, [setCombinedOpenState, parentMenuContext, open, isNarrow]);
|
|
73
73
|
const menuButtonChild = React.Children.toArray(children).find(child => /*#__PURE__*/React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton)));
|
|
74
74
|
const menuButtonChildId = /*#__PURE__*/React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : undefined;
|
|
75
|
-
const anchorRef =
|
|
75
|
+
const anchorRef = useRef(null);
|
|
76
|
+
const combinedRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
76
77
|
const anchorId = useId(menuButtonChildId);
|
|
77
78
|
let renderAnchor = null;
|
|
78
79
|
// 🚨 Hack for good API!
|
|
@@ -93,7 +94,7 @@ const Menu = ({
|
|
|
93
94
|
}, anchorChildren.props));
|
|
94
95
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
95
96
|
children: triggerButton,
|
|
96
|
-
ref:
|
|
97
|
+
ref: combinedRef
|
|
97
98
|
});
|
|
98
99
|
};
|
|
99
100
|
}
|
|
@@ -115,7 +116,7 @@ const Menu = ({
|
|
|
115
116
|
});
|
|
116
117
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
117
118
|
children: tooltip,
|
|
118
|
-
ref:
|
|
119
|
+
ref: combinedRef
|
|
119
120
|
});
|
|
120
121
|
};
|
|
121
122
|
}
|
|
@@ -218,7 +219,7 @@ const Overlay = ({
|
|
|
218
219
|
// we typecast anchorRef as required instead of optional
|
|
219
220
|
// because we know that we're setting it in context in Menu
|
|
220
221
|
const {
|
|
221
|
-
anchorRef,
|
|
222
|
+
anchorRef: contextAnchorRef,
|
|
222
223
|
renderAnchor,
|
|
223
224
|
anchorId,
|
|
224
225
|
open,
|
|
@@ -226,6 +227,8 @@ const Overlay = ({
|
|
|
226
227
|
onClose,
|
|
227
228
|
isSubmenu = false
|
|
228
229
|
} = React.useContext(MenuContext);
|
|
230
|
+
const anchorRef = useRef(null);
|
|
231
|
+
const combinedAnchorRef = useCombinedRefs(anchorRef, contextAnchorRef);
|
|
229
232
|
const containerRef = React.useRef(null);
|
|
230
233
|
const isNarrow = useResponsiveValue({
|
|
231
234
|
narrow: true
|
|
@@ -259,7 +262,7 @@ const Overlay = ({
|
|
|
259
262
|
const featureFlagDisplayInViewportInsideDialog = useFeatureFlag('primer_react_action_menu_display_in_viewport_inside_dialog');
|
|
260
263
|
const isInsideDialog = useContext(DialogContext) !== undefined;
|
|
261
264
|
return /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
262
|
-
anchorRef:
|
|
265
|
+
anchorRef: combinedAnchorRef,
|
|
263
266
|
renderAnchor: renderAnchor,
|
|
264
267
|
anchorId: anchorId,
|
|
265
268
|
open: open,
|
|
@@ -15,7 +15,7 @@ interface AnchoredOverlayPropsWithAnchor {
|
|
|
15
15
|
/**
|
|
16
16
|
* An override to the internal ref that will be spread on to the renderAnchor
|
|
17
17
|
*/
|
|
18
|
-
anchorRef?: React.
|
|
18
|
+
anchorRef?: React.Ref<HTMLElement | null>;
|
|
19
19
|
/**
|
|
20
20
|
* An override to the internal id that will be spread on to the renderAnchor
|
|
21
21
|
*/
|
|
@@ -31,7 +31,7 @@ interface AnchoredOverlayPropsWithoutAnchor {
|
|
|
31
31
|
* An override to the internal renderAnchor ref that will be used to position the overlay.
|
|
32
32
|
* When renderAnchor is null this can be used to make an anchor that is detached from ActionMenu.
|
|
33
33
|
*/
|
|
34
|
-
anchorRef: React.
|
|
34
|
+
anchorRef: React.Ref<HTMLElement | null>;
|
|
35
35
|
/**
|
|
36
36
|
* An override to the internal id that will be spread on to the renderAnchor
|
|
37
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAiC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM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B,CAAC,CAAA;IAElD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA4JnF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect } from 'react';
|
|
1
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
2
2
|
import { useFocusTrap } from '../hooks/useFocusTrap.js';
|
|
3
3
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
4
4
|
import { useId } from '../hooks/useId.js';
|
|
@@ -7,7 +7,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
7
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
-
import {
|
|
10
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
11
11
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
12
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
13
13
|
import Overlay from '../Overlay/Overlay.js';
|
|
@@ -48,8 +48,10 @@ const AnchoredOverlay = ({
|
|
|
48
48
|
displayCloseButton = true,
|
|
49
49
|
closeButtonProps = defaultCloseButtonProps
|
|
50
50
|
}) => {
|
|
51
|
-
const anchorRef =
|
|
51
|
+
const anchorRef = useRef(null);
|
|
52
|
+
const combinedRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
52
53
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
54
|
+
const combinedOverlayRef = useCombinedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
53
55
|
const anchorId = useId(externalAnchorId);
|
|
54
56
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
|
|
55
57
|
const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('escape'), [onClose]);
|
|
@@ -112,7 +114,7 @@ const AnchoredOverlay = ({
|
|
|
112
114
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
113
115
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
114
116
|
children: [renderAnchor && renderAnchor({
|
|
115
|
-
ref:
|
|
117
|
+
ref: combinedRef,
|
|
116
118
|
id: anchorId,
|
|
117
119
|
'aria-haspopup': 'true',
|
|
118
120
|
'aria-expanded': open,
|
|
@@ -136,12 +138,7 @@ const AnchoredOverlay = ({
|
|
|
136
138
|
preventOverflow: preventOverflow,
|
|
137
139
|
"data-component": "AnchoredOverlay",
|
|
138
140
|
...overlayProps,
|
|
139
|
-
ref:
|
|
140
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
141
|
-
assignRef(overlayProps.ref, node);
|
|
142
|
-
}
|
|
143
|
-
updateOverlayRef(node);
|
|
144
|
-
},
|
|
141
|
+
ref: combinedOverlayRef,
|
|
145
142
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
146
143
|
className: classes.ResponsiveCloseButtonContainer,
|
|
147
144
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -165,13 +162,6 @@ const AnchoredOverlay = ({
|
|
|
165
162
|
}) : null]
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
|
-
function assignRef(ref, value) {
|
|
169
|
-
if (typeof ref === 'function') {
|
|
170
|
-
ref(value);
|
|
171
|
-
} else if (ref) {
|
|
172
|
-
ref.current = value;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
165
|
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
|
176
166
|
|
|
177
167
|
export { AnchoredOverlay };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAS,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAK3D,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;IAC/C,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,QAAA,MAAM,WAAW,EAoBX,8BAA8B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;AAI7D,eAAe,WAAW,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
3
|
import classes from './ButtonGroup.module.css.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
import {
|
|
7
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
8
8
|
import { FocusKeys } from '@primer/behaviors';
|
|
9
9
|
|
|
10
10
|
const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
11
|
-
const $ = c(
|
|
11
|
+
const $ = c(19);
|
|
12
12
|
let children;
|
|
13
13
|
let className;
|
|
14
14
|
let rest;
|
|
@@ -45,49 +45,49 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
|
|
|
45
45
|
t2 = $[7];
|
|
46
46
|
}
|
|
47
47
|
const buttons = t2;
|
|
48
|
-
const buttonRef =
|
|
48
|
+
const buttonRef = useRef(null);
|
|
49
|
+
const combinedRef = useCombinedRefs(buttonRef, forwardRef);
|
|
49
50
|
const t3 = role !== "toolbar";
|
|
50
51
|
let t4;
|
|
51
|
-
if ($[8] !==
|
|
52
|
+
if ($[8] !== t3) {
|
|
52
53
|
t4 = {
|
|
53
54
|
containerRef: buttonRef,
|
|
54
55
|
disabled: t3,
|
|
55
56
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
56
57
|
focusOutBehavior: "wrap"
|
|
57
58
|
};
|
|
58
|
-
$[8] =
|
|
59
|
-
$[9] =
|
|
60
|
-
$[10] = t4;
|
|
59
|
+
$[8] = t3;
|
|
60
|
+
$[9] = t4;
|
|
61
61
|
} else {
|
|
62
|
-
t4 = $[
|
|
62
|
+
t4 = $[9];
|
|
63
63
|
}
|
|
64
64
|
useFocusZone(t4);
|
|
65
65
|
let t5;
|
|
66
|
-
if ($[
|
|
66
|
+
if ($[10] !== className) {
|
|
67
67
|
t5 = clsx(className, classes.ButtonGroup);
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
68
|
+
$[10] = className;
|
|
69
|
+
$[11] = t5;
|
|
70
70
|
} else {
|
|
71
|
-
t5 = $[
|
|
71
|
+
t5 = $[11];
|
|
72
72
|
}
|
|
73
73
|
let t6;
|
|
74
|
-
if ($[
|
|
74
|
+
if ($[12] !== BaseComponent || $[13] !== buttons || $[14] !== combinedRef || $[15] !== rest || $[16] !== role || $[17] !== t5) {
|
|
75
75
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
76
|
-
ref:
|
|
76
|
+
ref: combinedRef,
|
|
77
77
|
className: t5,
|
|
78
78
|
role: role,
|
|
79
79
|
...rest,
|
|
80
80
|
children: buttons
|
|
81
81
|
});
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
82
|
+
$[12] = BaseComponent;
|
|
83
|
+
$[13] = buttons;
|
|
84
|
+
$[14] = combinedRef;
|
|
85
|
+
$[15] = rest;
|
|
86
|
+
$[16] = role;
|
|
87
|
+
$[17] = t5;
|
|
88
|
+
$[18] = t6;
|
|
89
89
|
} else {
|
|
90
|
-
t6 = $[
|
|
90
|
+
t6 = $[18];
|
|
91
91
|
}
|
|
92
92
|
return t6;
|
|
93
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAKZ,KAAK,mBAAmB,EAEzB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAI7E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAA;AAE3D;;GAEG;AACH,QAAA,MAAM,QAAQ,qGAiDb,CAAA;wBAK0B,cAAc,CAAC,OAAO,QAAQ,CAAC;AAA1D,wBAA0D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import React, { useRef, useContext, useEffect } from 'react';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
4
|
import { CheckboxGroupContext } from '../CheckboxGroup/CheckboxGroupContext.js';
|
|
5
5
|
import classes from './Checkbox.module.css.js';
|
|
6
6
|
import sharedClasses from './shared.module.css.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
import {
|
|
8
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
@@ -24,7 +24,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
24
24
|
}, ref
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
) => {
|
|
27
|
-
const checkboxRef =
|
|
27
|
+
const checkboxRef = useRef(null);
|
|
28
|
+
const combinedRef = useCombinedRefs(checkboxRef, ref);
|
|
28
29
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
29
30
|
const handleOnChange = e => {
|
|
30
31
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -33,7 +34,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
33
34
|
const inputProps = {
|
|
34
35
|
type: 'checkbox',
|
|
35
36
|
disabled,
|
|
36
|
-
ref:
|
|
37
|
+
ref: combinedRef,
|
|
37
38
|
checked: indeterminate ? false : checked,
|
|
38
39
|
defaultChecked,
|
|
39
40
|
required,
|
|
@@ -62,7 +63,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
62
63
|
checkbox.setAttribute('aria-checked', checkbox.checked ? 'true' : 'false');
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
|
-
// @ts-expect-error inputProp needs a non nullable ref
|
|
66
66
|
return /*#__PURE__*/jsx("input", {
|
|
67
67
|
...inputProps,
|
|
68
68
|
className: clsx(className, sharedClasses.Input, classes.Checkbox)
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -14,7 +14,6 @@ import { useSlots } from '../hooks/useSlots.js';
|
|
|
14
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
15
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
16
16
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
17
|
-
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
18
17
|
|
|
19
18
|
const DefaultHeader = ({
|
|
20
19
|
dialogLabelId,
|
|
@@ -272,7 +271,8 @@ const Buttons = ({
|
|
|
272
271
|
buttons
|
|
273
272
|
}) => {
|
|
274
273
|
var _buttons$find;
|
|
275
|
-
const autoFocusRef =
|
|
274
|
+
const autoFocusRef = useRef(null);
|
|
275
|
+
const combinedRef = useCombinedRefs(autoFocusRef, (_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
276
276
|
let autoFocusCount = 0;
|
|
277
277
|
const [hasRendered, setHasRendered] = useState(0);
|
|
278
278
|
useEffect(() => {
|
|
@@ -295,10 +295,8 @@ const Buttons = ({
|
|
|
295
295
|
return /*#__PURE__*/jsx(ButtonComponent, {
|
|
296
296
|
...buttonProps,
|
|
297
297
|
// 'normal' value is equivalent to 'default', this is used for backwards compatibility
|
|
298
|
-
variant: buttonType === 'normal' ? 'default' : buttonType
|
|
299
|
-
|
|
300
|
-
,
|
|
301
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
298
|
+
variant: buttonType === 'normal' ? 'default' : buttonType,
|
|
299
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, combinedRef) : null,
|
|
302
300
|
children: content
|
|
303
301
|
}, index);
|
|
304
302
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAA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,eAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,WAAmB,EACnB,GAAG,SAAS,EACb,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CA6avC;yBA5ce,kBAAkB"}
|
|
@@ -4,7 +4,6 @@ import { useCallback, useRef, useState, useEffect, useMemo, forwardRef } from 'r
|
|
|
4
4
|
import { ActionList } from '../ActionList/index.js';
|
|
5
5
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
6
6
|
import { useId } from '../hooks/useId.js';
|
|
7
|
-
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
8
7
|
import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
|
|
9
8
|
import useScrollFlash from '../hooks/useScrollFlash.js';
|
|
10
9
|
import { FilteredActionListLoadingTypes, FilteredActionListBodyLoader } from './FilteredActionListLoaders.js';
|
|
@@ -15,6 +14,7 @@ import { useAnnouncements } from './useAnnouncements.js';
|
|
|
15
14
|
import { clsx } from 'clsx';
|
|
16
15
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
17
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
18
18
|
import TextInput from '../TextInput/TextInput.js';
|
|
19
19
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
20
20
|
import Checkbox from '../Checkbox/Checkbox.js';
|
|
@@ -73,8 +73,10 @@ function FilteredActionList({
|
|
|
73
73
|
}, [onFilterChange, setInternalFilterValue]);
|
|
74
74
|
const inputAndListContainerRef = useRef(null);
|
|
75
75
|
const listRef = useRef(null);
|
|
76
|
-
const scrollContainerRef =
|
|
77
|
-
const
|
|
76
|
+
const scrollContainerRef = useRef(null);
|
|
77
|
+
const combinedScrollContainerRef = useCombinedRefs(scrollContainerRef, providedScrollContainerRef);
|
|
78
|
+
const inputRef = useRef(null);
|
|
79
|
+
const combinedInputRef = useCombinedRefs(inputRef, providedInputRef);
|
|
78
80
|
const usingRovingTabindex = _PrivateFocusManagement === 'roving-tabindex';
|
|
79
81
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
80
82
|
const activeDescendantRef = useRef();
|
|
@@ -387,10 +389,8 @@ function FilteredActionList({
|
|
|
387
389
|
"data-testid": "filtered-action-list",
|
|
388
390
|
children: [/*#__PURE__*/jsx("div", {
|
|
389
391
|
className: classes.Header,
|
|
390
|
-
children: /*#__PURE__*/jsx(TextInput
|
|
391
|
-
|
|
392
|
-
, {
|
|
393
|
-
ref: inputRef,
|
|
392
|
+
children: /*#__PURE__*/jsx(TextInput, {
|
|
393
|
+
ref: combinedInputRef,
|
|
394
394
|
block: true,
|
|
395
395
|
width: "auto",
|
|
396
396
|
color: "fg.default",
|
|
@@ -429,7 +429,7 @@ function FilteredActionList({
|
|
|
429
429
|
children: selectAllLabelText
|
|
430
430
|
})]
|
|
431
431
|
}), /*#__PURE__*/jsx("div", {
|
|
432
|
-
ref:
|
|
432
|
+
ref: combinedScrollContainerRef,
|
|
433
433
|
className: classes.Container,
|
|
434
434
|
children: getBodyContent()
|
|
435
435
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAIhE,OAAO,KAAK,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,SAAS,CAAA;AAIvD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAI/F,OAAO,KAAK,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CA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iBAAiB,CAAC,CAAA;AAmBrE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC5D,GAAG,iBAAiB,CAAA;AAsFrB,eAAO,MAAM,UAAU;;;;;;;;;;;;+CA3GiC,YAAY;;;CA0HlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
|
|
4
4
|
import { ArrowLeftIcon } from '@primer/octicons-react';
|
|
5
5
|
import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js';
|
|
@@ -9,7 +9,7 @@ import { clsx } from 'clsx';
|
|
|
9
9
|
import classes from './PageHeader.module.css.js';
|
|
10
10
|
import { isSlot } from '../utils/is-slot.js';
|
|
11
11
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
12
|
-
import {
|
|
12
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
13
13
|
import Heading from '../Heading/Heading.js';
|
|
14
14
|
import Link from '../Link/Link.js';
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ const hiddenOnNarrow = {
|
|
|
31
31
|
// -----------------------------------------------------------------------------
|
|
32
32
|
|
|
33
33
|
const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
34
|
-
const $ = c(
|
|
34
|
+
const $ = c(13);
|
|
35
35
|
const {
|
|
36
36
|
children,
|
|
37
37
|
className,
|
|
@@ -41,11 +41,12 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
41
41
|
hasBorder
|
|
42
42
|
} = t0;
|
|
43
43
|
const BaseComponent = t1 === undefined ? "div" : t1;
|
|
44
|
-
const rootRef =
|
|
44
|
+
const rootRef = useRef(null);
|
|
45
|
+
const combinedRef = useCombinedRefs(rootRef, forwardedRef);
|
|
45
46
|
const isInteractive = _temp;
|
|
46
47
|
let t2;
|
|
47
48
|
let t3;
|
|
48
|
-
if ($[0] !== children
|
|
49
|
+
if ($[0] !== children) {
|
|
49
50
|
t2 = function validateInteractiveElementsInTitle() {
|
|
50
51
|
if (!(process.env.NODE_ENV !== "production")) {
|
|
51
52
|
return;
|
|
@@ -72,43 +73,42 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
72
73
|
};
|
|
73
74
|
t3 = [children, rootRef];
|
|
74
75
|
$[0] = children;
|
|
75
|
-
$[1] =
|
|
76
|
-
$[2] =
|
|
77
|
-
$[3] = t3;
|
|
76
|
+
$[1] = t2;
|
|
77
|
+
$[2] = t3;
|
|
78
78
|
} else {
|
|
79
|
-
t2 = $[
|
|
80
|
-
t3 = $[
|
|
79
|
+
t2 = $[1];
|
|
80
|
+
t3 = $[2];
|
|
81
81
|
}
|
|
82
82
|
useEffect(t2, t3);
|
|
83
83
|
let t4;
|
|
84
|
-
if ($[
|
|
84
|
+
if ($[3] !== className) {
|
|
85
85
|
t4 = clsx(classes.PageHeader, className);
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
86
|
+
$[3] = className;
|
|
87
|
+
$[4] = t4;
|
|
88
88
|
} else {
|
|
89
|
-
t4 = $[
|
|
89
|
+
t4 = $[4];
|
|
90
90
|
}
|
|
91
91
|
const t5 = hasBorder ? "true" : undefined;
|
|
92
92
|
let t6;
|
|
93
|
-
if ($[
|
|
93
|
+
if ($[5] !== BaseComponent || $[6] !== ariaLabel || $[7] !== children || $[8] !== combinedRef || $[9] !== role || $[10] !== t4 || $[11] !== t5) {
|
|
94
94
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
95
|
-
ref:
|
|
95
|
+
ref: combinedRef,
|
|
96
96
|
className: t4,
|
|
97
97
|
"data-has-border": t5,
|
|
98
98
|
"aria-label": ariaLabel,
|
|
99
99
|
role: role,
|
|
100
100
|
children: children
|
|
101
101
|
});
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
102
|
+
$[5] = BaseComponent;
|
|
103
|
+
$[6] = ariaLabel;
|
|
104
|
+
$[7] = children;
|
|
105
|
+
$[8] = combinedRef;
|
|
105
106
|
$[9] = role;
|
|
106
|
-
$[10] =
|
|
107
|
-
$[11] =
|
|
108
|
-
$[12] =
|
|
109
|
-
$[13] = t6;
|
|
107
|
+
$[10] = t4;
|
|
108
|
+
$[11] = t5;
|
|
109
|
+
$[12] = t6;
|
|
110
110
|
} else {
|
|
111
|
-
t6 = $[
|
|
111
|
+
t6 = $[12];
|
|
112
112
|
}
|
|
113
113
|
return t6;
|
|
114
114
|
});
|
|
@@ -334,7 +334,6 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
334
334
|
} = t0;
|
|
335
335
|
const hidden = t1 === undefined ? false : t1;
|
|
336
336
|
const variant = t2 === undefined ? "medium" : t2;
|
|
337
|
-
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
338
337
|
let t3;
|
|
339
338
|
if ($[0] !== className) {
|
|
340
339
|
t3 = clsx(classes.TitleArea, className);
|
|
@@ -360,20 +359,20 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
360
359
|
t5 = $[5];
|
|
361
360
|
}
|
|
362
361
|
let t6;
|
|
363
|
-
if ($[6] !== children || $[7] !==
|
|
362
|
+
if ($[6] !== children || $[7] !== forwardedRef || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
|
|
364
363
|
t6 = /*#__PURE__*/jsx("div", {
|
|
365
364
|
className: t3,
|
|
366
|
-
ref:
|
|
365
|
+
ref: forwardedRef,
|
|
367
366
|
"data-component": "TitleArea",
|
|
368
367
|
...t4,
|
|
369
368
|
...t5,
|
|
370
369
|
children: children
|
|
371
370
|
});
|
|
372
371
|
$[6] = children;
|
|
373
|
-
$[7] =
|
|
374
|
-
$[8] =
|
|
375
|
-
$[9] =
|
|
376
|
-
$[10] =
|
|
372
|
+
$[7] = forwardedRef;
|
|
373
|
+
$[8] = t3;
|
|
374
|
+
$[9] = t4;
|
|
375
|
+
$[10] = t5;
|
|
377
376
|
$[11] = t6;
|
|
378
377
|
} else {
|
|
379
378
|
t6 = $[11];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../src/SelectPanel/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC1F,OAAO,KAAK,EAAE,EAA+E,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,iCAAiC,EAAC,MAAM,oCAAoC,CAAA;AACzF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAA;AAGlE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAY,SAAS,EAAC,MAAM,IAAI,CAAA;AAiB5C,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAA;AAkCjE,UAAU,0BAA0B;IAClC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAA;CAC5D;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;CAClD;AAED,MAAM,MA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@ -18,7 +18,7 @@ import { isAlphabetKey } from '../hooks/useMnemonics.js';
|
|
|
18
18
|
import { useFormControlContext } from '../FormControl/_FormControlContext.js';
|
|
19
19
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
20
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
21
|
-
import {
|
|
21
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
22
22
|
import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
|
|
23
23
|
import Heading from '../Heading/Heading.js';
|
|
24
24
|
import { FilteredActionList } from '../FilteredActionList/FilteredActionList.js';
|
|
@@ -380,7 +380,8 @@ function Panel({
|
|
|
380
380
|
announceNotice();
|
|
381
381
|
}
|
|
382
382
|
}, [notice, open]);
|
|
383
|
-
const anchorRef =
|
|
383
|
+
const anchorRef = useRef(null);
|
|
384
|
+
const combinedAnchorRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
384
385
|
const onOpen = useCallback(gesture => onOpenChange(true, gesture), [onOpenChange]);
|
|
385
386
|
const onCancelRequested = useCallback(() => {
|
|
386
387
|
onOpenChange(false, 'cancel');
|
|
@@ -636,7 +637,7 @@ function Panel({
|
|
|
636
637
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
637
638
|
children: [/*#__PURE__*/jsx(AnchoredOverlay, {
|
|
638
639
|
renderAnchor: renderMenuAnchor,
|
|
639
|
-
anchorRef:
|
|
640
|
+
anchorRef: combinedAnchorRef,
|
|
640
641
|
align: align,
|
|
641
642
|
open: open,
|
|
642
643
|
onOpen: onOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{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7 @@ import UnstyledTextInput from '../internal/components/UnstyledTextInput.js';
|
|
|
10
10
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
11
11
|
import { CharacterCounter } from '../utils/character-counter.js';
|
|
12
12
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
14
14
|
import Text from '../Text/Text.js';
|
|
15
15
|
|
|
16
16
|
// using forwardRef is important so that other components can autofocus the input
|
|
@@ -46,7 +46,8 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
46
46
|
...inputProps
|
|
47
47
|
}, ref) => {
|
|
48
48
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
49
|
-
const inputRef =
|
|
49
|
+
const inputRef = useRef(null);
|
|
50
|
+
const combinedRef = useCombinedRefs(inputRef, ref);
|
|
50
51
|
const [characterCount, setCharacterCount] = useState('');
|
|
51
52
|
const [isOverLimit, setIsOverLimit] = useState(false);
|
|
52
53
|
const [screenReaderMessage, setScreenReaderMessage] = useState('');
|
|
@@ -144,10 +145,8 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
144
145
|
hasLoadingIndicator: typeof loading === 'boolean',
|
|
145
146
|
id: leadingVisualId,
|
|
146
147
|
children: typeof LeadingVisual !== 'string' && isValidElementType(LeadingVisual) ? /*#__PURE__*/jsx(LeadingVisual, {}) : LeadingVisual
|
|
147
|
-
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
148
|
-
|
|
149
|
-
, {
|
|
150
|
-
ref: inputRef,
|
|
148
|
+
}), /*#__PURE__*/jsx(UnstyledTextInput, {
|
|
149
|
+
ref: combinedRef,
|
|
151
150
|
disabled: disabled,
|
|
152
151
|
onFocus: handleInputFocus,
|
|
153
152
|
onBlur: handleInputBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,KAAK,yBAAyB,EAAS,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAG7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC5C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAE3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAgRD,CAAA"}
|
|
@@ -9,7 +9,7 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
9
9
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { useId } from '../hooks/useId.js';
|
|
12
|
-
import {
|
|
12
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
13
13
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
14
14
|
import { useIsMacOS } from '../hooks/useIsMacOS.js';
|
|
15
15
|
import { getAccessibleKeybindingHintString, KeybindingHint } from '../KeybindingHint/KeybindingHint.js';
|
|
@@ -90,7 +90,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
90
90
|
}, forwardedRef) => {
|
|
91
91
|
const tooltipId = useId(id);
|
|
92
92
|
const child = Children.only(children);
|
|
93
|
-
const triggerRef =
|
|
93
|
+
const triggerRef = useRef(null);
|
|
94
|
+
const combinedTriggerRef = useCombinedRefs(triggerRef, forwardedRef);
|
|
94
95
|
const tooltipElRef = useRef(null);
|
|
95
96
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
96
97
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -203,8 +204,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
203
204
|
/*#__PURE__*/
|
|
204
205
|
// eslint-disable-next-line react-hooks/refs
|
|
205
206
|
React.cloneElement(child, {
|
|
206
|
-
|
|
207
|
-
ref: triggerRef,
|
|
207
|
+
ref: combinedTriggerRef,
|
|
208
208
|
// If it is a type description, we use tooltip to describe the trigger
|
|
209
209
|
'aria-describedby': (() => {
|
|
210
210
|
// If tooltip is not a description type, keep the original aria-describedby
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/deprecated/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAEtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAC,OAAO,EAAC,MAAM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AAC,OAAO;;;;;gBAhBD,SAAS;;;CAuEgD,CAAA"}
|
|
@@ -2,10 +2,10 @@ import { c } from 'react-compiler-runtime';
|
|
|
2
2
|
import { List } from './ActionList/List.js';
|
|
3
3
|
import { Item } from './ActionList/Item.js';
|
|
4
4
|
import { Divider } from './ActionList/Divider.js';
|
|
5
|
-
import 'react';
|
|
5
|
+
import { useRef } from 'react';
|
|
6
6
|
import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
import {
|
|
8
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs.js';
|
|
9
9
|
import { ButtonComponent } from '../Button/Button.js';
|
|
10
10
|
import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
|
|
11
11
|
|
|
@@ -75,7 +75,8 @@ const ActionMenuBase = t0 => {
|
|
|
75
75
|
}
|
|
76
76
|
const renderAnchor = t1 === undefined ? defaultRenderAnchor : t1;
|
|
77
77
|
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate(open, setOpen, false);
|
|
78
|
-
const anchorRef =
|
|
78
|
+
const anchorRef = useRef(null);
|
|
79
|
+
const combinedRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
79
80
|
let t2;
|
|
80
81
|
if ($[10] !== setCombinedOpenState) {
|
|
81
82
|
t2 = () => setCombinedOpenState(true);
|
|
@@ -161,18 +162,18 @@ const ActionMenuBase = t0 => {
|
|
|
161
162
|
t6 = $[26];
|
|
162
163
|
}
|
|
163
164
|
let t7;
|
|
164
|
-
if ($[27] !==
|
|
165
|
+
if ($[27] !== combinedOpenState || $[28] !== combinedRef || $[29] !== onClose || $[30] !== onOpen || $[31] !== overlayProps || $[32] !== renderMenuAnchor || $[33] !== t6) {
|
|
165
166
|
t7 = /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
166
167
|
renderAnchor: renderMenuAnchor,
|
|
167
|
-
anchorRef:
|
|
168
|
+
anchorRef: combinedRef,
|
|
168
169
|
open: combinedOpenState,
|
|
169
170
|
onOpen: onOpen,
|
|
170
171
|
onClose: onClose,
|
|
171
172
|
overlayProps: overlayProps,
|
|
172
173
|
children: t6
|
|
173
174
|
});
|
|
174
|
-
$[27] =
|
|
175
|
-
$[28] =
|
|
175
|
+
$[27] = combinedOpenState;
|
|
176
|
+
$[28] = combinedRef;
|
|
176
177
|
$[29] = onClose;
|
|
177
178
|
$[30] = onOpen;
|
|
178
179
|
$[31] = overlayProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../../src/experimental/SelectPanel2/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../../src/experimental/SelectPanel2/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAA;AAG/E,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAmB,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAA;AAevG,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAMvD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAA;AAInE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AA2BvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,eAAe,CAAC,UAAU,GAAG,OAAO,EAAE,aAAa,GAAG,cAAc,CAAC,CAAA;IACtG,gBAAgB,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;IACpD,EAAE,CAAC,EA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E,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;CACvC,GACD;IACE,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,EAAE,SAAS,GAAG,OAAO,CAAA;CAC7B,CACJ,CAAA;AAqCD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;iBAtRoE,MAAM,IAAI;;;;;;;;;4BA6NxC,KAAK,CAAC,iBAAiB;;;CAiEnF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { AlertIcon, SearchIcon, XCircleFillIcon, ArrowLeftIcon, FilterRemoveIcon, XIcon } from '@primer/octicons-react';
|
|
3
3
|
import { ActionListContainerContext } from '../../ActionList/ActionListContainerContext.js';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
@@ -10,7 +10,7 @@ import { clsx } from 'clsx';
|
|
|
10
10
|
import classes from './SelectPanel.module.css.js';
|
|
11
11
|
import { isSlot } from '../../utils/is-slot.js';
|
|
12
12
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
|
|
14
14
|
import { useId } from '../../hooks/useId.js';
|
|
15
15
|
import { useAnchoredPosition } from '../../hooks/useAnchoredPosition.js';
|
|
16
16
|
import { AriaStatus } from '../../live-region/AriaStatus.js';
|
|
@@ -79,7 +79,8 @@ const Panel = ({
|
|
|
79
79
|
// with additional props for accessibility
|
|
80
80
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
81
|
let Anchor;
|
|
82
|
-
const anchorRef =
|
|
82
|
+
const anchorRef = useRef(null);
|
|
83
|
+
const combinedRef = useCombinedRefs(providedAnchorRef, anchorRef);
|
|
83
84
|
const onAnchorClick = () => {
|
|
84
85
|
if (!internalOpen) setInternalOpen(true);else onInternalCancel();
|
|
85
86
|
};
|
|
@@ -88,7 +89,7 @@ const Panel = ({
|
|
|
88
89
|
// eslint-disable-next-line react-hooks/immutability
|
|
89
90
|
Anchor = /*#__PURE__*/React.cloneElement(child, {
|
|
90
91
|
// @ts-ignore TODO
|
|
91
|
-
ref:
|
|
92
|
+
ref: combinedRef,
|
|
92
93
|
onClick: child.props.onClick || onAnchorClick,
|
|
93
94
|
'aria-haspopup': true,
|
|
94
95
|
'aria-expanded': internalOpen
|
|
@@ -66,7 +66,7 @@ declare function useTabList<T extends HTMLElement>(props: TabListProps & {
|
|
|
66
66
|
'aria-orientation': AriaAttributes['aria-orientation'];
|
|
67
67
|
'aria-label': AriaAttributes['aria-label'];
|
|
68
68
|
'aria-labelledby': AriaAttributes['aria-labelledby'];
|
|
69
|
-
ref: React.
|
|
69
|
+
ref: React.Ref<T>;
|
|
70
70
|
role: 'tablist';
|
|
71
71
|
};
|
|
72
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAA;AAKd;;GAEG;AACH,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAA;IAEpB;;OAEG;IACH,aAAa,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAA;CAClD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+BD,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAC,CAAA;AACtE,YAAY,EAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useId, createContext, useContext } from 'react';
|
|
2
|
+
import React, { useId, useRef, createContext, useContext } from 'react';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../../utils/useIsomorphicLayoutEffect.js';
|
|
4
4
|
import { useControllableState } from '../../hooks/useControllableState.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
6
|
+
import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The Tabs component provides the base structure for a tabbed interface, without providing any formal requirement on DOM structure or styling.
|
|
@@ -87,15 +87,16 @@ function Tabs(props) {
|
|
|
87
87
|
return t5;
|
|
88
88
|
}
|
|
89
89
|
function useTabList(props) {
|
|
90
|
-
const $ = c(
|
|
90
|
+
const $ = c(8);
|
|
91
91
|
const {
|
|
92
92
|
"aria-label": ariaLabel,
|
|
93
93
|
"aria-labelledby": ariaLabelledby,
|
|
94
94
|
"aria-orientation": ariaOrientation
|
|
95
95
|
} = props;
|
|
96
|
-
const ref =
|
|
96
|
+
const ref = useRef(null);
|
|
97
|
+
const combinedRef = useCombinedRefs(ref, props.ref);
|
|
97
98
|
let t0;
|
|
98
|
-
if ($[0] !== ariaOrientation
|
|
99
|
+
if ($[0] !== ariaOrientation) {
|
|
99
100
|
t0 = event => {
|
|
100
101
|
const {
|
|
101
102
|
current: tablist
|
|
@@ -142,18 +143,17 @@ function useTabList(props) {
|
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
145
|
$[0] = ariaOrientation;
|
|
145
|
-
$[1] =
|
|
146
|
-
$[2] = t0;
|
|
146
|
+
$[1] = t0;
|
|
147
147
|
} else {
|
|
148
|
-
t0 = $[
|
|
148
|
+
t0 = $[1];
|
|
149
149
|
}
|
|
150
150
|
const onKeyDown = t0;
|
|
151
151
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
152
152
|
let t2;
|
|
153
|
-
if ($[
|
|
153
|
+
if ($[2] !== ariaLabel || $[3] !== ariaLabelledby || $[4] !== combinedRef || $[5] !== onKeyDown || $[6] !== t1) {
|
|
154
154
|
t2 = {
|
|
155
155
|
tabListProps: {
|
|
156
|
-
ref,
|
|
156
|
+
ref: combinedRef,
|
|
157
157
|
"aria-label": ariaLabel,
|
|
158
158
|
"aria-labelledby": ariaLabelledby,
|
|
159
159
|
"aria-orientation": t1,
|
|
@@ -161,14 +161,14 @@ function useTabList(props) {
|
|
|
161
161
|
onKeyDown
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
164
|
+
$[2] = ariaLabel;
|
|
165
|
+
$[3] = ariaLabelledby;
|
|
166
|
+
$[4] = combinedRef;
|
|
166
167
|
$[5] = onKeyDown;
|
|
167
|
-
$[6] =
|
|
168
|
-
$[7] =
|
|
169
|
-
$[8] = t2;
|
|
168
|
+
$[6] = t1;
|
|
169
|
+
$[7] = t2;
|
|
170
170
|
} else {
|
|
171
|
-
t2 = $[
|
|
171
|
+
t2 = $[7];
|
|
172
172
|
}
|
|
173
173
|
return t2;
|
|
174
174
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getAnchoredPosition } from '@primer/behaviors';
|
|
3
|
-
import { useProvidedRefOrCreate } from './useProvidedRefOrCreate.js';
|
|
4
3
|
import { useResizeObserver } from './useResizeObserver.js';
|
|
5
4
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
5
|
+
import { useProvidedRefOrCreate } from './useProvidedRefOrCreate.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Calculates the top and left values for an absolutely-positioned floating element
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAElD;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAE/B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACpD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,CAAC,EAAE,qBAAqB,EAChC,YAAY,GAAE,KAAK,CAAC,cAAmB,GACtC;IAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAC,
|
|
1
|
+
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAElD;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAE/B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACpD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,CAAC,EAAE,qBAAqB,EAChC,YAAY,GAAE,KAAK,CAAC,cAAmB,GACtC;IAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAC,CA4D3G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { focusTrap } from '@primer/behaviors';
|
|
3
|
-
import { useProvidedRefOrCreate } from './useProvidedRefOrCreate.js';
|
|
4
3
|
import { useOnOutsideClick } from './useOnOutsideClick.js';
|
|
4
|
+
import { useProvidedRefOrCreate } from './useProvidedRefOrCreate.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Hook used to trap focus inside a container. Returns a ref that can be added to the container
|
|
@@ -6,6 +6,18 @@ import React from 'react';
|
|
|
6
6
|
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
7
7
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
8
8
|
* @type TRef The type of the RefObject which should be created.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useCombinedRefs` with an internally
|
|
11
|
+
* created ref instead.
|
|
12
|
+
*
|
|
13
|
+
* ```diff
|
|
14
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
15
|
+
* + const ref = useRef(null)
|
|
16
|
+
* + const combinedRef = useCombinedRefs(forwardedRef, ref)
|
|
17
|
+
*
|
|
18
|
+
* - return <div ref={ref} />
|
|
19
|
+
* + return <div ref={combinedRef} />
|
|
20
|
+
* ```
|
|
9
21
|
*/
|
|
10
22
|
export declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
11
23
|
//# sourceMappingURL=useProvidedRefOrCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB
|
|
1
|
+
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAGrH"}
|
|
@@ -7,6 +7,18 @@ import React from 'react';
|
|
|
7
7
|
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
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
|
+
*
|
|
11
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useCombinedRefs` with an internally
|
|
12
|
+
* created ref instead.
|
|
13
|
+
*
|
|
14
|
+
* ```diff
|
|
15
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
+
* + const ref = useRef(null)
|
|
17
|
+
* + const combinedRef = useCombinedRefs(forwardedRef, ref)
|
|
18
|
+
*
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={combinedRef} />
|
|
21
|
+
* ```
|
|
10
22
|
*/
|
|
11
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
12
24
|
const createdRef = React.useRef(null);
|
package/package.json
CHANGED