mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 00:18:41 +00:00
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.
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import {
|
|
SquareLock01Icon,
|
|
SquareUnlock01Icon,
|
|
} from "@hugeicons/core-free-icons"
|
|
import { HugeiconsIcon } from "@hugeicons/react"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipTrigger,
|
|
} from "@/registry/new-york-v4/ui/tooltip"
|
|
import { useLocks, type LockableParam } from "@/app/(create)/hooks/use-locks"
|
|
|
|
export function LockButton({
|
|
param,
|
|
className,
|
|
}: {
|
|
param: LockableParam
|
|
className?: string
|
|
}) {
|
|
const { isLocked, toggleLock } = useLocks()
|
|
const locked = isLocked(param)
|
|
|
|
return (
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<button
|
|
type="button"
|
|
onClick={() => toggleLock(param)}
|
|
data-locked={locked}
|
|
className={cn(
|
|
"flex size-4 cursor-pointer items-center justify-center rounded opacity-0 transition-opacity group-focus-within/picker:opacity-100 group-hover/picker:opacity-100 focus:opacity-100 data-[locked=true]:opacity-100 pointer-coarse:hidden",
|
|
className
|
|
)}
|
|
aria-label={locked ? "Unlock" : "Lock"}
|
|
>
|
|
<HugeiconsIcon
|
|
icon={locked ? SquareLock01Icon : SquareUnlock01Icon}
|
|
strokeWidth={2}
|
|
className="text-foreground size-5"
|
|
/>
|
|
</button>
|
|
</TooltipTrigger>
|
|
<TooltipContent>{locked ? "Unlock" : "Lock"}</TooltipContent>
|
|
</Tooltip>
|
|
)
|
|
}
|