@@ -9,9 +9,10 @@ import {type Library, TAB_DEFS} from './constants';
99import NoSearchResults from '@react-spectrum/s2/illustrations/linear/NoSearchResults' ;
1010import { OverlayTriggerStateContext , Provider , Dialog as RACDialog , DialogProps as RACDialogProps , Tab as RACTab , TabList as RACTabList , TabPanel as RACTabPanel , TabPanelProps as RACTabPanelProps , TabProps as RACTabProps , Tabs as RACTabs , SelectionIndicator , TabRenderProps } from 'react-aria-components' ;
1111import type { PageProps } from '@parcel/rsc' ;
12- import React , { ReactNode , useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
12+ import React , { ReactNode , useCallback , useContext , useEffect , useMemo , useRef , useState } from 'react' ;
1313import { useId } from '@react-aria/utils' ;
1414
15+
1516interface MobileDialogProps extends Omit < RACDialogProps , 'className' | 'style' > {
1617 size ?: 'S' | 'M' | 'L' | 'fullscreen' | 'fullscreenTakeover' ,
1718 isDismissible ?: boolean ,
@@ -208,7 +209,7 @@ const MobileCustomDialog = function MobileCustomDialog(props: MobileDialogProps)
208209} ;
209210
210211function MobileNav ( { pages, currentPage} : PageProps ) {
211- let overlayTriggerState = React . useContext ( OverlayTriggerStateContext ) ;
212+ let overlayTriggerState = useContext ( OverlayTriggerStateContext ) ;
212213 let [ searchFocused , setSearchFocused ] = useState ( false ) ;
213214 let [ searchValue , setSearchValue ] = useState ( '' ) ;
214215 let [ selectedSection , setSelectedSection ] = useState < string | undefined > ( undefined ) ;
@@ -218,7 +219,7 @@ function MobileNav({pages, currentPage}: PageProps) {
218219
219220 let getSectionsForLibrary = useCallback ( ( libraryId : string ) => {
220221 let sectionsMap = new Map ( ) ;
221- let filteredPages = pages . filter ( page => getLibraryFromPage ( page ) === libraryId ) ;
222+ let filteredPages = pages . filter ( page => getLibraryFromPage ( page ) === libraryId && ! page . exports ?. hideFromSearch ) ;
222223 for ( let page of filteredPages ) {
223224 let section = page . exports ?. section ?? 'Components' ;
224225 let sectionPages = sectionsMap . get ( section ) ?? [ ] ;
@@ -243,7 +244,7 @@ function MobileNav({pages, currentPage}: PageProps) {
243244 } ) ;
244245 return sectionArray ;
245246 } , [ getSectionsForLibrary , selectedLibrary ] ) ;
246-
247+
247248
248249 useEffect ( ( ) => {
249250 // Auto-select first section initially or when library changes
@@ -296,9 +297,9 @@ function MobileNav({pages, currentPage}: PageProps) {
296297 if ( ! searchValue . trim ( ) ) {
297298 return pages ;
298299 }
299-
300+
300301 let searchLower = searchValue . toLowerCase ( ) ;
301-
302+
302303 // Filter items where name or tags start with search value
303304 let matchedPages = pages . filter ( page => {
304305 let pageTitle = title ( page ) . toLowerCase ( ) ;
@@ -307,19 +308,19 @@ function MobileNav({pages, currentPage}: PageProps) {
307308 let tagMatch = tags . some ( tag => tag . toLowerCase ( ) . startsWith ( searchLower ) ) ;
308309 return nameMatch || tagMatch ;
309310 } ) ;
310-
311+
311312 // Sort to prioritize name matches over tag matches
312313 return matchedPages . sort ( ( a , b ) => {
313314 let aNameMatch = title ( a ) . toLowerCase ( ) . startsWith ( searchLower ) ;
314315 let bNameMatch = title ( b ) . toLowerCase ( ) . startsWith ( searchLower ) ;
315-
316+
316317 if ( aNameMatch && ! bNameMatch ) {
317318 return - 1 ;
318319 }
319320 if ( ! aNameMatch && bNameMatch ) {
320321 return 1 ;
321322 }
322-
323+
323324 // If both match by name or both match by tag, maintain original order
324325 return 0 ;
325326 } ) ;
@@ -328,9 +329,9 @@ function MobileNav({pages, currentPage}: PageProps) {
328329 let getSectionContent = ( sectionName : string , libraryId : string , searchValue : string = '' ) : ComponentCardItem [ ] => {
329330 let librarySections = getSectionsForLibrary ( libraryId ) ;
330331 let pages = librarySections . get ( sectionName ) ?? [ ] ;
331-
332+
332333 let filteredPages = filterPages ( pages , searchValue ) ;
333-
334+
334335 return filteredPages
335336 . sort ( ( a , b ) => title ( a ) . localeCompare ( title ( b ) ) )
336337 . map ( page => ( { id : page . url . replace ( / ^ \/ / , '' ) , name : title ( page ) , href : page . url } ) ) ;
@@ -355,13 +356,13 @@ function MobileNav({pages, currentPage}: PageProps) {
355356 } else {
356357 items = getSectionContent ( section , libraryId , searchValue ) ;
357358 }
358-
359+
359360 // Sort to show "Introduction" first when search is empty
360361 if ( searchValue . trim ( ) . length === 0 ) {
361362 items = [ ...items ] . sort ( ( a , b ) => {
362363 const aIsIntro = a . name === 'Introduction' ;
363364 const bIsIntro = b . name === 'Introduction' ;
364-
365+
365366 if ( aIsIntro && ! bIsIntro ) {
366367 return - 1 ;
367368 }
@@ -371,14 +372,14 @@ function MobileNav({pages, currentPage}: PageProps) {
371372 return 0 ;
372373 } ) ;
373374 }
374-
375+
375376 return items ;
376377 } ;
377378
378379 let getSectionNamesForLibrary = ( libraryId : string ) => {
379380 let librarySections = getSectionsForLibrary ( libraryId ) ;
380381 let sectionArray = [ ...librarySections . keys ( ) ] ;
381-
382+
382383 // Show 'Components' first
383384 sectionArray . sort ( ( a , b ) => {
384385 if ( a === 'Components' ) {
@@ -389,7 +390,7 @@ function MobileNav({pages, currentPage}: PageProps) {
389390 }
390391 return a . localeCompare ( b ) ;
391392 } ) ;
392-
393+
393394 return sectionArray ;
394395 } ;
395396
@@ -464,17 +465,17 @@ function MobileNav({pages, currentPage}: PageProps) {
464465 { libraries . map ( library => (
465466 < MobileTabPanel key = { library . id } id = { library . id } >
466467 < div className = { stickySearchContainer } >
467- < SearchField
468- aria-label = "Search"
468+ < SearchField
469+ aria-label = "Search"
469470 value = { searchValue }
470471 onChange = { handleSearchChange }
471472 onFocus = { handleSearchFocus }
472473 onBlur = { handleSearchBlur }
473474 styles = { style ( { marginX : 16 } ) } />
474475 < div className = { style ( { overflow : 'auto' , paddingX : 8 , paddingBottom : 8 } ) } >
475476 < TagGroup
476- aria-label = "Navigation sections"
477- selectionMode = "single"
477+ aria-label = "Navigation sections"
478+ selectionMode = "single"
478479 selectedKeys = { selectedSection ? [ selectedSection ] : [ ] }
479480 onSelectionChange = { handleTagSelection }
480481 UNSAFE_style = { { whiteSpace : 'nowrap' } }
0 commit comments