import { FontManager } from '@samuelmeuli/font-manager'; import React, { KeyboardEvent, PureComponent, ReactElement } from 'react'; import { Category, Font, Script, SortOption, Variant } from './types'; type LoadingStatus = 'loading' | 'finished' | 'error'; export interface Props { apiKey: string; activeFontFamily: string; onChange: (font: Font) => void; pickerId: string; families: string[]; categories: Category[]; scripts: Script[]; variants: Variant[]; filter: (font: Font) => boolean; limit: number; sort: SortOption; } interface State { expanded: boolean; loadingStatus: LoadingStatus; } export default class FontPicker extends PureComponent { fontManager: FontManager; static defaultProps: { activeFontFamily: string; onChange: () => void; pickerId: string; families: any[]; categories: any[]; scripts: string[]; variants: string[]; filter: () => boolean; limit: number; sort: string; }; state: Readonly; constructor(props: Props); componentDidMount: () => void; /** * After every component update, check whether the activeFontFamily prop has changed. If so, * call this.setActiveFontFamily with the new font */ componentDidUpdate: (prevProps: Props) => void; /** * EventListener for closing the font picker when clicking anywhere outside it */ onClose: (e: MouseEvent) => void; /** * Update the active font on font button click */ onSelection: (e: React.MouseEvent | KeyboardEvent) => void; /** * Set the specified font as the active font in the fontManager and update activeFontFamily in the * state */ setActiveFontFamily: (activeFontFamily: string) => void; /** * Generate