/** * Left column of the Add Font picker: the filtered/sorted Google Fonts * catalog as a checkbox list. Only the first PAGE_SIZE matches render * initially — with ~1,900 fonts in the full catalog, dumping every row into * the DOM at once would make the modal sluggish; "Show more" reveals * additional pages on demand instead of pulling in a virtualization library. */ import { useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { Button, CheckboxControl } from '@wordpress/components'; import type { FontLibraryCatalogEntry } from '../../types'; const PAGE_SIZE = 200; interface FontPickerListProps { fonts: FontLibraryCatalogEntry[]; selectedSlugs: string[]; existingSlugs: string[]; onToggle: ( font: FontLibraryCatalogEntry ) => void; } export default function FontPickerList( { fonts, selectedSlugs, existingSlugs, onToggle, }: FontPickerListProps ) { const [ visibleCount, setVisibleCount ] = useState( PAGE_SIZE ); const visible = fonts.slice( 0, visibleCount ); const remaining = fonts.length - visible.length; return (