diff --git a/packages/dev/s2-docs/src/ColorSearchView.tsx b/packages/dev/s2-docs/src/ColorSearchView.tsx index a19b193f925..cfac63ad930 100644 --- a/packages/dev/s2-docs/src/ColorSearchView.tsx +++ b/packages/dev/s2-docs/src/ColorSearchView.tsx @@ -201,10 +201,11 @@ interface ColorSearchViewProps { /** Names of colors that exactly match the searched hex value. */ exactMatches?: Set, /** Names of the closest matching colors when no exact matches exist. */ - closestMatches?: Set + closestMatches?: Set, + listBoxClassName?: string } -export function ColorSearchView({filteredItems, exactMatches = new Set(), closestMatches = new Set()}: ColorSearchViewProps) { +export function ColorSearchView({filteredItems, exactMatches = new Set(), closestMatches = new Set(), listBoxClassName}: ColorSearchViewProps) { const [copiedId, setCopiedId] = useState(null); const timeout = useRef | null>(null); @@ -261,7 +262,7 @@ export function ColorSearchView({filteredItems, exactMatches = new Set(), closes } }} layout="grid" - className={style({ + className={listBoxClassName || style({ width: 'full', display: 'flex', flexDirection: 'column', diff --git a/packages/dev/s2-docs/src/IconSearchView.tsx b/packages/dev/s2-docs/src/IconSearchView.tsx index 4a226bfbd27..d76ced5f506 100644 --- a/packages/dev/s2-docs/src/IconSearchView.tsx +++ b/packages/dev/s2-docs/src/IconSearchView.tsx @@ -76,7 +76,7 @@ function IconListBox({items, copiedId, onAction, listBoxClassName}: IconListBoxP onAction={(item) => onAction(item.toString())} items={items} layout="grid" - className={listBoxClassName || style({width: '100%', scrollPaddingY: 4, overflow: 'auto'})} + className={listBoxClassName || style({width: '100%', scrollPaddingY: 4, padding: 8})} dependencies={[copiedId]} renderEmptyState={() => ( diff --git a/packages/dev/s2-docs/src/MobileSearchMenu.tsx b/packages/dev/s2-docs/src/MobileSearchMenu.tsx index 501f7d71a5e..89d51b997c7 100644 --- a/packages/dev/s2-docs/src/MobileSearchMenu.tsx +++ b/packages/dev/s2-docs/src/MobileSearchMenu.tsx @@ -17,6 +17,7 @@ import {IconSearchSkeleton, useIconFilter} from './IconSearchView'; import {type Library} from './constants'; import React, {cloneElement, CSSProperties, ReactElement, ReactNode, Suspense, useContext, useEffect, useRef, useState} from 'react'; import {SearchTagGroups} from './SearchTagGroups'; +import {TypographySearchView} from './TypographySearchView'; import {useId} from '@react-aria/utils'; import {useRouter} from './Router'; @@ -242,6 +243,7 @@ function MobileNav({initialTag}: {initialTag?: string}) { const filteredColors = useFilteredColors(searchValue); const isColorsSelected = selectedSection === 'colors'; + const isTypographySelected = selectedSection === 'typography'; let handleSearchFocus = () => { setSearchFocused(true); @@ -311,7 +313,10 @@ function MobileNav({initialTag}: {initialTag?: string}) { const showIcons = isIconsSelected && library.id === 'react-spectrum'; return ( - +
+ closestMatches={filteredColors.closestMatches} + listBoxClassName={style({ + flexGrow: 1, + overflow: 'auto', + width: '100%', + scrollPaddingY: 4 + })} /> )} - {!showIcons && (!isColorsSelected || library.id !== 'react-spectrum') && ( + {!showIcons && isTypographySelected && library.id === 'react-spectrum' && ( + + )} + {!showIcons && !isColorsSelected && !isTypographySelected && ( { diff --git a/packages/dev/s2-docs/src/SearchMenu.tsx b/packages/dev/s2-docs/src/SearchMenu.tsx index 7e5eb7964ae..a15c544881a 100644 --- a/packages/dev/s2-docs/src/SearchMenu.tsx +++ b/packages/dev/s2-docs/src/SearchMenu.tsx @@ -20,6 +20,7 @@ import {SearchTagGroups} from './SearchTagGroups'; import {style} from '@react-spectrum/s2/style' with { type: 'macro' }; import {Tab, TabList, TabPanel, Tabs} from './Tabs'; import {TextFieldRef} from '@react-types/textfield'; +import {TypographySearchView} from './TypographySearchView'; import {useRouter} from './Router'; import './SearchMenu.css'; import {preloadComponentImages} from './ComponentCard'; @@ -160,7 +161,10 @@ export function SearchMenu(props: SearchMenuProps) { const placeholderText = getPlaceholderText(tab.label); return ( - +
{ preloadComponentImages(sections.find(s => s.id === tag)?.children?.map(c => c.name) || []); }} /> @@ -198,11 +204,20 @@ export function SearchMenu(props: SearchMenuProps) { {selectedTagId === 'colors' && (
}> - +
)} - {selectedTagId !== 'icons' && selectedTagId !== 'colors' && ( + {selectedTagId === 'typography' && ( +
+ +
+ )} + {selectedTagId !== 'icons' && selectedTagId !== 'colors' && selectedTagId !== 'typography' && ( '}, + {id: 'h2', name: '

'}, + {id: 'h3', name: '

'}, + {id: 'h4', name: '

'}, + {id: 'h5', name: '

'}, + {id: 'h6', name: '
'}, + {id: 'p', name: '

'}, + {id: 'span', name: ''}, + {id: 'div', name: '

'}, + {id: 'label', name: '