File tree Expand file tree Collapse file tree 5 files changed +14
-32
lines changed
Expand file tree Collapse file tree 5 files changed +14
-32
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,12 @@ export const searchFeature: FeatureImplementation = {
5656 getSearchInputElement : ( { tree } ) =>
5757 tree . getDataRef < SearchFeatureDataRef > ( ) . current . searchInput ?? null ,
5858
59+ // TODO memoize with propMemoizationFeature
5960 getSearchInputElementProps : ( { tree } ) => ( {
6061 value : tree . getSearchValue ( ) ,
6162 onChange : ( e : any ) => tree . setSearch ( e . target . value ) ,
6263 onBlur : ( ) => tree . closeSearch ( ) ,
64+ ref : tree . registerSearchInputElement ,
6365 } ) ,
6466
6567 getSearchMatchingItems : memo (
Original file line number Diff line number Diff line change @@ -55,16 +55,11 @@ export const AsyncSearchTree = () => {
5555 < button onClick = { ( ) => tree . openSearch ( ) } > Open Search</ button > or press
5656 any letter keys while focusing the tree to search.
5757 </ p >
58- { tree . isSearchOpen ( ) && (
59- < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
60- ) }
6158 { tree . isSearchOpen ( ) && (
6259 < >
63- < input
64- { ...tree . getSearchInputElementProps ( ) }
65- ref = { tree . registerSearchInputElement }
66- /> { " " }
67- ({ tree . getSearchMatchingItems ( ) . length } matches)
60+ < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
61+ < input { ...tree . getSearchInputElementProps ( ) } /> (
62+ { tree . getSearchMatchingItems ( ) . length } matches)
6863 </ >
6964 ) } { " " }
7065 < div { ...tree . getContainerProps ( ) } className = "tree" >
Original file line number Diff line number Diff line change @@ -50,16 +50,11 @@ export const Basic = () => {
5050 < button onClick = { ( ) => tree . openSearch ( ) } > Open Search</ button > or press
5151 any letter keys while focusing the tree to search.
5252 </ p >
53- { tree . isSearchOpen ( ) && (
54- < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
55- ) }
5653 { tree . isSearchOpen ( ) && (
5754 < >
58- < input
59- { ...tree . getSearchInputElementProps ( ) }
60- ref = { tree . registerSearchInputElement }
61- /> { " " }
62- ({ tree . getSearchMatchingItems ( ) . length } matches)
55+ < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
56+ < input { ...tree . getSearchInputElementProps ( ) } /> (
57+ { tree . getSearchMatchingItems ( ) . length } matches)
6358 </ >
6459 ) } { " " }
6560 < div { ...tree . getContainerProps ( ) } className = "tree" >
Original file line number Diff line number Diff line change @@ -72,16 +72,11 @@ export const CustomMatcher = () => {
7272 < button onClick = { ( ) => tree . openSearch ( ) } > Open Search</ button > or press
7373 any letter keys while focusing the tree to search.
7474 </ p >
75- { tree . isSearchOpen ( ) && (
76- < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
77- ) }
7875 { tree . isSearchOpen ( ) && (
7976 < >
80- < input
81- { ...tree . getSearchInputElementProps ( ) }
82- ref = { tree . registerSearchInputElement }
83- /> { " " }
84- ({ tree . getSearchMatchingItems ( ) . length } matches)
77+ < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
78+ < input { ...tree . getSearchInputElementProps ( ) } /> (
79+ { tree . getSearchMatchingItems ( ) . length } matches)
8580 </ >
8681 ) }
8782 < div { ...tree . getContainerProps ( ) } className = "tree" >
Original file line number Diff line number Diff line change @@ -67,16 +67,11 @@ export const ScrollBehaviour = () => {
6767 < button onClick = { ( ) => tree . openSearch ( ) } > Open Search</ button > or press
6868 any letter keys while focusing the tree to search.
6969 </ p >
70- { tree . isSearchOpen ( ) && (
71- < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
72- ) }
7370 { tree . isSearchOpen ( ) && (
7471 < >
75- < input
76- { ...tree . getSearchInputElementProps ( ) }
77- ref = { tree . registerSearchInputElement }
78- /> { " " }
79- ({ tree . getSearchMatchingItems ( ) . length } matches)
72+ < p > Navigate between search results with ArrowUp and ArrowDown.</ p >
73+ < input { ...tree . getSearchInputElementProps ( ) } /> (
74+ { tree . getSearchMatchingItems ( ) . length } matches)
8075 </ >
8176 ) } { " " }
8277 < div { ...tree . getContainerProps ( ) } className = "tree" >
You can’t perform that action at this time.
0 commit comments