File size: 2,902 Bytes
5c876be | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /**
* Typography helpers & reference mappings for the Antaram design system.
*
* We rely on React Native Paper's built-in MD3 type scale for most text
* rendering, but this module re-exports the variants so that custom
* components can reference a single source of truth.
*/
// βββ Paper text variant β description mapping βββββββββββββββββββββββββββββββββββ
// These correspond to the `variant` prop accepted by `<Text>` from
// react-native-paper. They are listed here for documentation and
// for use in custom components that need programmatic access.
export interface PaperTextVariant {
variant: string;
description: string;
}
export const paperTextVariants: readonly PaperTextVariant[] = [
{ variant: 'displayLarge', description: '57px / β1.25 tracking' },
{ variant: 'displayMedium', description: '45px / β1.25 tracking' },
{ variant: 'displaySmall', description: '36px / 0 tracking' },
{ variant: 'headlineLarge', description: '32px / 0 tracking' },
{ variant: 'headlineMedium', description: '28px / 0 tracking' },
{ variant: 'headlineSmall', description: '24px / 0 tracking' },
{ variant: 'titleLarge', description: '22px / 0 tracking' },
{ variant: 'titleMedium', description: '16px / 0.15 tracking, medium weight' },
{ variant: 'titleSmall', description: '14px / 0.1 tracking, medium weight' },
{ variant: 'bodyLarge', description: '16px / 0.5 tracking' },
{ variant: 'bodyMedium', description: '14px / 0.25 tracking' },
{ variant: 'bodySmall', description: '12px / 0.4 tracking' },
{ variant: 'labelLarge', description: '14px / 0.1 tracking, medium weight' },
{ variant: 'labelMedium', description: '12px / 0.5 tracking, medium weight' },
{ variant: 'labelSmall', description: '11px / 0.5 tracking, medium weight' },
] as const;
/** Convenience type β union of all supported Paper text variant strings */
export type PaperVariant = (typeof paperTextVariants)[number]['variant'];
// βββ App-specific font family βββββββββββββββββββββββββββββββββββββββββββββββββββ
// Override at the application level if a custom font is bundled.
export const fontFamily = {
regular: 'System',
medium: 'System',
bold: 'System',
light: 'System',
thin: 'System',
} as const;
/**
* Default font size overrides keyed by Paper variant name.
* These values extend / override what Paper provides out-of-the-box.
*/
export const fontSizes: Record<PaperVariant, number> = {
displayLarge: 57,
displayMedium: 45,
displaySmall: 36,
headlineLarge: 32,
headlineMedium: 28,
headlineSmall: 24,
titleLarge: 22,
titleMedium: 16,
titleSmall: 14,
bodyLarge: 16,
bodyMedium: 14,
bodySmall: 12,
labelLarge: 14,
labelMedium: 12,
labelSmall: 11,
};
|