Files
ui/apps/v4/components/code-collapsible-wrapper.tsx
zeekay 11b02e8dcb feat: sync with upstream shadcn/ui (through [email protected])
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in:
- [email protected] through [email protected] releases
- New apps/v4 directory structure
- Registry system improvements and MCP server
- Framework support (Vue, Svelte, React Native)
- New templates (vite-app, monorepo-next, laravel)
- Zod 4 compatibility (scoped override for zod@>4)
- Test fixture corrections for alias resolution

All 867 merge conflicts resolved preserving Hanzo customizations.
1020/1020 shadcn tests pass.
2026-02-09 10:44:26 -08:00

52 lines
1.7 KiB
TypeScript

"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/registry/new-york-v4/ui/collapsible"
import { Separator } from "@/registry/new-york-v4/ui/separator"
export function CodeCollapsibleWrapper({
className,
children,
...props
}: React.ComponentProps<typeof Collapsible>) {
const [isOpened, setIsOpened] = React.useState(false)
return (
<Collapsible
open={isOpened}
onOpenChange={setIsOpened}
className={cn("group/collapsible relative md:-mx-1", className)}
{...props}
>
<CollapsibleTrigger asChild>
<div className="absolute top-1.5 right-9 z-10 flex items-center">
<Button
variant="ghost"
size="sm"
className="text-muted-foreground h-7 rounded-md px-2"
>
{isOpened ? "Collapse" : "Expand"}
</Button>
<Separator orientation="vertical" className="mx-1.5 !h-4" />
</div>
</CollapsibleTrigger>
<CollapsibleContent
forceMount
className="relative mt-6 overflow-hidden data-[state=closed]:max-h-64 data-[state=closed]:[content-visibility:auto] [&>figure]:mt-0 [&>figure]:md:!mx-0"
>
{children}
</CollapsibleContent>
<CollapsibleTrigger className="from-code/70 to-code text-muted-foreground absolute inset-x-0 -bottom-2 flex h-20 items-center justify-center rounded-b-lg bg-gradient-to-b text-sm group-data-[state=open]/collapsible:hidden">
{isOpened ? "Collapse" : "Expand"}
</CollapsibleTrigger>
</Collapsible>
)
}