@primer/react 38.6.2 → 38.6.3-rc.380490a3d
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 +31 -0
- package/dist/Autocomplete/Autocomplete.d.ts +0 -3
- package/dist/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete/Autocomplete.js +69 -23
- package/dist/Autocomplete/AutocompleteContext.d.ts +23 -3
- package/dist/Autocomplete/AutocompleteContext.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteContext.js +20 -1
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +8 -5
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +123 -121
- package/dist/{BaseStyles-79fd37c4.css → BaseStyles-7e59cc50.css} +2 -2
- package/dist/BaseStyles-7e59cc50.css.map +1 -0
- package/dist/BaseStyles.module.css.js +1 -1
- package/dist/Dialog/{Dialog-1a61e61a.css → Dialog-92b5e3b7.css} +2 -2
- package/dist/Dialog/Dialog-92b5e3b7.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +21 -5
- package/dist/Dialog/Dialog.module.css.js +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts +6 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/FeatureFlags.js +41 -32
- package/dist/ToggleSwitch/ToggleSwitch-40bab513.css +2 -0
- package/dist/ToggleSwitch/ToggleSwitch-40bab513.css.map +1 -0
- package/dist/ToggleSwitch/ToggleSwitch.module.css.js +1 -1
- package/dist/internal/utils/hasInteractiveNodes.d.ts.map +1 -1
- package/dist/internal/utils/hasInteractiveNodes.js +22 -16
- package/package.json +8 -8
- package/dist/BaseStyles-79fd37c4.css.map +0 -1
- package/dist/Dialog/Dialog-1a61e61a.css.map +0 -1
- package/dist/ToggleSwitch/ToggleSwitch-d1bd60b0.css +0 -2
- package/dist/ToggleSwitch/ToggleSwitch-d1bd60b0.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 38.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7354](https://github.com/primer/react/pull/7354) [`efbebdf`](https://github.com/primer/react/commit/efbebdf6589bf454ab78f17c83dc84ce88145e7b) Thanks [@llastflowers](https://github.com/llastflowers)! - update SelectPanel Multi Select Modal story
|
|
8
|
+
|
|
9
|
+
- [#7337](https://github.com/primer/react/pull/7337) [`de970d6`](https://github.com/primer/react/commit/de970d6682f4e9a3aa5e3c637e0245da2a7a9d84) Thanks [@mattcosta7](https://github.com/mattcosta7)! - perf(Autocomplete): Split context to reduce unnecessary re-renders
|
|
10
|
+
|
|
11
|
+
Split AutocompleteContext into separate contexts for static values, setters, and dynamic state.
|
|
12
|
+
Components now subscribe only to the context slices they need, reducing re-renders.
|
|
13
|
+
|
|
14
|
+
- [#7325](https://github.com/primer/react/pull/7325) [`cc7e10e`](https://github.com/primer/react/commit/cc7e10e7c0bee7ef9694ca94928446f704ada552) Thanks [@mattcosta7](https://github.com/mattcosta7)! - perf(BaseStyles): Remove expensive :has([data-color-mode]) selectors
|
|
15
|
+
|
|
16
|
+
Remove `:has([data-color-mode])` selectors that scanned the entire DOM on every style recalculation.
|
|
17
|
+
Input color-scheme is already handled by global selectors in the codebase.
|
|
18
|
+
|
|
19
|
+
- [#7329](https://github.com/primer/react/pull/7329) [`501a41f`](https://github.com/primer/react/commit/501a41fc44e5c0edfca69af022676e0d26e1a1a0) Thanks [@mattcosta7](https://github.com/mattcosta7)! - perf(Dialog): Add feature flag for CSS :has() selector performance optimization
|
|
20
|
+
|
|
21
|
+
- Add `primer_react_css_has_selector_perf` feature flag (default: false)
|
|
22
|
+
- When flag is OFF: uses legacy `body:has(.Dialog.DisableScroll)` selector
|
|
23
|
+
- When flag is ON: uses optimized direct `body[data-dialog-scroll-disabled]` data attribute with ref counting
|
|
24
|
+
- Enables gradual rollout and easy rollback of performance optimization
|
|
25
|
+
|
|
26
|
+
- [#7342](https://github.com/primer/react/pull/7342) [`a8b42b2`](https://github.com/primer/react/commit/a8b42b2e4cff9575eae8df897e64c1ca67ee180a) Thanks [@mattcosta7](https://github.com/mattcosta7)! - perf(hasInteractiveNodes): Optimize with combined selector and early attribute checks
|
|
27
|
+
|
|
28
|
+
- Use combined querySelectorAll selector instead of recursive traversal
|
|
29
|
+
- Check attribute-based states (disabled, hidden, inert) before getComputedStyle
|
|
30
|
+
- Only call getComputedStyle when CSS-based visibility check is needed
|
|
31
|
+
|
|
32
|
+
- [#7399](https://github.com/primer/react/pull/7399) [`06c8320`](https://github.com/primer/react/commit/06c83203cd3f200b337aa34618174934317494e2) Thanks [@TylerJDev](https://github.com/TylerJDev)! - ToggleSwitch: Adds `overflow: hidden` to `.StatusTextItem` when hidden
|
|
33
|
+
|
|
3
34
|
## 38.6.2
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -15,11 +15,8 @@ declare const _default: React.FC<React.PropsWithChildren<{
|
|
|
15
15
|
__SLOT__: symbol;
|
|
16
16
|
Context: React.Context<{
|
|
17
17
|
activeDescendantRef: React.MutableRefObject<HTMLElement | null>;
|
|
18
|
-
autocompleteSuggestion: string;
|
|
19
18
|
id: string;
|
|
20
19
|
inputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
21
|
-
inputValue: string;
|
|
22
|
-
isMenuDirectlyActivated: boolean;
|
|
23
20
|
scrollContainerRef: React.MutableRefObject<HTMLElement | null>;
|
|
24
21
|
selectedItemLength: number;
|
|
25
22
|
setAutocompleteSuggestion: (value: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAGpE,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AA0CvD,QAAA,MAAM,YAAY,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAGpE,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AA0CvD,QAAA,MAAM,YAAY,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,CA4E1E,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAA;AACnE,YAAY,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAC7D,YAAY,EAAC,wBAAwB,EAAC,MAAM,uBAAuB,CAAA;;SAjFA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFzE,wBAME"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { useRef, useReducer } from 'react';
|
|
3
|
-
import { AutocompleteContext } from './AutocompleteContext.js';
|
|
2
|
+
import { useRef, useReducer, useDeferredValue } from 'react';
|
|
3
|
+
import { AutocompleteContext, AutocompleteDeferredInputContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
4
4
|
import AutocompleteInput from './AutocompleteInput.js';
|
|
5
5
|
import AutocompleteMenu from './AutocompleteMenu.js';
|
|
6
6
|
import AutocompleteOverlay from './AutocompleteOverlay.js';
|
|
@@ -50,7 +50,7 @@ const reducer = (state, action) => {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
const Autocomplete = t0 => {
|
|
53
|
-
const $ = c(
|
|
53
|
+
const $ = c(24);
|
|
54
54
|
const {
|
|
55
55
|
children,
|
|
56
56
|
id: idProp
|
|
@@ -133,14 +133,11 @@ const Autocomplete = t0 => {
|
|
|
133
133
|
const setSelectedItemLength = t5;
|
|
134
134
|
const id = useId(idProp);
|
|
135
135
|
let t6;
|
|
136
|
-
if ($[5] !==
|
|
136
|
+
if ($[5] !== id || $[6] !== selectedItemLength || $[7] !== showMenu) {
|
|
137
137
|
t6 = {
|
|
138
138
|
activeDescendantRef,
|
|
139
|
-
autocompleteSuggestion,
|
|
140
139
|
id,
|
|
141
140
|
inputRef,
|
|
142
|
-
inputValue,
|
|
143
|
-
isMenuDirectlyActivated,
|
|
144
141
|
scrollContainerRef,
|
|
145
142
|
selectedItemLength,
|
|
146
143
|
setAutocompleteSuggestion,
|
|
@@ -150,29 +147,78 @@ const Autocomplete = t0 => {
|
|
|
150
147
|
setSelectedItemLength,
|
|
151
148
|
showMenu
|
|
152
149
|
};
|
|
153
|
-
$[5] =
|
|
154
|
-
$[6] =
|
|
155
|
-
$[7] =
|
|
156
|
-
$[8] =
|
|
157
|
-
$[9] = selectedItemLength;
|
|
158
|
-
$[10] = showMenu;
|
|
159
|
-
$[11] = t6;
|
|
150
|
+
$[5] = id;
|
|
151
|
+
$[6] = selectedItemLength;
|
|
152
|
+
$[7] = showMenu;
|
|
153
|
+
$[8] = t6;
|
|
160
154
|
} else {
|
|
161
|
-
t6 = $[
|
|
155
|
+
t6 = $[8];
|
|
162
156
|
}
|
|
157
|
+
const autocompleteContextValue = t6;
|
|
163
158
|
let t7;
|
|
164
|
-
if ($[
|
|
165
|
-
t7 =
|
|
166
|
-
|
|
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,
|
|
167
189
|
children: children
|
|
168
190
|
});
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
191
|
+
$[15] = autocompleteDeferredInputContextValue;
|
|
192
|
+
$[16] = children;
|
|
193
|
+
$[17] = t9;
|
|
194
|
+
} else {
|
|
195
|
+
t9 = $[17];
|
|
196
|
+
}
|
|
197
|
+
let t10;
|
|
198
|
+
if ($[18] !== autocompleteInputContextValue || $[19] !== t9) {
|
|
199
|
+
t10 = /*#__PURE__*/jsx(AutocompleteInputContext.Provider, {
|
|
200
|
+
value: autocompleteInputContextValue,
|
|
201
|
+
children: t9
|
|
202
|
+
});
|
|
203
|
+
$[18] = autocompleteInputContextValue;
|
|
204
|
+
$[19] = t9;
|
|
205
|
+
$[20] = t10;
|
|
206
|
+
} else {
|
|
207
|
+
t10 = $[20];
|
|
208
|
+
}
|
|
209
|
+
let t11;
|
|
210
|
+
if ($[21] !== autocompleteContextValue || $[22] !== t10) {
|
|
211
|
+
t11 = /*#__PURE__*/jsx(AutocompleteContext.Provider, {
|
|
212
|
+
value: autocompleteContextValue,
|
|
213
|
+
children: t10
|
|
214
|
+
});
|
|
215
|
+
$[21] = autocompleteContextValue;
|
|
216
|
+
$[22] = t10;
|
|
217
|
+
$[23] = t11;
|
|
172
218
|
} else {
|
|
173
|
-
|
|
219
|
+
t11 = $[23];
|
|
174
220
|
}
|
|
175
|
-
return
|
|
221
|
+
return t11;
|
|
176
222
|
};
|
|
177
223
|
var Autocomplete$1 = Object.assign(Autocomplete, {
|
|
178
224
|
__SLOT__: Symbol('Autocomplete'),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base context containing refs, stable IDs, menu visibility state, and callbacks.
|
|
3
|
+
* This context changes when menu opens/closes or selection changes, but NOT on every keystroke.
|
|
4
|
+
* Consumers like AutocompleteOverlay that don't need input text should use only this context.
|
|
5
|
+
*/
|
|
1
6
|
export declare const AutocompleteContext: import("react").Context<{
|
|
2
7
|
activeDescendantRef: React.MutableRefObject<HTMLElement | null>;
|
|
3
|
-
autocompleteSuggestion: string;
|
|
4
8
|
id: string;
|
|
5
9
|
inputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
6
|
-
inputValue: string;
|
|
7
|
-
isMenuDirectlyActivated: boolean;
|
|
8
10
|
scrollContainerRef: React.MutableRefObject<HTMLElement | null>;
|
|
9
11
|
selectedItemLength: number;
|
|
10
12
|
setAutocompleteSuggestion: (value: string) => void;
|
|
@@ -14,4 +16,22 @@ export declare const AutocompleteContext: import("react").Context<{
|
|
|
14
16
|
setShowMenu: (value: boolean) => void;
|
|
15
17
|
showMenu: boolean;
|
|
16
18
|
} | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Input-related state that changes on every keystroke.
|
|
21
|
+
* Only AutocompleteInput needs this for immediate text display and suggestion highlighting.
|
|
22
|
+
*/
|
|
23
|
+
export declare const AutocompleteInputContext: import("react").Context<{
|
|
24
|
+
autocompleteSuggestion: string;
|
|
25
|
+
inputValue: string;
|
|
26
|
+
isMenuDirectlyActivated: boolean;
|
|
27
|
+
} | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Deferred input value for expensive operations like filtering.
|
|
30
|
+
* Uses React's useDeferredValue to allow typing to remain responsive while
|
|
31
|
+
* filtering large lists at lower priority.
|
|
32
|
+
* AutocompleteMenu uses this to avoid blocking keystrokes during filtering.
|
|
33
|
+
*/
|
|
34
|
+
export declare const AutocompleteDeferredInputContext: import("react").Context<{
|
|
35
|
+
deferredInputValue: string;
|
|
36
|
+
} | null>;
|
|
17
37
|
//# sourceMappingURL=AutocompleteContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteContext.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteContext.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;yBACT,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompleteContext.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteContext.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;yBACT,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;QAE3D,MAAM;cACA,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,IAAI,CAAC;wBACrC,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;wBAC1C,MAAM;+BACC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;mBACnC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;gCACV,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;2BAC7B,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;iBACjC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;cAC3B,OAAO;SACJ,CAAA;AAEf;;;GAGG;AACH,eAAO,MAAM,wBAAwB;4BACX,MAAM;gBAClB,MAAM;6BACO,OAAO;SACnB,CAAA;AAEf;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC;wBACvB,MAAM;SACb,CAAA"}
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Base context containing refs, stable IDs, menu visibility state, and callbacks.
|
|
5
|
+
* This context changes when menu opens/closes or selection changes, but NOT on every keystroke.
|
|
6
|
+
* Consumers like AutocompleteOverlay that don't need input text should use only this context.
|
|
7
|
+
*/
|
|
3
8
|
const AutocompleteContext = /*#__PURE__*/createContext(null);
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Input-related state that changes on every keystroke.
|
|
12
|
+
* Only AutocompleteInput needs this for immediate text display and suggestion highlighting.
|
|
13
|
+
*/
|
|
14
|
+
const AutocompleteInputContext = /*#__PURE__*/createContext(null);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Deferred input value for expensive operations like filtering.
|
|
18
|
+
* Uses React's useDeferredValue to allow typing to remain responsive while
|
|
19
|
+
* filtering large lists at lower priority.
|
|
20
|
+
* AutocompleteMenu uses this to avoid blocking keystrokes during filtering.
|
|
21
|
+
*/
|
|
22
|
+
const AutocompleteDeferredInputContext = /*#__PURE__*/createContext(null);
|
|
23
|
+
|
|
24
|
+
export { AutocompleteContext, AutocompleteDeferredInputContext, AutocompleteInputContext };
|
|
@@ -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,EAyJlB,8BAA8B,CAAC,OAAO,SAAS,EAAE,8BAA8B,CAAC,CAAA;AAIrF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC7E,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import { AutocompleteContext } from './AutocompleteContext.js';
|
|
2
|
+
import { AutocompleteContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
3
3
|
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -19,20 +19,23 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
19
19
|
...props
|
|
20
20
|
}, forwardedRef) => {
|
|
21
21
|
const autocompleteContext = useContext(AutocompleteContext);
|
|
22
|
-
|
|
22
|
+
const inputContext = useContext(AutocompleteInputContext);
|
|
23
|
+
if (autocompleteContext === null || inputContext === null) {
|
|
23
24
|
throw new Error('AutocompleteContext returned null values');
|
|
24
25
|
}
|
|
25
26
|
const {
|
|
26
27
|
activeDescendantRef,
|
|
27
|
-
autocompleteSuggestion = '',
|
|
28
28
|
id,
|
|
29
29
|
inputRef,
|
|
30
|
-
inputValue = '',
|
|
31
|
-
isMenuDirectlyActivated,
|
|
32
30
|
setInputValue,
|
|
33
31
|
setShowMenu,
|
|
34
32
|
showMenu
|
|
35
33
|
} = autocompleteContext;
|
|
34
|
+
const {
|
|
35
|
+
autocompleteSuggestion = '',
|
|
36
|
+
inputValue = '',
|
|
37
|
+
isMenuDirectlyActivated
|
|
38
|
+
} = inputContext;
|
|
36
39
|
useRefObjectAsForwardedRef(forwardedRef, inputRef);
|
|
37
40
|
const [highlightRemainingText, setHighlightRemainingText] = useState(true);
|
|
38
41
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteMenu.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/A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