@primer/react 0.0.0-20260626180846 → 0.0.0-20260626210038
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/ActionBar/ActionBar.js +1 -1
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +45 -46
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +6 -4
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +5 -7
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +4 -3
- 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 +10 -13
- package/dist/Dialog/Dialog.js +4 -6
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +7 -5
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/FilteredActionList/FilteredActionListInput.d.ts.map +1 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +2 -16
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +30 -31
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -7
- package/dist/TextInputWithTokens/TextInputWithTokens.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/experimental/Tabs/useTabList.d.ts.map +1 -1
- package/dist/experimental/Tabs/useTabList.js +15 -15
- package/dist/hooks/useMergedRefs.d.ts +4 -4
- package/dist/hooks/useMergedRefs.d.ts.map +1 -1
- package/dist/hooks/useMergedRefs.js +10 -6
- package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +10 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260626210038
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
|
|
37
37
|
- [#7935](https://github.com/primer/react/pull/7935) [`5b3c806`](https://github.com/primer/react/commit/5b3c806305cfa09d33d42fc2957d55105725ea3b) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - ConfirmationDialog: `useConfirm`/`confirm` now removes its host element from `document.body` after the dialog is closed, and uses a fresh host element per call, so the empty container no longer lingers or leaks into other components and tests
|
|
38
38
|
|
|
39
|
-
- [#8065](https://github.com/primer/react/pull/8065) [`2417955`](https://github.com/primer/react/commit/2417955a516978edb655f80e4eaa9be0906c6822) Thanks [@llastflowers](https://github.com/llastflowers)! - Update internal implementations of combined refs to improve performance and add support for React 19 callback refs
|
|
40
|
-
|
|
41
39
|
- Fake entry to force publishing
|
|
42
40
|
|
|
43
41
|
- [#8007](https://github.com/primer/react/pull/8007) [`f052126`](https://github.com/primer/react/commit/f0521263c85a8d665f7c031bd711b3568bdac8e2) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Improve style-recalc performance by making ButtonGroup, DataTable Pagination, and Checkbox CSS selectors bucketable (removing universal `*`/`:not([attr])` subjects and `:is()` selector-list merges)
|
|
@@ -329,7 +329,7 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
|
329
329
|
...props
|
|
330
330
|
}, forwardedRef) => {
|
|
331
331
|
const ref = useRef(null);
|
|
332
|
-
const mergedRef = useMergedRefs(
|
|
332
|
+
const mergedRef = useMergedRefs(forwardedRef, ref);
|
|
333
333
|
const {
|
|
334
334
|
size
|
|
335
335
|
} = React.useContext(ActionBarContext);
|
|
@@ -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;AAwH7C,QAAA,MAAM,IAAI,GA1Ga,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;oDA0GR,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';
|
|
@@ -11,13 +11,13 @@ import { clsx } from 'clsx';
|
|
|
11
11
|
import classes from './ActionList.module.css.js';
|
|
12
12
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
-
import {
|
|
14
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
15
15
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
16
16
|
import { FocusKeys } from '@primer/behaviors';
|
|
17
17
|
|
|
18
18
|
const UnwrappedList = (props, forwardedRef) => {
|
|
19
19
|
var _slots$heading$props$;
|
|
20
|
-
const $ = c(
|
|
20
|
+
const $ = c(38);
|
|
21
21
|
let className;
|
|
22
22
|
let restProps;
|
|
23
23
|
let role;
|
|
@@ -80,7 +80,8 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
80
80
|
} = React.useContext(ActionListContainerContext);
|
|
81
81
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
82
82
|
const listRole = role || listRoleFromContainer;
|
|
83
|
-
const listRef =
|
|
83
|
+
const listRef = useRef(null);
|
|
84
|
+
const mergedRef = useMergedRefs(forwardedRef, listRef);
|
|
84
85
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
85
86
|
let enableFocusZone = false;
|
|
86
87
|
if (enableFocusZoneFromContainer !== undefined) {
|
|
@@ -100,24 +101,23 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
100
101
|
const t5 = !enableFocusZone;
|
|
101
102
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
|
|
102
103
|
let t7;
|
|
103
|
-
if ($[11] !==
|
|
104
|
+
if ($[11] !== t5 || $[12] !== t6) {
|
|
104
105
|
t7 = {
|
|
105
106
|
disabled: t5,
|
|
106
107
|
containerRef: listRef,
|
|
107
108
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
108
109
|
focusOutBehavior: t6
|
|
109
110
|
};
|
|
110
|
-
$[11] =
|
|
111
|
-
$[12] =
|
|
112
|
-
$[13] =
|
|
113
|
-
$[14] = t7;
|
|
111
|
+
$[11] = t5;
|
|
112
|
+
$[12] = t6;
|
|
113
|
+
$[13] = t7;
|
|
114
114
|
} else {
|
|
115
|
-
t7 = $[
|
|
115
|
+
t7 = $[13];
|
|
116
116
|
}
|
|
117
117
|
useFocusZone(t7);
|
|
118
118
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
119
119
|
let t9;
|
|
120
|
-
if ($[
|
|
120
|
+
if ($[14] !== headingId || $[15] !== listRole || $[16] !== showDividers || $[17] !== t8 || $[18] !== variant) {
|
|
121
121
|
t9 = {
|
|
122
122
|
variant,
|
|
123
123
|
selectionVariant: t8,
|
|
@@ -125,18 +125,18 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
125
125
|
role: listRole,
|
|
126
126
|
headingId
|
|
127
127
|
};
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
128
|
+
$[14] = headingId;
|
|
129
|
+
$[15] = listRole;
|
|
130
|
+
$[16] = showDividers;
|
|
131
|
+
$[17] = t8;
|
|
132
|
+
$[18] = variant;
|
|
133
|
+
$[19] = t9;
|
|
134
134
|
} else {
|
|
135
|
-
t9 = $[
|
|
135
|
+
t9 = $[19];
|
|
136
136
|
}
|
|
137
137
|
const listContextValue = t9;
|
|
138
138
|
let t10;
|
|
139
|
-
if ($[
|
|
139
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
140
140
|
t10 = () => {
|
|
141
141
|
const list = listRef.current;
|
|
142
142
|
if (!list) {
|
|
@@ -152,29 +152,28 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
$[
|
|
156
|
-
$[22] = t10;
|
|
155
|
+
$[20] = t10;
|
|
157
156
|
} else {
|
|
158
|
-
t10 = $[
|
|
157
|
+
t10 = $[20];
|
|
159
158
|
}
|
|
160
159
|
useIsomorphicLayoutEffect(t10);
|
|
161
160
|
const t11 = slots.heading;
|
|
162
161
|
let t12;
|
|
163
|
-
if ($[
|
|
162
|
+
if ($[21] !== className) {
|
|
164
163
|
t12 = clsx(classes.ActionList, className);
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
164
|
+
$[21] = className;
|
|
165
|
+
$[22] = t12;
|
|
167
166
|
} else {
|
|
168
|
-
t12 = $[
|
|
167
|
+
t12 = $[22];
|
|
169
168
|
}
|
|
170
169
|
const t13 = itemGapEnabled ? "" : undefined;
|
|
171
170
|
let t14;
|
|
172
|
-
if ($[
|
|
171
|
+
if ($[23] !== Component || $[24] !== ariaLabelledBy || $[25] !== childrenWithoutSlots || $[26] !== listRole || $[27] !== mergedRef || $[28] !== restProps || $[29] !== showDividers || $[30] !== t12 || $[31] !== t13 || $[32] !== variant) {
|
|
173
172
|
t14 = /*#__PURE__*/jsx(Component, {
|
|
174
173
|
className: t12,
|
|
175
174
|
role: listRole,
|
|
176
175
|
"aria-labelledby": ariaLabelledBy,
|
|
177
|
-
ref:
|
|
176
|
+
ref: mergedRef,
|
|
178
177
|
"data-component": "ActionList",
|
|
179
178
|
"data-dividers": showDividers,
|
|
180
179
|
"data-variant": variant,
|
|
@@ -182,32 +181,32 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
182
181
|
...restProps,
|
|
183
182
|
children: childrenWithoutSlots
|
|
184
183
|
});
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
184
|
+
$[23] = Component;
|
|
185
|
+
$[24] = ariaLabelledBy;
|
|
186
|
+
$[25] = childrenWithoutSlots;
|
|
187
|
+
$[26] = listRole;
|
|
188
|
+
$[27] = mergedRef;
|
|
189
|
+
$[28] = restProps;
|
|
190
|
+
$[29] = showDividers;
|
|
191
|
+
$[30] = t12;
|
|
192
|
+
$[31] = t13;
|
|
193
|
+
$[32] = variant;
|
|
194
|
+
$[33] = t14;
|
|
196
195
|
} else {
|
|
197
|
-
t14 = $[
|
|
196
|
+
t14 = $[33];
|
|
198
197
|
}
|
|
199
198
|
let t15;
|
|
200
|
-
if ($[
|
|
199
|
+
if ($[34] !== listContextValue || $[35] !== slots.heading || $[36] !== t14) {
|
|
201
200
|
t15 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
202
201
|
value: listContextValue,
|
|
203
202
|
children: [t11, t14]
|
|
204
203
|
});
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
204
|
+
$[34] = listContextValue;
|
|
205
|
+
$[35] = slots.heading;
|
|
206
|
+
$[36] = t14;
|
|
207
|
+
$[37] = t15;
|
|
209
208
|
} else {
|
|
210
|
-
t15 = $[
|
|
209
|
+
t15 = $[37];
|
|
211
210
|
}
|
|
212
211
|
return t15;
|
|
213
212
|
};
|
|
@@ -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,EAAmC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAChE,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,WAAW,CAAA;AAQ1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,EAChG,KAAK,EAAE,CAAC,KACL,GAAG,CAAC,OAAO,CAAA;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAE/C;;OAEG;IAC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Create } from '../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
15
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
15
16
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
16
17
|
import Overlay from '../Overlay/Overlay.js';
|
|
17
18
|
|
|
@@ -67,6 +68,7 @@ const AnchoredOverlay = ({
|
|
|
67
68
|
setAnchorElement(anchorRef.current);
|
|
68
69
|
}
|
|
69
70
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
71
|
+
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
70
72
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
71
73
|
const anchorId = useId(externalAnchorId);
|
|
72
74
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
|
|
@@ -265,12 +267,12 @@ const AnchoredOverlay = ({
|
|
|
265
267
|
...(shouldRenderAsPopover ? {
|
|
266
268
|
id: popoverId
|
|
267
269
|
} : {}),
|
|
270
|
+
...(cssAnchorPositioning ? {
|
|
271
|
+
id: popoverId
|
|
272
|
+
} : {}),
|
|
268
273
|
ref: node => {
|
|
269
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
270
|
-
assignRef(overlayProps.ref, node);
|
|
271
|
-
}
|
|
272
|
-
updateOverlayRef(node);
|
|
273
274
|
setOverlayElement(node);
|
|
275
|
+
assignRef(mergedOverlayRef, node);
|
|
274
276
|
},
|
|
275
277
|
"data-anchor-position": cssAnchorPositioning,
|
|
276
278
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteInput.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqD,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAGlD,KAAK,8BAA8B,GAAG;IAEpC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAID,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AutocompleteInput.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqD,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAGlD,KAAK,8BAA8B,GAAG;IAEpC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAID,QAAA,MAAM,iBAAiB,EA6KlB,8BAA8B,CAAC,OAAO,SAAS,EAAE,8BAA8B,CAAC,CAAA;AAIrF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC7E,eAAe,iBAAiB,CAAA"}
|
|
@@ -50,13 +50,11 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
50
50
|
const handleInputBlur = useCallback(event => {
|
|
51
51
|
onBlur && onBlur(event);
|
|
52
52
|
|
|
53
|
-
// HACK: wait a tick
|
|
54
|
-
//
|
|
55
|
-
//
|
|
53
|
+
// HACK: wait a tick and check the focused element before hiding the autocomplete menu
|
|
54
|
+
// this prevents the menu from hiding when the user is clicking an option in the Autoselect.Menu,
|
|
55
|
+
// but still hides the menu when the user blurs the input by tabbing out or clicking somewhere else on the page
|
|
56
56
|
safeSetTimeout(() => {
|
|
57
|
-
|
|
58
|
-
const menuElement = document.getElementById(`${id}-listbox`);
|
|
59
|
-
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
57
|
+
if (document.activeElement !== inputRef.current) {
|
|
60
58
|
setShowMenu(false);
|
|
61
59
|
|
|
62
60
|
// Reset the input's value to the text the user actually typed rather than leaving the
|
|
@@ -68,7 +66,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
}, 0);
|
|
71
|
-
}, [onBlur, setShowMenu, inputRef, safeSetTimeout, autocompleteSuggestion, inputValue
|
|
69
|
+
}, [onBlur, setShowMenu, inputRef, safeSetTimeout, autocompleteSuggestion, inputValue]);
|
|
72
70
|
const handleInputChange = event => {
|
|
73
71
|
onChange && onChange(event);
|
|
74
72
|
setInputValue(event.currentTarget.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EA6JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|
|
@@ -46,7 +46,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
46
46
|
...rest
|
|
47
47
|
} = props;
|
|
48
48
|
const innerRef = React.useRef(null);
|
|
49
|
-
const
|
|
49
|
+
const mergedRef = useMergedRefs(forwardedRef, innerRef);
|
|
50
50
|
const uuid = useId(id);
|
|
51
51
|
const loadingAnnouncementID = `${uuid}-loading-announcement`;
|
|
52
52
|
|
|
@@ -75,7 +75,8 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
"aria-disabled": loading ? true : undefined,
|
|
76
76
|
"data-component": "Button",
|
|
77
77
|
...rest,
|
|
78
|
-
|
|
78
|
+
// @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent
|
|
79
|
+
ref: mergedRef,
|
|
79
80
|
className: clsx(classes.ButtonBase, className),
|
|
80
81
|
"data-block": block ? 'block' : null,
|
|
81
82
|
"data-inactive": inactive ? true : undefined,
|
|
@@ -105,7 +106,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
105
106
|
className: classes.ButtonContent,
|
|
106
107
|
children: [
|
|
107
108
|
/* If there are no leading/trailing visuals/actions to replace with a loading spinner,
|
|
108
|
-
render a loading
|
|
109
|
+
render a loading spiner in place of the button content. */
|
|
109
110
|
loading && !LeadingVisual && !TrailingVisual && !TrailingAction && count === undefined && renderModuleVisual(Spinner, loading, 'loadingSpinner', false),
|
|
110
111
|
/* Render a leading visual unless the button is in a loading state.
|
|
111
112
|
Then replace the leading visual with a loading spinner. */
|
|
@@ -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,EA8BX,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 { useMergedRefs } from '../hooks/useMergedRefs.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;
|
|
@@ -36,6 +36,8 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
|
|
|
36
36
|
t1 = $[5];
|
|
37
37
|
}
|
|
38
38
|
const BaseComponent = t1 === undefined ? "div" : t1;
|
|
39
|
+
const buttonRef = useRef(null);
|
|
40
|
+
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
39
41
|
let t2;
|
|
40
42
|
if ($[6] !== children) {
|
|
41
43
|
t2 = React.Children.map(children, _temp);
|
|
@@ -45,50 +47,48 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
|
|
|
45
47
|
t2 = $[7];
|
|
46
48
|
}
|
|
47
49
|
const buttons = t2;
|
|
48
|
-
const buttonRef = useProvidedRefOrCreate(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] !== mergedRef || $[15] !== rest || $[16] !== role || $[17] !== t5) {
|
|
75
75
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
76
|
-
ref:
|
|
76
|
+
ref: mergedRef,
|
|
77
77
|
className: t5,
|
|
78
78
|
role: role,
|
|
79
79
|
...rest,
|
|
80
80
|
"data-component": "ButtonGroup",
|
|
81
81
|
children: buttons
|
|
82
82
|
});
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
83
|
+
$[12] = BaseComponent;
|
|
84
|
+
$[13] = buttons;
|
|
85
|
+
$[14] = mergedRef;
|
|
86
|
+
$[15] = rest;
|
|
87
|
+
$[16] = role;
|
|
88
|
+
$[17] = t5;
|
|
89
|
+
$[18] = t6;
|
|
90
90
|
} else {
|
|
91
|
-
t6 = $[
|
|
91
|
+
t6 = $[18];
|
|
92
92
|
}
|
|
93
93
|
return t6;
|
|
94
94
|
});
|
|
@@ -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;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAA;AAE3D;;GAEG;AACH,QAAA,MAAM,QAAQ,qGAuEb,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 { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
@@ -25,7 +25,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
25
25
|
}, ref
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
27
|
) => {
|
|
28
|
-
const checkboxRef =
|
|
28
|
+
const checkboxRef = useRef(null);
|
|
29
|
+
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
29
30
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
30
31
|
const handleOnChange = e => {
|
|
31
32
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -38,7 +39,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
38
39
|
const inputProps = {
|
|
39
40
|
type: 'checkbox',
|
|
40
41
|
disabled,
|
|
41
|
-
ref:
|
|
42
|
+
ref: mergedRef,
|
|
42
43
|
checked: indeterminate ? false : checked,
|
|
43
44
|
defaultChecked,
|
|
44
45
|
required,
|
|
@@ -67,15 +68,11 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
67
68
|
checkbox.setAttribute('aria-checked', checkbox.checked ? 'true' : 'false');
|
|
68
69
|
}
|
|
69
70
|
});
|
|
70
|
-
return (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"data-component": dataComponent !== null && dataComponent !== void 0 ? dataComponent : 'Checkbox',
|
|
76
|
-
className: clsx(className, sharedClasses.Input, classes.Checkbox)
|
|
77
|
-
})
|
|
78
|
-
);
|
|
71
|
+
return /*#__PURE__*/jsx("input", {
|
|
72
|
+
...inputProps,
|
|
73
|
+
"data-component": dataComponent !== null && dataComponent !== void 0 ? dataComponent : 'Checkbox',
|
|
74
|
+
className: clsx(className, sharedClasses.Input, classes.Checkbox)
|
|
75
|
+
});
|
|
79
76
|
});
|
|
80
77
|
Checkbox.displayName = 'Checkbox';
|
|
81
78
|
Checkbox.__SLOT__ = Symbol('Checkbox');
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -16,7 +16,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
16
16
|
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
17
17
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
18
18
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
19
|
-
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
20
19
|
|
|
21
20
|
let dialogScrollDisabledCount = 0;
|
|
22
21
|
const widthMap = {
|
|
@@ -323,7 +322,8 @@ const Buttons = ({
|
|
|
323
322
|
buttons
|
|
324
323
|
}) => {
|
|
325
324
|
var _buttons$find;
|
|
326
|
-
const autoFocusRef =
|
|
325
|
+
const autoFocusRef = useRef(null);
|
|
326
|
+
const mergedRef = useMergedRefs(autoFocusRef, (_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
327
327
|
let autoFocusCount = 0;
|
|
328
328
|
const [hasRendered, setHasRendered] = useState(0);
|
|
329
329
|
useEffect(() => {
|
|
@@ -348,10 +348,8 @@ const Buttons = ({
|
|
|
348
348
|
"data-component": "Dialog.FooterButton",
|
|
349
349
|
...buttonProps,
|
|
350
350
|
// 'normal' value is equivalent to 'default', this is used for backwards compatibility
|
|
351
|
-
variant: buttonType === 'normal' ? 'default' : buttonType
|
|
352
|
-
|
|
353
|
-
,
|
|
354
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
351
|
+
variant: buttonType === 'normal' ? 'default' : buttonType,
|
|
352
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, mergedRef) : null,
|
|
355
353
|
children: content
|
|
356
354
|
}, index);
|
|
357
355
|
})
|
|
@@ -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;AAChD,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,MAA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e,EACf,gBAAyB,EACzB,uBAA6C,EAC7C,yBAAyB,EACzB,oBAA4B,EAC5B,eAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,WAAmB,EACnB,GAAG,SAAS,EACb,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAobvC;yBAnde,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 { FilteredActionListBodyLoader } from './FilteredActionListLoaders.js';
|
|
@@ -16,6 +15,7 @@ import { clsx } from 'clsx';
|
|
|
16
15
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
17
16
|
import { FilteredActionListInput } from './FilteredActionListInput.js';
|
|
18
17
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
18
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
19
19
|
import { FilteredActionListLoadingTypes } from './constants.js';
|
|
20
20
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
21
21
|
import Checkbox from '../Checkbox/Checkbox.js';
|
|
@@ -74,8 +74,10 @@ function FilteredActionList({
|
|
|
74
74
|
}, [onFilterChange, setInternalFilterValue]);
|
|
75
75
|
const inputAndListContainerRef = useRef(null);
|
|
76
76
|
const listRef = useRef(null);
|
|
77
|
-
const scrollContainerRef =
|
|
78
|
-
const
|
|
77
|
+
const scrollContainerRef = useRef(null);
|
|
78
|
+
const combinedScrollContainerRef = useMergedRefs(scrollContainerRef, providedScrollContainerRef);
|
|
79
|
+
const inputRef = useRef(null);
|
|
80
|
+
const combinedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
79
81
|
const usingRovingTabindex = _PrivateFocusManagement === 'roving-tabindex';
|
|
80
82
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
81
83
|
const activeDescendantRef = useRef();
|
|
@@ -394,7 +396,7 @@ function FilteredActionList({
|
|
|
394
396
|
"data-testid": "filtered-action-list",
|
|
395
397
|
"data-component": "FilteredActionList",
|
|
396
398
|
children: [/*#__PURE__*/jsx(FilteredActionListInput, {
|
|
397
|
-
inputRef:
|
|
399
|
+
inputRef: combinedInputRef,
|
|
398
400
|
value: filterValue,
|
|
399
401
|
onInputChange: onInputChange,
|
|
400
402
|
onInputKeyPress: onInputKeyPress,
|
|
@@ -425,7 +427,7 @@ function FilteredActionList({
|
|
|
425
427
|
children: selectAllLabelText
|
|
426
428
|
})]
|
|
427
429
|
}), /*#__PURE__*/jsx("div", {
|
|
428
|
-
ref:
|
|
430
|
+
ref: combinedScrollContainerRef,
|
|
429
431
|
className: classes.Container,
|
|
430
432
|
children: getBodyContent()
|
|
431
433
|
})]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { TextInputProps } from '../TextInput';
|
|
3
3
|
export interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
4
|
-
inputRef: React.
|
|
4
|
+
inputRef: React.Ref<HTMLInputElement | null>;
|
|
5
5
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
6
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
7
7
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredActionListInput.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionListInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO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lD"}
|
package/dist/Link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAC,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAI/D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,KAAK,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IACzD,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,EAC9D,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,EACjD,KAAK,YAAY,CAAC,OAAO,CAAC,sBAiC3B,CAAA;AAID,QAAA,MAAM,IAAI,IAvCoB,EAAE,SAAS,KAAK,CAAC,WAAW;;;;CAuCM,CAAA;AAEhE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,eAAe,IAAI,CAAA"}
|
package/dist/Link/Link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
4
4
|
import classes from './Link.module.css.js';
|
|
5
5
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
@@ -17,21 +17,6 @@ const UnwrappedLink = (props, ref) => {
|
|
|
17
17
|
} = props;
|
|
18
18
|
const innerRef = React.useRef(null);
|
|
19
19
|
const mergedRef = useMergedRefs(ref, innerRef);
|
|
20
|
-
if (process.env.NODE_ENV !== "production") {
|
|
21
|
-
/**
|
|
22
|
-
* The Linter yells because it thinks this conditionally calls an effect,
|
|
23
|
-
* but since this is a compile-time flag and not a runtime conditional
|
|
24
|
-
* this is safe, and ensures the entire effect is kept out of prod builds
|
|
25
|
-
* shaving precious bytes from the output, and avoiding mounting a noop effect
|
|
26
|
-
*/
|
|
27
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (innerRef.current && !(innerRef.current instanceof HTMLButtonElement) && !(innerRef.current instanceof HTMLAnchorElement)) {
|
|
30
|
-
// eslint-disable-next-line no-console
|
|
31
|
-
console.error('Error: Found `Link` component that renders an inaccessible element', innerRef.current, 'Please ensure `Link` always renders as <a> or <button>');
|
|
32
|
-
}
|
|
33
|
-
}, [innerRef]);
|
|
34
|
-
}
|
|
35
20
|
useDevOnlyEffect(() => {
|
|
36
21
|
if (innerRef.current && !(innerRef.current instanceof HTMLButtonElement) && !(innerRef.current instanceof HTMLAnchorElement)) {
|
|
37
22
|
// eslint-disable-next-line no-console
|
|
@@ -45,6 +30,7 @@ const UnwrappedLink = (props, ref) => {
|
|
|
45
30
|
"data-inline": inline,
|
|
46
31
|
"data-hover-color": hoverColor,
|
|
47
32
|
...restProps,
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
34
|
ref: mergedRef
|
|
49
35
|
});
|
|
50
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3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M,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;CAC7F,GAAG,iBAAiB,CAAA;AAoErB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC7C,GAAG,iBAAiB,CAAA;AAiDrB,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAuBrE,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;;;;;;;;;;;;+CA/GiC,YAAY;;;CA8HlE,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 { useMergedRefs } from '../hooks/useMergedRefs.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 mergedRef = useMergedRefs(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,27 +73,26 @@ 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] !== mergedRef || $[9] !== role || $[10] !== t4 || $[11] !== t5) {
|
|
94
94
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
95
|
-
ref:
|
|
95
|
+
ref: mergedRef,
|
|
96
96
|
className: t4,
|
|
97
97
|
"data-component": "PageHeader",
|
|
98
98
|
"data-has-border": t5,
|
|
@@ -100,16 +100,16 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
100
100
|
role: role,
|
|
101
101
|
children: children
|
|
102
102
|
});
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
103
|
+
$[5] = BaseComponent;
|
|
104
|
+
$[6] = ariaLabel;
|
|
105
|
+
$[7] = children;
|
|
106
|
+
$[8] = mergedRef;
|
|
106
107
|
$[9] = role;
|
|
107
|
-
$[10] =
|
|
108
|
-
$[11] =
|
|
109
|
-
$[12] =
|
|
110
|
-
$[13] = t6;
|
|
108
|
+
$[10] = t4;
|
|
109
|
+
$[11] = t5;
|
|
110
|
+
$[12] = t6;
|
|
111
111
|
} else {
|
|
112
|
-
t6 = $[
|
|
112
|
+
t6 = $[12];
|
|
113
113
|
}
|
|
114
114
|
return t6;
|
|
115
115
|
});
|
|
@@ -367,7 +367,6 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
367
367
|
} = t0;
|
|
368
368
|
const hidden = t1 === undefined ? false : t1;
|
|
369
369
|
const variant = t2 === undefined ? "medium" : t2;
|
|
370
|
-
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
371
370
|
let t3;
|
|
372
371
|
if ($[0] !== className) {
|
|
373
372
|
t3 = clsx(classes.TitleArea, className);
|
|
@@ -393,20 +392,20 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
393
392
|
t5 = $[5];
|
|
394
393
|
}
|
|
395
394
|
let t6;
|
|
396
|
-
if ($[6] !== children || $[7] !==
|
|
395
|
+
if ($[6] !== children || $[7] !== forwardedRef || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
|
|
397
396
|
t6 = /*#__PURE__*/jsx("div", {
|
|
398
397
|
className: t3,
|
|
399
|
-
ref:
|
|
398
|
+
ref: forwardedRef,
|
|
400
399
|
"data-component": "TitleArea",
|
|
401
400
|
...t4,
|
|
402
401
|
...t5,
|
|
403
402
|
children: children
|
|
404
403
|
});
|
|
405
404
|
$[6] = children;
|
|
406
|
-
$[7] =
|
|
407
|
-
$[8] =
|
|
408
|
-
$[9] =
|
|
409
|
-
$[10] =
|
|
405
|
+
$[7] = forwardedRef;
|
|
406
|
+
$[8] = t3;
|
|
407
|
+
$[9] = t4;
|
|
408
|
+
$[10] = t5;
|
|
410
409
|
$[11] = t6;
|
|
411
410
|
} else {
|
|
412
411
|
t6 = $[11];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAM/F,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAA;AAW/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;QAKI;IACJ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IAChD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CACT,IAAI,CACF,kBAAkB,EAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,CACrB,CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC,CAAA;;;;;;;;;;;AAyNzG,wBAGE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useId, useCallback } from 'react';
|
|
1
|
+
import React, { useState, useRef, useId, useCallback } from 'react';
|
|
2
2
|
import { isValidElementType } from 'react-is';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { AlertFillIcon } from '@primer/octicons-react';
|
|
@@ -11,7 +11,7 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
11
11
|
import visuallyHiddenClasses from '../_VisuallyHidden.module.css.js';
|
|
12
12
|
import { SCREEN_READER_DELAY, getCharacterCountState } from '../utils/character-counter.js';
|
|
13
13
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
14
|
-
import {
|
|
14
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
15
15
|
import { AriaStatus } from '../live-region/AriaStatus.js';
|
|
16
16
|
import Text from '../Text/Text.js';
|
|
17
17
|
|
|
@@ -50,7 +50,8 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
50
50
|
}, ref) => {
|
|
51
51
|
var _counter$isOverLimit;
|
|
52
52
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
53
|
-
const inputRef =
|
|
53
|
+
const inputRef = useRef(null);
|
|
54
|
+
const mergedRef = useMergedRefs(inputRef, ref);
|
|
54
55
|
|
|
55
56
|
// For uncontrolled usage we track the length of the input's content so the
|
|
56
57
|
// character counter can be derived during render rather than synced from an
|
|
@@ -130,10 +131,8 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
130
131
|
hasLoadingIndicator: typeof loading === 'boolean',
|
|
131
132
|
id: leadingVisualId,
|
|
132
133
|
children: typeof LeadingVisual !== 'string' && isValidElementType(LeadingVisual) ? /*#__PURE__*/jsx(LeadingVisual, {}) : LeadingVisual
|
|
133
|
-
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
134
|
-
|
|
135
|
-
, {
|
|
136
|
-
ref: inputRef,
|
|
134
|
+
}), /*#__PURE__*/jsx(UnstyledTextInput, {
|
|
135
|
+
ref: mergedRef,
|
|
137
136
|
disabled: disabled,
|
|
138
137
|
onFocus: handleInputFocus,
|
|
139
138
|
onBlur: handleInputBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputWithTokens.d.ts","sourceRoot":"","sources":["../../src/TextInputWithTokens/TextInputWithTokens.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6D,SAAS,E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GG;gBACS,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;IAC5C;;OAEG;2BACoB,OAAO;IAC9B;;OAEG;WACI,aAAa;IACpB;;OAEG;6BACsB,OAAO;IAChC;;OAEG;wBACiB,MAAM;yEAiTmD,CAAA;AAK/E;;GAEG;wBACmC,cAAc,CAAC,OAAO,mBAAmB,CAAC;AAAhF,wBAAgF"}
|
|
@@ -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;AAI7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAG9C,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,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IACjF;;;;;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;AAmEnC,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAmSD,CAAA"}
|
|
@@ -11,7 +11,7 @@ import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
|
11
11
|
import { TooltipContext } from './TooltipContext.js';
|
|
12
12
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
13
|
import { useId } from '../hooks/useId.js';
|
|
14
|
-
import {
|
|
14
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
15
15
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
16
16
|
import { getAccessibleKeybindingHintString } from '../KeybindingHint/utils.js';
|
|
17
17
|
import { KeybindingHint } from '../KeybindingHint/KeybindingHint.js';
|
|
@@ -92,7 +92,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
92
92
|
}, forwardedRef) => {
|
|
93
93
|
const tooltipId = useId(id);
|
|
94
94
|
const child = Children.only(children);
|
|
95
|
-
const triggerRef =
|
|
95
|
+
const triggerRef = useRef(null);
|
|
96
|
+
const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
|
|
96
97
|
const tooltipElRef = useRef(null);
|
|
97
98
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
98
99
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -206,8 +207,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
206
207
|
value: value,
|
|
207
208
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
208
209
|
children: [/*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.cloneElement(child, {
|
|
209
|
-
|
|
210
|
-
ref: triggerRef,
|
|
210
|
+
ref: mergedTriggerRef,
|
|
211
211
|
// If it is a type description, we use tooltip to describe the trigger
|
|
212
212
|
'aria-describedby': (() => {
|
|
213
213
|
// If tooltip is not a description type, keep the original aria-describedby
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabList.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/useTabList.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTabList.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/useTabList.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAEhE,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAgElG"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useMergedRefs } from '../../hooks/useMergedRefs.js';
|
|
3
4
|
|
|
4
5
|
function useTabList(props) {
|
|
5
|
-
const $ = c(
|
|
6
|
+
const $ = c(7);
|
|
6
7
|
const {
|
|
7
8
|
"aria-label": ariaLabel,
|
|
8
9
|
"aria-labelledby": ariaLabelledby,
|
|
9
10
|
"aria-orientation": ariaOrientation
|
|
10
11
|
} = props;
|
|
11
|
-
const ref =
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
useMergedRefs(ref, props.ref);
|
|
12
14
|
let t0;
|
|
13
|
-
if ($[0] !== ariaOrientation
|
|
15
|
+
if ($[0] !== ariaOrientation) {
|
|
14
16
|
t0 = event => {
|
|
15
17
|
const {
|
|
16
18
|
current: tablist
|
|
@@ -57,15 +59,14 @@ function useTabList(props) {
|
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
$[0] = ariaOrientation;
|
|
60
|
-
$[1] =
|
|
61
|
-
$[2] = t0;
|
|
62
|
+
$[1] = t0;
|
|
62
63
|
} else {
|
|
63
|
-
t0 = $[
|
|
64
|
+
t0 = $[1];
|
|
64
65
|
}
|
|
65
66
|
const onKeyDown = t0;
|
|
66
67
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
67
68
|
let t2;
|
|
68
|
-
if ($[
|
|
69
|
+
if ($[2] !== ariaLabel || $[3] !== ariaLabelledby || $[4] !== onKeyDown || $[5] !== t1) {
|
|
69
70
|
t2 = {
|
|
70
71
|
tabListProps: {
|
|
71
72
|
ref,
|
|
@@ -76,14 +77,13 @@ function useTabList(props) {
|
|
|
76
77
|
onKeyDown
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[8] = t2;
|
|
80
|
+
$[2] = ariaLabel;
|
|
81
|
+
$[3] = ariaLabelledby;
|
|
82
|
+
$[4] = onKeyDown;
|
|
83
|
+
$[5] = t1;
|
|
84
|
+
$[6] = t2;
|
|
85
85
|
} else {
|
|
86
|
-
t2 = $[
|
|
86
|
+
t2 = $[6];
|
|
87
87
|
}
|
|
88
88
|
return t2;
|
|
89
89
|
}
|
|
@@ -15,18 +15,18 @@ import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
|
15
15
|
* // React 18
|
|
16
16
|
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
17
17
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
18
|
-
* const
|
|
18
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
19
19
|
*
|
|
20
|
-
* return <button ref={
|
|
20
|
+
* return <button ref={combinedRef} />
|
|
21
21
|
* })
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* // React 19
|
|
25
25
|
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
26
26
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
27
|
-
* const
|
|
27
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
28
28
|
*
|
|
29
|
-
* return <button ref={
|
|
29
|
+
* return <button ref={combinedRef} />
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
32
|
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => (() => void) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;AAe7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAE7D,CAAC,GAAG,IAAI,8BAwBnB;AAED,KAAK,eAAe,GAAG,MAAM,IAAI,CAAA;AAEjC;;;GAGG;AAEH,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,eAAe,CAAA;CACpD,CAAC,gBAAgB,CAAC,CAAA;AAEnB;;;;;;;GAOG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
1
|
+
import { useCallback, version } from 'react';
|
|
2
2
|
import { reactMajorVersion, isExperimentalReactVersion } from '../utils/environment.js';
|
|
3
3
|
|
|
4
|
+
var _version$split$;
|
|
5
|
+
const majorReactVersion = parseInt((_version$split$ = version.split('.')[0]) !== null && _version$split$ !== void 0 ? _version$split$ : '18', 10);
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
6
9
|
* we look to see if current version of React is >= 19 or if it is an
|
|
@@ -26,18 +29,18 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
|
|
|
26
29
|
* // React 18
|
|
27
30
|
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
28
31
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
29
|
-
* const
|
|
32
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
30
33
|
*
|
|
31
|
-
* return <button ref={
|
|
34
|
+
* return <button ref={combinedRef} />
|
|
32
35
|
* })
|
|
33
36
|
*
|
|
34
37
|
* @example
|
|
35
38
|
* // React 19
|
|
36
39
|
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
37
40
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
38
|
-
* const
|
|
41
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
39
42
|
*
|
|
40
|
-
* return <button ref={
|
|
43
|
+
* return <button ref={combinedRef} />
|
|
41
44
|
* }
|
|
42
45
|
*/
|
|
43
46
|
function useMergedRefs(refA, refB) {
|
|
@@ -50,8 +53,9 @@ function useMergedRefs(refA, refB) {
|
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
//
|
|
56
|
+
// Callback refs only work in React 19+. In React 18, the ref will get called with
|
|
54
57
|
// `null` which will be passed to each ref as expected.
|
|
58
|
+
if (majorReactVersion <= 18) return;
|
|
55
59
|
return () => {
|
|
56
60
|
// For object refs and callback refs that don't return cleanups, we still need to pass `null` on cleanup
|
|
57
61
|
if (cleanupA) cleanupA();else setRef(refA, null);
|
|
@@ -7,17 +7,14 @@ import React from 'react';
|
|
|
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
9
|
*
|
|
10
|
-
* @
|
|
11
|
-
*
|
|
10
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
11
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
12
|
+
* {@linkcode useMergedRefs} instead.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - return <div ref={ref} />
|
|
19
|
-
* + return <div ref={mergedRef} />
|
|
20
|
-
* ```
|
|
14
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
15
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
16
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
17
|
+
* internal element.
|
|
21
18
|
*/
|
|
22
19
|
export declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
23
20
|
//# 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;
|
|
1
|
+
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB;;;;;;;;;;;;;;;;GAgBG;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"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
// used in doc comment
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* There are some situations where we only want to create a new ref if one is not provided to a component
|
|
5
8
|
* or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
|
|
@@ -8,17 +11,14 @@ import React from 'react';
|
|
|
8
11
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
12
|
* @type TRef The type of the RefObject which should be created.
|
|
10
13
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ```diff
|
|
15
|
-
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
-
* + const ref = useRef(null)
|
|
17
|
-
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
14
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
15
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
16
|
+
* {@linkcode useMergedRefs} instead.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
19
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
20
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
21
|
+
* internal element.
|
|
22
22
|
*/
|
|
23
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
24
24
|
const createdRef = React.useRef(null);
|
package/package.json
CHANGED