mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
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/
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
"use client"
|
|
|
|
import {
|
|
SquareLock01Icon,
|
|
SquareUnlock01Icon,
|
|
} from "@hugeicons/core-free-icons"
|
|
import { HugeiconsIcon } from "@hugeicons/react"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
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 (
|
|
<button
|
|
type="button"
|
|
title={locked ? "Unlock" : "Lock"}
|
|
aria-label={locked ? "Unlock" : "Lock"}
|
|
onClick={() => toggleLock(param)}
|
|
data-locked={locked}
|
|
className={cn(
|
|
"flex size-4 cursor-pointer items-center justify-center rounded opacity-0 ring-foreground/60 transition-opacity outline-none group-focus-within/picker:opacity-100 group-hover/picker:opacity-100 focus:opacity-100 focus-visible:ring-1 data-[locked=true]:opacity-100 pointer-coarse:hidden",
|
|
className
|
|
)}
|
|
>
|
|
<HugeiconsIcon
|
|
icon={locked ? SquareLock01Icon : SquareUnlock01Icon}
|
|
strokeWidth={2}
|
|
className="size-5 text-foreground"
|
|
/>
|
|
</button>
|
|
)
|
|
}
|