@withjoy/joykit
Version:
UI Component Library for Joy web
31 lines (30 loc) • 1.26 kB
TypeScript
declare type DynamicMetricObject = {
fontSizeUnit: 'rem' | 'px';
fontSize: number;
letterSpacing: string;
lineHeight: string;
};
/**
* Supported Inter UI Web font sizes
*/
export declare type InterUIFontSize = 10 | 13 | 14 | 15 | 16 | 17 | 20 | 26;
/**
* For a given font size, there is a matching set of: font size, line height,
* and letter spacing. Inter UI Dynamic Metric provides guidelines for how to
* best use Inter UI. https://rsms.me/inter/dynmetrics/
* @param fontSize number
*/
export declare const getInterUIDynamicMetricObject: (fontSize: InterUIFontSize) => DynamicMetricObject;
export declare type InterUIMetrics = Omit<DynamicMetricObject, 'fontSizeUnit'>;
/**
* Inter UI Dynamic Metric provides guidelines for how to best use their font
*
* We will leverage their system by using their defined "optimal metrics".
*
* @param opticalFontSize Target font size metrics
* @param as Target output unit for font size
*
* @returns a InterUIMetrics object to be used in a CSS-in-JS rule
*/
export declare const getInterUIDynamicMetricCssObject: (opticalFontSize: InterUIFontSize, as?: "rem" | "px") => Pick<DynamicMetricObject, "fontSize" | "letterSpacing" | "lineHeight">;
export {};