import { ComponentPropsWithoutRef, ReactNode } from 'react';
/** Visual scale only; semantic level is selected separately with `el`. */
export type HeadlineSize = "regular" | "substantial" | "major" | "hero";
/** Visual scale shared by block and inline body text. */
export type BodySize = "fine" | "compact" | "regular" | "featured";
/**
* HTML phrasing content only. Block descendants produce invalid `
`,
* ``, or heading markup; prefer Carto components over raw equivalents.
*/
export type TextContent = ReactNode;
type TextHighlighted = {
/**
* Applies suggested-change highlighting. Defaults to `false`.
*/
highlighted?: boolean;
};
/** Headline text with a required semantic element. */
export type HeadlineProps = Omit, "children" | "style"> & TextHighlighted & {
/** Pairs headline styling with the required semantic heading element. */
variant: "headline";
/** Defaults to `major` (24px). */
size?: HeadlineSize;
/**
* Semantic heading level, independent of visual size.
*/
el: T;
/** Phrasing content only; see {@link TextContent}. */
text: TextContent;
inline?: never;
};
/** Fixed inline eyebrow treatment. */
export type EyebrowProps = Omit, "children" | "style"> & TextHighlighted & {
/** Uses eyebrow styling and always renders a ``. */
variant: "eyebrow";
/** Phrasing content only; see {@link TextContent}. */
text: TextContent;
el?: never;
inline?: never;
size?: never;
};
/** Default body text; renders a ``. */
export type BodyProps = Omit, "children" | "style"> & TextHighlighted & {
/** Omit for the default body treatment. */
variant?: "body";
/** Defaults to `regular` (16px). */
size?: BodySize;
/** Phrasing content only; see {@link TextContent}. */
text: TextContent;
inline?: never;
el?: never;
};
/** Inline body text for nesting inside another `Text`. */
export type BodyInlineProps = Omit, "children" | "style"> & TextHighlighted & {
/** Omit for the default body treatment. */
variant?: "body";
/** Defaults to `regular` (16px). */
size?: BodySize;
/** Phrasing content only; see {@link TextContent}. */
text: TextContent;
/** Renders body text as `` instead of `` so it composes inline. */
inline: true;
el?: never;
};
/**
* Selects headline, eyebrow, or body typography without accepting arbitrary
* children.
*/
export type TextProps = HeadlineProps<"h1"> | HeadlineProps<"h2"> | HeadlineProps<"h3"> | HeadlineProps<"h4"> | HeadlineProps<"h5"> | HeadlineProps<"h6"> | EyebrowProps | BodyProps | BodyInlineProps;
export {};