diff --git a/apps/docs-smoke/src/components/docs-mdx/callout.tsx b/apps/docs-smoke/src/components/docs-mdx/callout.tsx index 1d30383..6088e54 100644 --- a/apps/docs-smoke/src/components/docs-mdx/callout.tsx +++ b/apps/docs-smoke/src/components/docs-mdx/callout.tsx @@ -2,6 +2,8 @@ import type { HTMLAttributes, ReactNode } from "react"; export type CalloutVariant = | "info" + | "note" + | "tip" | "warning" | "success" | "error" @@ -9,26 +11,61 @@ export type CalloutVariant = | "deprecated" | "experimental"; +/** + * Aliases accepted by the deprecated `type` prop. Mirrors `CalloutVariant` + * but also accepts `"warn"` (Fumadocs-style) which maps to `"warning"`. + */ +export type CalloutTypeAlias = CalloutVariant | "warn"; + export type CalloutProps = HTMLAttributes & { variant?: CalloutVariant; + /** @deprecated Use `variant` instead. Kept for Fumadocs-authored MDX compatibility. */ + type?: CalloutTypeAlias; title?: string; children?: ReactNode; }; -function titleCase(value: string): string { +function normalizeVariant( + variant: CalloutVariant | undefined, + type: CalloutTypeAlias | undefined +): CalloutVariant { + if (variant) { + return variant; + } + + if (type === "warn") { + return "warning"; + } + + return type ?? "info"; +} + +function titleCase(value: CalloutVariant): string { + if (value === "canary") { + return "Canary"; + } + return value.charAt(0).toUpperCase() + value.slice(1); } export function Callout({ - variant = "info", + variant, + type, title, children, ...rest }: CalloutProps) { + const resolvedVariant = normalizeVariant(variant, type); + return ( -