/** * One Typography tab (Headings / Body Text / Links / Buttons / Misc), mounted * on its own — the Customizer host gives each a real native section of its * own (`aureon_typography_{key}`), reached from the Typography hub's own row * for it (see `onNavigateTab` in index.tsx), for the same genuine * "Customizing ▸ Aureon ▸ Typography ▸ …" breadcrumb Font Pairings already * gets. Same schema, same fields, same store as the hub's own inline * `TabPanel` for this key — only the navigation differs. */ import SectionFields from './section-fields'; import { useTypographyHelpers, isSectionDefault, } from './use-typography-helpers'; import type { TypographySchema, FontPairingsSchema, WorkingSettings, SetPath, } from '../../types'; interface TypographyTabSectionProps { schema?: TypographySchema; fontPairingsSchema?: FontPairingsSchema; tabKey: string; defaults: Partial< WorkingSettings >; working: WorkingSettings; setPath: SetPath; onManagePairings: () => void; } export default function TypographyTabSection( { schema, fontPairingsSchema, tabKey, defaults, working, setPath, onManagePairings, }: TypographyTabSectionProps ) { const { families, familyDefaults, typography, typographyDefaults, familyOptions, pairingFamilyOptions, weightOptions, transformOptions, decorationOptions, scaleOptions, activePairingFontLabel, familyCssFor, } = useTypographyHelpers( { schema, fontPairingsSchema, defaults, working, } ); if ( ! schema ) { return null; } const tabMeta = schema.tabs.find( ( tab ) => tab.key === tabKey ); const sections = Object.values( schema.sections ).filter( ( section ) => section.tab === tabKey ); return (

{ tabMeta?.label ?? tabKey }

{ sections.map( ( section ) => { const values = typography[ section.key ] ?? {}; const defaultValues = typographyDefaults[ section.key ] ?? {}; const familyValue = families[ section.family_role ] ?? 'system'; return ( { if ( undefined !== familyDefaults[ section.family_role ] ) { setPath( `${ schema.family_path }.${ section.family_role }`, familyDefaults[ section.family_role ] ); } setPath( section.path, defaultValues ); } } onChangeFamily={ ( value ) => setPath( `${ schema.family_path }.${ section.family_role }`, value ) } setPath={ setPath } onManagePairings={ onManagePairings } showHeadingPreview={ 'headings' === section.key && Boolean( typography.headings ) } /> ); } ) }
); }