@primer/react 38.6.3-rc.f8f5fddc3 → 38.7.0-rc.b626e5d83
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.
Potentially problematic release.
This version of @primer/react might be problematic. Click here for more details.
- package/CHANGELOG.md +48 -1
- package/dist/ActionBar/ActionBar.d.ts +8 -0
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +83 -53
- package/dist/ActionBar/index.d.ts +1 -0
- package/dist/ActionBar/index.d.ts.map +1 -1
- 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/FilteredActionList/FilteredActionList.d.ts +6 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +4 -2
- package/dist/PageLayout/{PageLayout-c092f3db.css → PageLayout-51007c87.css} +2 -2
- package/dist/PageLayout/PageLayout-51007c87.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +399 -313
- package/dist/PageLayout/PageLayout.module.css.js +1 -1
- package/dist/PageLayout/paneUtils.d.ts +11 -0
- package/dist/PageLayout/paneUtils.d.ts.map +1 -0
- package/dist/PageLayout/paneUtils.js +34 -0
- package/dist/PageLayout/usePaneWidth.d.ts +2 -1
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +56 -44
- package/dist/SelectPanel/SelectPanel.d.ts +6 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -1
- package/dist/TextInput/TextInput-dff8f842.css +2 -0
- package/dist/TextInput/TextInput-dff8f842.css.map +1 -0
- package/dist/TextInput/TextInput.d.ts +5 -0
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +125 -51
- package/dist/TextInput/TextInput.module.css.js +5 -0
- package/dist/Textarea/{TextArea-54099020.css → TextArea-53e27580.css} +2 -2
- package/dist/Textarea/TextArea-53e27580.css.map +1 -0
- package/dist/Textarea/TextArea.module.css.js +2 -2
- package/dist/Textarea/Textarea.d.ts +10 -0
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Textarea/Textarea.js +215 -69
- 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/hooks/useFocusZone.d.ts +4 -0
- package/dist/hooks/useFocusZone.d.ts.map +1 -1
- package/dist/internal/utils/hasInteractiveNodes.d.ts.map +1 -1
- package/dist/internal/utils/hasInteractiveNodes.js +22 -16
- package/dist/utils/__tests__/character-counter.test.d.ts +2 -0
- package/dist/utils/__tests__/character-counter.test.d.ts.map +1 -0
- package/dist/utils/character-counter.d.ts +27 -0
- package/dist/utils/character-counter.d.ts.map +1 -0
- package/dist/utils/character-counter.js +65 -0
- package/generated/components.json +16 -0
- package/package.json +9 -9
- package/dist/BaseStyles-79fd37c4.css.map +0 -1
- package/dist/Dialog/Dialog-1a61e61a.css.map +0 -1
- package/dist/PageLayout/PageLayout-c092f3db.css.map +0 -1
- package/dist/Textarea/TextArea-54099020.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,11 +1,58 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 38.
|
|
3
|
+
## 38.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7293](https://github.com/primer/react/pull/7293) [`d418509`](https://github.com/primer/react/commit/d418509884c6eb725e08c818f494e5e15495d4a1) Thanks [@lindseywild](https://github.com/lindseywild)! - Adds character counts to TextInput and TextArea components
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
11
|
- [#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
12
|
|
|
13
|
+
- [#7426](https://github.com/primer/react/pull/7426) [`094be60`](https://github.com/primer/react/commit/094be609691f481bfc3c3c4eeae092e38f27167c) Thanks [@kelsey-myers](https://github.com/kelsey-myers)! - Add focusPrependedElements prop to useFocusZone, FilteredActionList, and SelectPanel
|
|
14
|
+
|
|
15
|
+
- [#7349](https://github.com/primer/react/pull/7349) [`713d5a5`](https://github.com/primer/react/commit/713d5a5c5616e005cf8e939f33f8526210d3d634) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageLayout: Optimize drag/resize performance with inline styles and new optimizations
|
|
16
|
+
|
|
17
|
+
**Refactored:**
|
|
18
|
+
|
|
19
|
+
- Use direct attribute selectors (`.Pane[data-dragging='true']`) instead of descendant selectors for CSS containment (O(1) vs O(n) selector matching)
|
|
20
|
+
- Extract optimization utilities to `paneUtils.ts`
|
|
21
|
+
- Apply drag handle visual feedback via inline styles and CSS variables
|
|
22
|
+
|
|
23
|
+
**Added:**
|
|
24
|
+
|
|
25
|
+
- `content-visibility: auto` during drag/resize to skip off-screen content rendering
|
|
26
|
+
- rAF throttle for drag updates (one update per frame, latest position wins)
|
|
27
|
+
- Containment during window resize (parity with drag)
|
|
28
|
+
|
|
29
|
+
These changes improve style recalculation performance on large DOMs (100k+ nodes) by eliminating descendant selector traversal.
|
|
30
|
+
|
|
31
|
+
- [#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
|
|
32
|
+
|
|
33
|
+
Split AutocompleteContext into separate contexts for static values, setters, and dynamic state.
|
|
34
|
+
Components now subscribe only to the context slices they need, reducing re-renders.
|
|
35
|
+
|
|
36
|
+
- [#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
|
|
37
|
+
|
|
38
|
+
Remove `:has([data-color-mode])` selectors that scanned the entire DOM on every style recalculation.
|
|
39
|
+
Input color-scheme is already handled by global selectors in the codebase.
|
|
40
|
+
|
|
41
|
+
- [#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
|
|
42
|
+
|
|
43
|
+
- Add `primer_react_css_has_selector_perf` feature flag (default: false)
|
|
44
|
+
- When flag is OFF: uses legacy `body:has(.Dialog.DisableScroll)` selector
|
|
45
|
+
- When flag is ON: uses optimized direct `body[data-dialog-scroll-disabled]` data attribute with ref counting
|
|
46
|
+
- Enables gradual rollout and easy rollback of performance optimization
|
|
47
|
+
|
|
48
|
+
- [#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
|
|
49
|
+
|
|
50
|
+
- Use combined querySelectorAll selector instead of recursive traversal
|
|
51
|
+
- Check attribute-based states (disabled, hidden, inert) before getComputedStyle
|
|
52
|
+
- Only call getComputedStyle when CSS-based visibility check is needed
|
|
53
|
+
|
|
54
|
+
- [#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
|
|
55
|
+
|
|
9
56
|
## 38.6.2
|
|
10
57
|
|
|
11
58
|
### Patch Changes
|
|
@@ -84,6 +84,10 @@ export type ActionBarMenuProps = {
|
|
|
84
84
|
* If 'none' is provided, no icon will be shown in the overflow menu.
|
|
85
85
|
*/
|
|
86
86
|
overflowIcon?: ActionBarIconButtonProps['icon'] | 'none';
|
|
87
|
+
/**
|
|
88
|
+
* Target element to return focus to when the menu is closed.
|
|
89
|
+
*/
|
|
90
|
+
returnFocusRef?: React.RefObject<HTMLElement>;
|
|
87
91
|
} & IconButtonProps;
|
|
88
92
|
export declare const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>>;
|
|
89
93
|
export declare const ActionBarIconButton: React.ForwardRefExoticComponent<ActionBarIconButtonProps & React.RefAttributes<unknown>>;
|
|
@@ -101,6 +105,10 @@ export declare const ActionBarMenu: React.ForwardRefExoticComponent<{
|
|
|
101
105
|
* If 'none' is provided, no icon will be shown in the overflow menu.
|
|
102
106
|
*/
|
|
103
107
|
overflowIcon?: ActionBarIconButtonProps["icon"] | "none";
|
|
108
|
+
/**
|
|
109
|
+
* Target element to return focus to when the menu is closed.
|
|
110
|
+
*/
|
|
111
|
+
returnFocusRef?: React.RefObject<HTMLElement>;
|
|
104
112
|
} & {
|
|
105
113
|
'aria-label': string;
|
|
106
114
|
'aria-labelledby'?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../src/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAE7E,OAAO,EAAa,KAAK,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAOlE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../src/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAE7E,OAAO,EAAa,KAAK,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAOlE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAA;AAqD9C,KAAK,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAExC,KAAK,SAAS,GACV;IACE,wDAAwD;IACxD,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IAChD,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAC9B,GACD;IACE,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;;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M,CAAC,CAAA;IACtC,KAAK,EAAE,sBAAsB,EAAE,CAAA;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IACxD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;CAC9C,GAAG,eAAe,CAAA;AAgInB,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAgNvE,CAAA;AAED,eAAO,MAAM,mBAAmB,0FAqD/B,CAAA;AAMD,eAAO,MAAM,cAAc;;iCA6BzB,CAAA;AAEF,eAAO,MAAM,aAAa;IA1bxB,2CAA2C;kBAC7B,MAAM;IACpB,+BAA+B;UACzB,wBAAwB,CAAC,MAAM,CAAC;WAC/B,sBAAsB,EAAE;IAC/B;;;OAGG;mBACY,wBAAwB,CAAC,MAAM,CAAC,GAAG,MAAM;IACxD;;OAEG;qBACc,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;wGA6d9C,CAAA;AAED,eAAO,MAAM,eAAe,gCAoB3B,CAAA"}
|
|
@@ -373,7 +373,8 @@ const ActionBar = props => {
|
|
|
373
373
|
const menuItems = menuItem.items;
|
|
374
374
|
const {
|
|
375
375
|
icon: Icon_0,
|
|
376
|
-
label: label_0
|
|
376
|
+
label: label_0,
|
|
377
|
+
returnFocusRef
|
|
377
378
|
} = menuItem;
|
|
378
379
|
return /*#__PURE__*/jsxs(ActionMenu, {
|
|
379
380
|
children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
@@ -383,6 +384,9 @@ const ActionBar = props => {
|
|
|
383
384
|
}) : null, label_0]
|
|
384
385
|
})
|
|
385
386
|
}), /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
387
|
+
...(returnFocusRef && {
|
|
388
|
+
returnFocusRef
|
|
389
|
+
}),
|
|
386
390
|
children: /*#__PURE__*/jsx(ActionList, {
|
|
387
391
|
children: menuItems.map(_temp3)
|
|
388
392
|
})
|
|
@@ -691,18 +695,20 @@ const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
691
695
|
return t5;
|
|
692
696
|
});
|
|
693
697
|
const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
694
|
-
const $ = c(
|
|
698
|
+
const $ = c(42);
|
|
695
699
|
let ariaLabel;
|
|
696
700
|
let icon;
|
|
697
701
|
let items;
|
|
698
702
|
let overflowIcon;
|
|
699
703
|
let props;
|
|
704
|
+
let returnFocusRef;
|
|
700
705
|
if ($[0] !== t0) {
|
|
701
706
|
({
|
|
702
707
|
"aria-label": ariaLabel,
|
|
703
708
|
icon,
|
|
704
709
|
overflowIcon,
|
|
705
710
|
items,
|
|
711
|
+
returnFocusRef,
|
|
706
712
|
...props
|
|
707
713
|
} = t0);
|
|
708
714
|
$[0] = t0;
|
|
@@ -711,12 +717,14 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
711
717
|
$[3] = items;
|
|
712
718
|
$[4] = overflowIcon;
|
|
713
719
|
$[5] = props;
|
|
720
|
+
$[6] = returnFocusRef;
|
|
714
721
|
} else {
|
|
715
722
|
ariaLabel = $[1];
|
|
716
723
|
icon = $[2];
|
|
717
724
|
items = $[3];
|
|
718
725
|
overflowIcon = $[4];
|
|
719
726
|
props = $[5];
|
|
727
|
+
returnFocusRef = $[6];
|
|
720
728
|
}
|
|
721
729
|
const backupRef = useRef(null);
|
|
722
730
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
@@ -729,7 +737,7 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
729
737
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
730
738
|
const widthRef = useRef();
|
|
731
739
|
let t1;
|
|
732
|
-
if ($[
|
|
740
|
+
if ($[7] !== ariaLabel || $[8] !== icon || $[9] !== id || $[10] !== items || $[11] !== overflowIcon || $[12] !== ref || $[13] !== registerChild || $[14] !== returnFocusRef || $[15] !== unregisterChild) {
|
|
733
741
|
t1 = () => {
|
|
734
742
|
var _ref$current3;
|
|
735
743
|
const width = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.getBoundingClientRect().width;
|
|
@@ -744,43 +752,45 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
744
752
|
width: widthRef.current,
|
|
745
753
|
label: ariaLabel,
|
|
746
754
|
icon: overflowIcon ? overflowIcon : icon,
|
|
755
|
+
returnFocusRef,
|
|
747
756
|
items
|
|
748
757
|
});
|
|
749
758
|
return () => {
|
|
750
759
|
unregisterChild(id);
|
|
751
760
|
};
|
|
752
761
|
};
|
|
753
|
-
$[
|
|
754
|
-
$[
|
|
755
|
-
$[
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
|
|
763
|
-
|
|
762
|
+
$[7] = ariaLabel;
|
|
763
|
+
$[8] = icon;
|
|
764
|
+
$[9] = id;
|
|
765
|
+
$[10] = items;
|
|
766
|
+
$[11] = overflowIcon;
|
|
767
|
+
$[12] = ref;
|
|
768
|
+
$[13] = registerChild;
|
|
769
|
+
$[14] = returnFocusRef;
|
|
770
|
+
$[15] = unregisterChild;
|
|
771
|
+
$[16] = t1;
|
|
772
|
+
} else {
|
|
773
|
+
t1 = $[16];
|
|
764
774
|
}
|
|
765
775
|
let t2;
|
|
766
|
-
if ($[
|
|
776
|
+
if ($[17] !== ariaLabel || $[18] !== icon || $[19] !== items || $[20] !== overflowIcon || $[21] !== registerChild || $[22] !== unregisterChild) {
|
|
767
777
|
t2 = [registerChild, unregisterChild, ariaLabel, overflowIcon, icon, items];
|
|
768
|
-
$[
|
|
769
|
-
$[
|
|
770
|
-
$[
|
|
771
|
-
$[
|
|
772
|
-
$[
|
|
773
|
-
$[
|
|
774
|
-
$[
|
|
778
|
+
$[17] = ariaLabel;
|
|
779
|
+
$[18] = icon;
|
|
780
|
+
$[19] = items;
|
|
781
|
+
$[20] = overflowIcon;
|
|
782
|
+
$[21] = registerChild;
|
|
783
|
+
$[22] = unregisterChild;
|
|
784
|
+
$[23] = t2;
|
|
775
785
|
} else {
|
|
776
|
-
t2 = $[
|
|
786
|
+
t2 = $[23];
|
|
777
787
|
}
|
|
778
788
|
useIsomorphicLayoutEffect(t1, t2);
|
|
779
789
|
if (!isVisibleChild(id)) {
|
|
780
790
|
return null;
|
|
781
791
|
}
|
|
782
792
|
let t3;
|
|
783
|
-
if ($[
|
|
793
|
+
if ($[24] !== ariaLabel || $[25] !== icon || $[26] !== props) {
|
|
784
794
|
t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
785
795
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
786
796
|
variant: "invisible",
|
|
@@ -789,50 +799,70 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
789
799
|
...props
|
|
790
800
|
})
|
|
791
801
|
});
|
|
792
|
-
$[
|
|
793
|
-
$[
|
|
794
|
-
$[
|
|
795
|
-
$[
|
|
802
|
+
$[24] = ariaLabel;
|
|
803
|
+
$[25] = icon;
|
|
804
|
+
$[26] = props;
|
|
805
|
+
$[27] = t3;
|
|
796
806
|
} else {
|
|
797
|
-
t3 = $[
|
|
807
|
+
t3 = $[27];
|
|
798
808
|
}
|
|
799
809
|
let t4;
|
|
800
|
-
if ($[
|
|
801
|
-
t4 =
|
|
802
|
-
|
|
803
|
-
|
|
810
|
+
if ($[28] !== returnFocusRef) {
|
|
811
|
+
t4 = returnFocusRef && {
|
|
812
|
+
returnFocusRef
|
|
813
|
+
};
|
|
814
|
+
$[28] = returnFocusRef;
|
|
815
|
+
$[29] = t4;
|
|
804
816
|
} else {
|
|
805
|
-
t4 = $[
|
|
817
|
+
t4 = $[29];
|
|
806
818
|
}
|
|
807
819
|
let t5;
|
|
808
|
-
if ($[
|
|
809
|
-
t5 =
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
})
|
|
813
|
-
});
|
|
814
|
-
$[28] = t4;
|
|
815
|
-
$[29] = t5;
|
|
820
|
+
if ($[30] !== items) {
|
|
821
|
+
t5 = items.map(_temp4);
|
|
822
|
+
$[30] = items;
|
|
823
|
+
$[31] = t5;
|
|
816
824
|
} else {
|
|
817
|
-
t5 = $[
|
|
825
|
+
t5 = $[31];
|
|
818
826
|
}
|
|
819
827
|
let t6;
|
|
820
|
-
if ($[
|
|
821
|
-
t6 = /*#__PURE__*/
|
|
828
|
+
if ($[32] !== t5) {
|
|
829
|
+
t6 = /*#__PURE__*/jsx(ActionList, {
|
|
830
|
+
children: t5
|
|
831
|
+
});
|
|
832
|
+
$[32] = t5;
|
|
833
|
+
$[33] = t6;
|
|
834
|
+
} else {
|
|
835
|
+
t6 = $[33];
|
|
836
|
+
}
|
|
837
|
+
let t7;
|
|
838
|
+
if ($[34] !== t4 || $[35] !== t6) {
|
|
839
|
+
t7 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
840
|
+
...t4,
|
|
841
|
+
children: t6
|
|
842
|
+
});
|
|
843
|
+
$[34] = t4;
|
|
844
|
+
$[35] = t6;
|
|
845
|
+
$[36] = t7;
|
|
846
|
+
} else {
|
|
847
|
+
t7 = $[36];
|
|
848
|
+
}
|
|
849
|
+
let t8;
|
|
850
|
+
if ($[37] !== menuOpen || $[38] !== ref || $[39] !== t3 || $[40] !== t7) {
|
|
851
|
+
t8 = /*#__PURE__*/jsxs(ActionMenu, {
|
|
822
852
|
anchorRef: ref,
|
|
823
853
|
open: menuOpen,
|
|
824
854
|
onOpenChange: setMenuOpen,
|
|
825
|
-
children: [t3,
|
|
855
|
+
children: [t3, t7]
|
|
826
856
|
});
|
|
827
|
-
$[
|
|
828
|
-
$[
|
|
829
|
-
$[
|
|
830
|
-
$[
|
|
831
|
-
$[
|
|
857
|
+
$[37] = menuOpen;
|
|
858
|
+
$[38] = ref;
|
|
859
|
+
$[39] = t3;
|
|
860
|
+
$[40] = t7;
|
|
861
|
+
$[41] = t8;
|
|
832
862
|
} else {
|
|
833
|
-
|
|
863
|
+
t8 = $[41];
|
|
834
864
|
}
|
|
835
|
-
return
|
|
865
|
+
return t8;
|
|
836
866
|
});
|
|
837
867
|
const VerticalDivider = () => {
|
|
838
868
|
const $ = c(8);
|
|
@@ -10,6 +10,7 @@ declare const ActionBar: import("react").FC<import("react").PropsWithChildren<im
|
|
|
10
10
|
icon: import("./ActionBar").ActionBarIconButtonProps["icon"];
|
|
11
11
|
items: import("./ActionBar").ActionBarMenuItemProps[];
|
|
12
12
|
overflowIcon?: import("./ActionBar").ActionBarIconButtonProps["icon"] | "none";
|
|
13
|
+
returnFocusRef?: React.RefObject<HTMLElement>;
|
|
13
14
|
} & {
|
|
14
15
|
'aria-label': string;
|
|
15
16
|
'aria-labelledby'?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionBar/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAC,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,aAAa,CAAA;AAE3F,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionBar/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAC,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,aAAa,CAAA;AAE3F,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CAKb,CAAA;AAEF,eAAe,SAAS,CAAA;AACxB,OAAO,EAAC,SAAS,EAAC,CAAA"}
|
|
@@ -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/AutocompleteMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAK7E,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAA;AAI1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAOrD,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAA;AAClD,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,mBAAmB,EAAE,IAAI,CAAC,GAAG;IAE3E,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrG,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,cAAc,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;CACvG,CAAA;AA4BD,KAAK,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,oBAAoB,GAAG;IAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAC,CAAA;AAE3F,MA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