Files
zeekay 05fc512820 feat: sync upstream shadcn/ui — [email protected], v4 app, font system, chart improvements
Upstream sync from shadcn-ui/ui (1686 commits since last merge base).

Key changes:
- packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors)
- apps/v4 replaces apps/www as the primary docs/registry app
- Font system: 25+ heading font registries, font markers utility, @supports override
- Chart improvements: recharts v3 compat, radial chart fixes
- templates/ updated with monorepo variants (astro, vite, react-router, start)
- skills/shadcn AI skill definitions added
- deprecated/ removed (auth, auth-firebase, cli, www)

Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
2026-03-24 19:04:31 -07:00

56 lines
1.5 KiB
TypeScript

import * as React from "react"
import { type registryItemSchema } from "shadcn/schema"
import { type z } from "zod"
import { highlightCode } from "@/lib/highlight-code"
import { getRegistryItem } from "@/lib/registry"
import { cn } from "@/lib/utils"
import { ChartIframe } from "@/components/chart-iframe"
import { ChartToolbar } from "@/components/chart-toolbar"
import { type Style } from "@/registry/_legacy-styles"
export type Chart = z.infer<typeof registryItemSchema> & {
highlightedCode: string
}
export function ChartDisplay({
chart,
style,
className,
}: {
chart: Chart
style: string
} & React.ComponentProps<"div">) {
return (
<div
className={cn(
"themes-wrapper group relative flex flex-col overflow-hidden rounded-xl transition-all duration-200 ease-in-out hover:z-30",
className
)}
>
<ChartToolbar
chart={chart}
className="relative z-20 flex justify-end px-3 py-2.5"
/>
<div className="relative z-10 overflow-hidden rounded-xl bg-background">
<ChartIframe
src={`/view/${style}/${chart.name}`}
height={460}
title={chart.name}
/>
</div>
</div>
)
}
// Exported for parallel prefetching in page components.
export const getCachedRegistryItem = React.cache(
async (name: string, styleName: Style["name"]) => {
return await getRegistryItem(name, styleName)
}
)
export const getChartHighlightedCode = React.cache(async (content: string) => {
return await highlightCode(content)
})