@primer/react 0.0.0-20260324184905 → 0.0.0-20260324193322
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 +3 -3
- package/dist/ActionList/Heading.js +16 -17
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -13
- package/dist/Autocomplete/AutocompleteInput.js +3 -3
- package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
- 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 +5 -5
- package/dist/Dialog/Dialog.js +8 -9
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +8 -8
- package/dist/Heading/Heading.js +3 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -3
- package/dist/Overlay/Overlay.js +20 -21
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +30 -31
- package/dist/PageLayout/PageLayout.js +5 -5
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -6
- package/dist/TextInputWithTokens/TextInputWithTokens.js +90 -91
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/deprecated/DialogV1/Dialog.js +9 -10
- 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/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-20260324193322
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
### Patch Changes
|
|
17
17
|
|
|
18
|
-
- [#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)! - Update internal implementations of combined refs to improve performance and add support for React 19 callback refs
|
|
19
|
-
|
|
20
18
|
- Fake entry to force publishing
|
|
21
19
|
|
|
22
20
|
- [#7510](https://github.com/primer/react/pull/7510) [`8fa988b`](https://github.com/primer/react/commit/8fa988ba613117874657af722ef6de768b0e0eb8) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: ensure max-height does not surpass viewport height in Overlay, ActionMenu under feature flag
|
|
@@ -10,7 +10,7 @@ import styles from './ActionBar.module.css.js';
|
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
11
|
import { createDescendantRegistry } from '../utils/descendant-registry.js';
|
|
12
12
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
14
14
|
import { FocusKeys } from '@primer/behaviors';
|
|
15
15
|
import { ActionMenu } from '../ActionMenu/ActionMenu.js';
|
|
16
16
|
|
|
@@ -423,7 +423,7 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
|
423
423
|
...props
|
|
424
424
|
}, forwardedRef) => {
|
|
425
425
|
const ref = useRef(null);
|
|
426
|
-
|
|
426
|
+
useRefObjectAsForwardedRef(forwardedRef, ref);
|
|
427
427
|
const {
|
|
428
428
|
size,
|
|
429
429
|
isVisibleChild
|
|
@@ -453,7 +453,7 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
|
453
453
|
if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) return null;
|
|
454
454
|
return /*#__PURE__*/jsx(IconButton, {
|
|
455
455
|
"aria-disabled": disabled,
|
|
456
|
-
ref:
|
|
456
|
+
ref: ref,
|
|
457
457
|
size: size,
|
|
458
458
|
onClick: clickHandler,
|
|
459
459
|
...props,
|
|
@@ -7,12 +7,12 @@ import { invariant } from '../utils/invariant.js';
|
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import classes from './Heading.module.css.js';
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
|
-
import {
|
|
10
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
11
11
|
import Heading$1 from '../Heading/Heading.js';
|
|
12
12
|
|
|
13
13
|
const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
14
14
|
var _props$id;
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(20);
|
|
16
16
|
let as;
|
|
17
17
|
let children;
|
|
18
18
|
let className;
|
|
@@ -45,7 +45,7 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
45
45
|
}
|
|
46
46
|
const visuallyHidden = t1 === undefined ? false : t1;
|
|
47
47
|
const innerRef = React.useRef(null);
|
|
48
|
-
|
|
48
|
+
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
49
49
|
const {
|
|
50
50
|
headingId,
|
|
51
51
|
variant: listVariant
|
|
@@ -65,11 +65,11 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
65
65
|
t4 = $[8];
|
|
66
66
|
}
|
|
67
67
|
let t5;
|
|
68
|
-
if ($[9] !== as || $[10] !== children || $[11] !== listVariant || $[12] !==
|
|
68
|
+
if ($[9] !== as || $[10] !== children || $[11] !== listVariant || $[12] !== props || $[13] !== size || $[14] !== t3 || $[15] !== t4) {
|
|
69
69
|
t5 = /*#__PURE__*/jsx(Heading$1, {
|
|
70
70
|
as: as,
|
|
71
71
|
variant: size,
|
|
72
|
-
ref:
|
|
72
|
+
ref: innerRef,
|
|
73
73
|
id: t3,
|
|
74
74
|
className: t4,
|
|
75
75
|
"data-list-variant": listVariant,
|
|
@@ -79,26 +79,25 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
79
79
|
$[9] = as;
|
|
80
80
|
$[10] = children;
|
|
81
81
|
$[11] = listVariant;
|
|
82
|
-
$[12] =
|
|
83
|
-
$[13] =
|
|
84
|
-
$[14] =
|
|
85
|
-
$[15] =
|
|
86
|
-
$[16] =
|
|
87
|
-
$[17] = t5;
|
|
82
|
+
$[12] = props;
|
|
83
|
+
$[13] = size;
|
|
84
|
+
$[14] = t3;
|
|
85
|
+
$[15] = t4;
|
|
86
|
+
$[16] = t5;
|
|
88
87
|
} else {
|
|
89
|
-
t5 = $[
|
|
88
|
+
t5 = $[16];
|
|
90
89
|
}
|
|
91
90
|
let t6;
|
|
92
|
-
if ($[
|
|
91
|
+
if ($[17] !== t2 || $[18] !== t5) {
|
|
93
92
|
t6 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
94
93
|
isVisible: t2,
|
|
95
94
|
children: t5
|
|
96
95
|
});
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
96
|
+
$[17] = t2;
|
|
97
|
+
$[18] = t5;
|
|
98
|
+
$[19] = t6;
|
|
100
99
|
} else {
|
|
101
|
-
t6 = $[
|
|
100
|
+
t6 = $[19];
|
|
102
101
|
}
|
|
103
102
|
return t6;
|
|
104
103
|
});
|
|
@@ -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;AAuF7C,QAAA,MAAM,IAAI,GA3Ea,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDA2ER,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 { useMergedRefs } from '../hooks/useMergedRefs.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 mergedRef = useMergedRefs(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,62 +122,62 @@ 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 listContextValue = t9;
|
|
135
135
|
const t10 = slots.heading;
|
|
136
136
|
let t11;
|
|
137
|
-
if ($[
|
|
137
|
+
if ($[20] !== className) {
|
|
138
138
|
t11 = clsx(classes.ActionList, className);
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
139
|
+
$[20] = className;
|
|
140
|
+
$[21] = t11;
|
|
141
141
|
} else {
|
|
142
|
-
t11 = $[
|
|
142
|
+
t11 = $[21];
|
|
143
143
|
}
|
|
144
144
|
let t12;
|
|
145
|
-
if ($[
|
|
145
|
+
if ($[22] !== Component || $[23] !== ariaLabelledBy || $[24] !== childrenWithoutSlots || $[25] !== listRole || $[26] !== mergedRef || $[27] !== restProps || $[28] !== showDividers || $[29] !== t11 || $[30] !== variant) {
|
|
146
146
|
t12 = /*#__PURE__*/jsx(Component, {
|
|
147
147
|
className: t11,
|
|
148
148
|
role: listRole,
|
|
149
149
|
"aria-labelledby": ariaLabelledBy,
|
|
150
|
-
ref:
|
|
150
|
+
ref: mergedRef,
|
|
151
151
|
"data-dividers": showDividers,
|
|
152
152
|
"data-variant": variant,
|
|
153
153
|
...restProps,
|
|
154
154
|
children: childrenWithoutSlots
|
|
155
155
|
});
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
156
|
+
$[22] = Component;
|
|
157
|
+
$[23] = ariaLabelledBy;
|
|
158
|
+
$[24] = childrenWithoutSlots;
|
|
159
|
+
$[25] = listRole;
|
|
160
|
+
$[26] = mergedRef;
|
|
161
|
+
$[27] = restProps;
|
|
162
|
+
$[28] = showDividers;
|
|
163
|
+
$[29] = t11;
|
|
164
|
+
$[30] = variant;
|
|
165
|
+
$[31] = t12;
|
|
166
166
|
} else {
|
|
167
|
-
t12 = $[
|
|
167
|
+
t12 = $[31];
|
|
168
168
|
}
|
|
169
169
|
let t13;
|
|
170
|
-
if ($[
|
|
170
|
+
if ($[32] !== listContextValue || $[33] !== slots.heading || $[34] !== t12) {
|
|
171
171
|
t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
172
172
|
value: listContextValue,
|
|
173
173
|
children: [t10, t12]
|
|
174
174
|
});
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
175
|
+
$[32] = listContextValue;
|
|
176
|
+
$[33] = slots.heading;
|
|
177
|
+
$[34] = t12;
|
|
178
|
+
$[35] = t13;
|
|
179
179
|
} else {
|
|
180
|
-
t13 = $[
|
|
180
|
+
t13 = $[35];
|
|
181
181
|
}
|
|
182
182
|
return t13;
|
|
183
183
|
};
|
|
@@ -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,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;AAC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QAAQ,GAAG,OAAO,KAAK,OAAO,CAAA;IAErF;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAEpC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,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;AAoB9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA4KnF,CAAA"}
|
|
@@ -10,6 +10,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
10
10
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
11
11
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
12
12
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
13
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
13
14
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
14
15
|
import Overlay from '../Overlay/Overlay.js';
|
|
15
16
|
|
|
@@ -62,6 +63,7 @@ const AnchoredOverlay = ({
|
|
|
62
63
|
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
63
64
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
64
65
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
66
|
+
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
65
67
|
const anchorId = useId(externalAnchorId);
|
|
66
68
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
|
|
67
69
|
const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('escape'), [onClose]);
|
|
@@ -160,12 +162,7 @@ const AnchoredOverlay = ({
|
|
|
160
162
|
preventOverflow: preventOverflow,
|
|
161
163
|
"data-component": "AnchoredOverlay",
|
|
162
164
|
...restOverlayProps,
|
|
163
|
-
ref:
|
|
164
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
165
|
-
assignRef(overlayProps.ref, node);
|
|
166
|
-
}
|
|
167
|
-
updateOverlayRef(node);
|
|
168
|
-
},
|
|
165
|
+
ref: mergedOverlayRef,
|
|
169
166
|
"data-anchor-position": cssAnchorPositioning,
|
|
170
167
|
"data-side": cssAnchorPositioning ? side : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
171
168
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
@@ -198,13 +195,6 @@ const AnchoredOverlay = ({
|
|
|
198
195
|
}
|
|
199
196
|
return innerContent;
|
|
200
197
|
};
|
|
201
|
-
function assignRef(ref, value) {
|
|
202
|
-
if (typeof ref === 'function') {
|
|
203
|
-
ref(value);
|
|
204
|
-
} else if (ref) {
|
|
205
|
-
ref.current = value;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
198
|
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
|
209
199
|
|
|
210
200
|
export { AnchoredOverlay };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import { AutocompleteContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import TextInput from '../TextInput/TextInput.js';
|
|
@@ -36,7 +36,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
36
36
|
inputValue = '',
|
|
37
37
|
isMenuDirectlyActivated
|
|
38
38
|
} = inputContext;
|
|
39
|
-
|
|
39
|
+
useRefObjectAsForwardedRef(forwardedRef, inputRef);
|
|
40
40
|
const [highlightRemainingText, setHighlightRemainingText] = useState(true);
|
|
41
41
|
const {
|
|
42
42
|
safeSetTimeout
|
|
@@ -130,7 +130,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
130
130
|
onKeyDown: handleInputKeyDown,
|
|
131
131
|
onKeyPress: onInputKeyPress,
|
|
132
132
|
onKeyUp: handleInputKeyUp,
|
|
133
|
-
ref:
|
|
133
|
+
ref: inputRef,
|
|
134
134
|
"aria-controls": `${id}-listbox`,
|
|
135
135
|
"aria-autocomplete": "both",
|
|
136
136
|
role: "combobox",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
import { AutocompleteContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
5
5
|
import classes from './AutocompleteOverlay.module.css.js';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
@@ -48,7 +48,7 @@ function AutocompleteOverlay({
|
|
|
48
48
|
align: 'start',
|
|
49
49
|
anchorElementRef: computedAnchorRef
|
|
50
50
|
}, [showMenu, selectedItemLength]);
|
|
51
|
-
|
|
51
|
+
useRefObjectAsForwardedRef(scrollContainerRef, floatingElementRef);
|
|
52
52
|
const closeOptionList = useCallback(() => {
|
|
53
53
|
setShowMenu(false);
|
|
54
54
|
}, [setShowMenu]);
|
|
@@ -60,7 +60,7 @@ function AutocompleteOverlay({
|
|
|
60
60
|
preventFocusOnOpen: true,
|
|
61
61
|
onClickOutside: closeOptionList,
|
|
62
62
|
onEscape: closeOptionList,
|
|
63
|
-
ref:
|
|
63
|
+
ref: floatingElementRef,
|
|
64
64
|
top: position === null || position === void 0 ? void 0 : position.top,
|
|
65
65
|
left: position === null || position === void 0 ? void 0 : position.left,
|
|
66
66
|
className: clsx(classes.Overlay, className),
|
|
@@ -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,EA2JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
3
3
|
import { ConditionalWrapper } from '../internal/components/ConditionalWrapper.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import classes from './ButtonBase.module.css.js';
|
|
@@ -46,7 +46,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
46
46
|
...rest
|
|
47
47
|
} = props;
|
|
48
48
|
const innerRef = React.useRef(null);
|
|
49
|
-
|
|
49
|
+
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
50
50
|
const uuid = useId(id);
|
|
51
51
|
const loadingAnnouncementID = `${uuid}-loading-announcement`;
|
|
52
52
|
|
|
@@ -74,7 +74,8 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
74
74
|
children: [/*#__PURE__*/jsx(Component, {
|
|
75
75
|
"aria-disabled": loading ? true : undefined,
|
|
76
76
|
...rest,
|
|
77
|
-
|
|
77
|
+
// @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent
|
|
78
|
+
ref: innerRef,
|
|
78
79
|
className: clsx(classes.ButtonBase, className),
|
|
79
80
|
"data-block": block ? 'block' : null,
|
|
80
81
|
"data-inactive": inactive ? true : undefined,
|
|
@@ -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 { 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;
|
|
@@ -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 mergedRef = useMergedRefs(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] !== 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
|
children: buttons
|
|
81
81
|
});
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
82
|
+
$[12] = BaseComponent;
|
|
83
|
+
$[13] = buttons;
|
|
84
|
+
$[14] = mergedRef;
|
|
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 { useMergedRefs } from '../hooks/useMergedRefs.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 mergedRef = useMergedRefs(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: mergedRef,
|
|
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
|
@@ -6,7 +6,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
6
6
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
7
7
|
import { FocusKeys } from '@primer/behaviors';
|
|
8
8
|
import { Portal } from '../Portal/Portal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
10
10
|
import { useId } from '../hooks/useId.js';
|
|
11
11
|
import classes from './Dialog.module.css.js';
|
|
12
12
|
import { clsx } from 'clsx';
|
|
@@ -14,7 +14,7 @@ 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 {
|
|
17
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
18
18
|
|
|
19
19
|
const DefaultHeader = ({
|
|
20
20
|
dialogLabelId,
|
|
@@ -127,7 +127,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
127
127
|
footer: Dialog.Footer
|
|
128
128
|
});
|
|
129
129
|
const dialogRef = useRef(null);
|
|
130
|
-
|
|
130
|
+
useRefObjectAsForwardedRef(forwardedRef, dialogRef);
|
|
131
131
|
const backdropRef = useRef(null);
|
|
132
132
|
useFocusTrap({
|
|
133
133
|
containerRef: dialogRef,
|
|
@@ -190,7 +190,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
190
190
|
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
191
191
|
},
|
|
192
192
|
children: /*#__PURE__*/jsxs("div", {
|
|
193
|
-
ref:
|
|
193
|
+
ref: dialogRef,
|
|
194
194
|
role: role,
|
|
195
195
|
"aria-labelledby": dialogLabelId,
|
|
196
196
|
"aria-describedby": dialogDescriptionId,
|
|
@@ -274,7 +274,8 @@ const Buttons = ({
|
|
|
274
274
|
buttons
|
|
275
275
|
}) => {
|
|
276
276
|
var _buttons$find;
|
|
277
|
-
const autoFocusRef =
|
|
277
|
+
const autoFocusRef = useRef(null);
|
|
278
|
+
const mergedRef = useMergedRefs(autoFocusRef, (_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
278
279
|
let autoFocusCount = 0;
|
|
279
280
|
const [hasRendered, setHasRendered] = useState(0);
|
|
280
281
|
useEffect(() => {
|
|
@@ -297,10 +298,8 @@ const Buttons = ({
|
|
|
297
298
|
return /*#__PURE__*/jsx(ButtonComponent, {
|
|
298
299
|
...buttonProps,
|
|
299
300
|
// 'normal' value is equivalent to 'default', this is used for backwards compatibility
|
|
300
|
-
variant: buttonType === 'normal' ? 'default' : buttonType
|
|
301
|
-
|
|
302
|
-
,
|
|
303
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
301
|
+
variant: buttonType === 'normal' ? 'default' : buttonType,
|
|
302
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, mergedRef) : null,
|
|
304
303
|
children: content
|
|
305
304
|
}, index);
|
|
306
305
|
})
|
|
@@ -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/FilteredAction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