@primer/react 0.0.0-20260220162457 → 0.0.0-20260220184804
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 +14 -2
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.js +64 -238
- package/dist/Button/Button.js +11 -34
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +147 -42
- package/dist/Overlay/Overlay-15519c09.css +2 -0
- package/dist/Overlay/Overlay-15519c09.css.map +1 -0
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/PageLayout/PageLayout.js +622 -1560
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -1
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +10 -13
- package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +14 -22
- package/dist/hooks/useSlots.d.ts +50 -6
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +114 -36
- package/generated/components.json +7 -1
- package/package.json +2 -2
- package/dist/Overlay/Overlay-43cda449.css +0 -2
- package/dist/Overlay/Overlay-43cda449.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260220184804
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7531](https://github.com/primer/react/pull/7531) [`0cfb938`](https://github.com/primer/react/commit/0cfb938704ec7589b6453a23ba8a9f2c8ab7d824) Thanks [@hectahertz](https://github.com/hectahertz)! - SelectPanel: Add built-in client-side list virtualization via a new `virtualized` prop. When enabled, only the visible items plus a small overscan buffer are rendered in the DOM, dramatically improving performance for large lists.
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
11
|
- Fake entry to force publishing
|
|
8
12
|
|
|
9
|
-
- [#
|
|
13
|
+
- [#7555](https://github.com/primer/react/pull/7555) [`64c2243`](https://github.com/primer/react/commit/64c2243d07fc580a5565493b917b27081ef6a191) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useSlots): short-circuit iteration and skip filled slots
|
|
14
|
+
|
|
15
|
+
- [#7547](https://github.com/primer/react/pull/7547) [`4943d67`](https://github.com/primer/react/commit/4943d671ddb590461e59f9745e6093d47e770f7a) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useScrollFlash): defer scroll read/write to requestAnimationFrame to avoid forced reflow
|
|
16
|
+
|
|
17
|
+
- [#7551](https://github.com/primer/react/pull/7551) [`2fbfc49`](https://github.com/primer/react/commit/2fbfc49fad6f11edc51850e32e9c0b2ade8ca1f1) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Text): remove unnecessary useRef and useImperativeHandle hooks
|
|
18
|
+
|
|
19
|
+
- [#7571](https://github.com/primer/react/pull/7571) [`44c1077`](https://github.com/primer/react/commit/44c10779e4c393b2d23acdbd0ba30fcd0cb636ac) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - AnchoredOverlay: changed `overflow` from `hidden` to `auto` to prevent content clipping at small viewports.
|
|
20
|
+
|
|
21
|
+
- [#7553](https://github.com/primer/react/pull/7553) [`6225ba2`](https://github.com/primer/react/commit/6225ba231cfdbe6ef7fa41dd62734d5a970bdc7d) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useRefObjectAsForwardedRef): add dependency array to useImperativeHandle
|
|
10
22
|
|
|
11
23
|
## 38.13.0
|
|
12
24
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AutocompleteContext, AutocompleteDeferredInputContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
1
|
+
import { useRef, useReducer, useCallback, useMemo, useDeferredValue } from 'react';
|
|
2
|
+
import { AutocompleteContext, AutocompleteInputContext, AutocompleteDeferredInputContext } from './AutocompleteContext.js';
|
|
4
3
|
import AutocompleteInput from './AutocompleteInput.js';
|
|
5
4
|
import AutocompleteMenu from './AutocompleteMenu.js';
|
|
6
5
|
import AutocompleteOverlay from './AutocompleteOverlay.js';
|
|
@@ -49,12 +48,10 @@ const reducer = (state, action) => {
|
|
|
49
48
|
return state;
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
|
-
const Autocomplete =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
id: idProp
|
|
57
|
-
} = t0;
|
|
51
|
+
const Autocomplete = ({
|
|
52
|
+
children,
|
|
53
|
+
id: idProp
|
|
54
|
+
}) => {
|
|
58
55
|
const activeDescendantRef = useRef(null);
|
|
59
56
|
const scrollContainerRef = useRef(null);
|
|
60
57
|
const inputRef = useRef(null);
|
|
@@ -66,160 +63,80 @@ const Autocomplete = t0 => {
|
|
|
66
63
|
isMenuDirectlyActivated,
|
|
67
64
|
selectedItemLength
|
|
68
65
|
} = state;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
type: "inputValue",
|
|
74
|
-
payload: value
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
$[0] = t1;
|
|
78
|
-
} else {
|
|
79
|
-
t1 = $[0];
|
|
80
|
-
}
|
|
81
|
-
const setInputValue = t1;
|
|
82
|
-
let t2;
|
|
83
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
84
|
-
t2 = value_0 => {
|
|
85
|
-
dispatch({
|
|
86
|
-
type: "showMenu",
|
|
87
|
-
payload: value_0
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
$[1] = t2;
|
|
91
|
-
} else {
|
|
92
|
-
t2 = $[1];
|
|
93
|
-
}
|
|
94
|
-
const setShowMenu = t2;
|
|
95
|
-
let t3;
|
|
96
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
-
t3 = value_1 => {
|
|
98
|
-
dispatch({
|
|
99
|
-
type: "autocompleteSuggestion",
|
|
100
|
-
payload: value_1
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
$[2] = t3;
|
|
104
|
-
} else {
|
|
105
|
-
t3 = $[2];
|
|
106
|
-
}
|
|
107
|
-
const setAutocompleteSuggestion = t3;
|
|
108
|
-
let t4;
|
|
109
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
110
|
-
t4 = value_2 => {
|
|
111
|
-
dispatch({
|
|
112
|
-
type: "isMenuDirectlyActivated",
|
|
113
|
-
payload: value_2
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
$[3] = t4;
|
|
117
|
-
} else {
|
|
118
|
-
t4 = $[3];
|
|
119
|
-
}
|
|
120
|
-
const setIsMenuDirectlyActivated = t4;
|
|
121
|
-
let t5;
|
|
122
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
-
t5 = value_3 => {
|
|
124
|
-
dispatch({
|
|
125
|
-
type: "selectedItemLength",
|
|
126
|
-
payload: value_3
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
$[4] = t5;
|
|
130
|
-
} else {
|
|
131
|
-
t5 = $[4];
|
|
132
|
-
}
|
|
133
|
-
const setSelectedItemLength = t5;
|
|
134
|
-
const id = useId(idProp);
|
|
135
|
-
let t6;
|
|
136
|
-
if ($[5] !== id || $[6] !== selectedItemLength || $[7] !== showMenu) {
|
|
137
|
-
t6 = {
|
|
138
|
-
activeDescendantRef,
|
|
139
|
-
id,
|
|
140
|
-
inputRef,
|
|
141
|
-
scrollContainerRef,
|
|
142
|
-
selectedItemLength,
|
|
143
|
-
setAutocompleteSuggestion,
|
|
144
|
-
setInputValue,
|
|
145
|
-
setIsMenuDirectlyActivated,
|
|
146
|
-
setShowMenu,
|
|
147
|
-
setSelectedItemLength,
|
|
148
|
-
showMenu
|
|
149
|
-
};
|
|
150
|
-
$[5] = id;
|
|
151
|
-
$[6] = selectedItemLength;
|
|
152
|
-
$[7] = showMenu;
|
|
153
|
-
$[8] = t6;
|
|
154
|
-
} else {
|
|
155
|
-
t6 = $[8];
|
|
156
|
-
}
|
|
157
|
-
const autocompleteContextValue = t6;
|
|
158
|
-
let t7;
|
|
159
|
-
if ($[9] !== autocompleteSuggestion || $[10] !== inputValue || $[11] !== isMenuDirectlyActivated) {
|
|
160
|
-
t7 = {
|
|
161
|
-
autocompleteSuggestion,
|
|
162
|
-
inputValue,
|
|
163
|
-
isMenuDirectlyActivated
|
|
164
|
-
};
|
|
165
|
-
$[9] = autocompleteSuggestion;
|
|
166
|
-
$[10] = inputValue;
|
|
167
|
-
$[11] = isMenuDirectlyActivated;
|
|
168
|
-
$[12] = t7;
|
|
169
|
-
} else {
|
|
170
|
-
t7 = $[12];
|
|
171
|
-
}
|
|
172
|
-
const autocompleteInputContextValue = t7;
|
|
173
|
-
const deferredInputValue = useDeferredValue(inputValue);
|
|
174
|
-
let t8;
|
|
175
|
-
if ($[13] !== deferredInputValue) {
|
|
176
|
-
t8 = {
|
|
177
|
-
deferredInputValue
|
|
178
|
-
};
|
|
179
|
-
$[13] = deferredInputValue;
|
|
180
|
-
$[14] = t8;
|
|
181
|
-
} else {
|
|
182
|
-
t8 = $[14];
|
|
183
|
-
}
|
|
184
|
-
const autocompleteDeferredInputContextValue = t8;
|
|
185
|
-
let t9;
|
|
186
|
-
if ($[15] !== autocompleteDeferredInputContextValue || $[16] !== children) {
|
|
187
|
-
t9 = /*#__PURE__*/jsx(AutocompleteDeferredInputContext.Provider, {
|
|
188
|
-
value: autocompleteDeferredInputContextValue,
|
|
189
|
-
children: children
|
|
66
|
+
const setInputValue = useCallback(value => {
|
|
67
|
+
dispatch({
|
|
68
|
+
type: 'inputValue',
|
|
69
|
+
payload: value
|
|
190
70
|
});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
let t10;
|
|
198
|
-
if ($[18] !== autocompleteInputContextValue || $[19] !== t9) {
|
|
199
|
-
t10 = /*#__PURE__*/jsx(AutocompleteInputContext.Provider, {
|
|
200
|
-
value: autocompleteInputContextValue,
|
|
201
|
-
children: t9
|
|
71
|
+
}, []);
|
|
72
|
+
const setShowMenu = useCallback(value => {
|
|
73
|
+
dispatch({
|
|
74
|
+
type: 'showMenu',
|
|
75
|
+
payload: value
|
|
202
76
|
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
let t11;
|
|
210
|
-
if ($[21] !== autocompleteContextValue || $[22] !== t10) {
|
|
211
|
-
t11 = /*#__PURE__*/jsx(AutocompleteContext.Provider, {
|
|
212
|
-
value: autocompleteContextValue,
|
|
213
|
-
children: t10
|
|
77
|
+
}, []);
|
|
78
|
+
const setAutocompleteSuggestion = useCallback(value => {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: 'autocompleteSuggestion',
|
|
81
|
+
payload: value
|
|
214
82
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
83
|
+
}, []);
|
|
84
|
+
const setIsMenuDirectlyActivated = useCallback(value => {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: 'isMenuDirectlyActivated',
|
|
87
|
+
payload: value
|
|
88
|
+
});
|
|
89
|
+
}, []);
|
|
90
|
+
const setSelectedItemLength = useCallback(value => {
|
|
91
|
+
dispatch({
|
|
92
|
+
type: 'selectedItemLength',
|
|
93
|
+
payload: value
|
|
94
|
+
});
|
|
95
|
+
}, []);
|
|
96
|
+
const id = useId(idProp);
|
|
97
|
+
|
|
98
|
+
// Base context: refs, IDs, menu visibility, and callbacks
|
|
99
|
+
// Changes when menu opens/closes or selection changes, but NOT on every keystroke
|
|
100
|
+
const autocompleteContextValue = useMemo(() => ({
|
|
101
|
+
activeDescendantRef,
|
|
102
|
+
id,
|
|
103
|
+
inputRef,
|
|
104
|
+
scrollContainerRef,
|
|
105
|
+
selectedItemLength,
|
|
106
|
+
setAutocompleteSuggestion,
|
|
107
|
+
setInputValue,
|
|
108
|
+
setIsMenuDirectlyActivated,
|
|
109
|
+
setShowMenu,
|
|
110
|
+
setSelectedItemLength,
|
|
111
|
+
showMenu
|
|
112
|
+
}), [id, selectedItemLength, setAutocompleteSuggestion, setInputValue, setIsMenuDirectlyActivated, setShowMenu, setSelectedItemLength, showMenu]);
|
|
113
|
+
|
|
114
|
+
// Input state context: values that change on every keystroke
|
|
115
|
+
// Split to prevent Overlay from re-rendering during typing
|
|
116
|
+
const autocompleteInputContextValue = useMemo(() => ({
|
|
117
|
+
autocompleteSuggestion,
|
|
118
|
+
inputValue,
|
|
119
|
+
isMenuDirectlyActivated
|
|
120
|
+
}), [autocompleteSuggestion, inputValue, isMenuDirectlyActivated]);
|
|
121
|
+
|
|
122
|
+
// Deferred input value for expensive operations like filtering
|
|
123
|
+
// Menu subscribes to this instead of inputValue to avoid re-rendering on every keystroke
|
|
124
|
+
const deferredInputValue = useDeferredValue(inputValue);
|
|
125
|
+
const autocompleteDeferredInputContextValue = useMemo(() => ({
|
|
126
|
+
deferredInputValue
|
|
127
|
+
}), [deferredInputValue]);
|
|
128
|
+
return /*#__PURE__*/jsx(AutocompleteContext.Provider, {
|
|
129
|
+
value: autocompleteContextValue,
|
|
130
|
+
children: /*#__PURE__*/jsx(AutocompleteInputContext.Provider, {
|
|
131
|
+
value: autocompleteInputContextValue,
|
|
132
|
+
children: /*#__PURE__*/jsx(AutocompleteDeferredInputContext.Provider, {
|
|
133
|
+
value: autocompleteDeferredInputContextValue,
|
|
134
|
+
children: children
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
});
|
|
222
138
|
};
|
|
139
|
+
Autocomplete.displayName = "Autocomplete";
|
|
223
140
|
var Autocomplete$1 = Object.assign(Autocomplete, {
|
|
224
141
|
__SLOT__: Symbol('Autocomplete'),
|
|
225
142
|
Context: AutocompleteContext,
|