"use client" import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" function InputGroup({ className, ...props }: React.ComponentProps<"div">) { return (
) } const inputGroupAddonVariants = cva( "flex select-none text-muted-foreground group-data-[disabled=true]/input-group:opacity-50 shrink-0", { variants: { align: { "inline-start": "order-first h-full px-3.5 bg-muted/40 dark:bg-zinc-900 border-r border-input text-xs font-mono font-medium text-foreground/80 flex items-center justify-center", "inline-end": "order-last h-full px-3.5 bg-muted/40 dark:bg-zinc-900 border-l border-input text-xs font-mono font-medium text-foreground/80 flex items-center justify-center", "block-start": "order-first w-full justify-start px-3 py-2 border-b border-input bg-muted/20 dark:bg-zinc-900/40 text-xs", "block-end": "order-last w-full flex items-center justify-between px-3 py-1.5 border-t border-input bg-muted/20 dark:bg-zinc-900/40 text-xs", }, }, defaultVariants: { align: "inline-start", }, } ) function InputGroupAddon({ className, align = "inline-start", ...props }: React.ComponentProps<"div"> & VariantProps) { return (
{ if ((e.target as HTMLElement).closest("button")) { return } e.currentTarget.parentElement?.querySelector("input, textarea")?.focus() }} {...props} /> ) } const inputGroupButtonVariants = cva( "flex items-center gap-2 text-sm shadow-none", { variants: { size: { xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5", sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5", "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0", "icon-sm": "size-8 p-0 has-[>svg]:p-0", }, }, defaultVariants: { size: "xs", }, } ) function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }: Omit, "size"> & VariantProps) { return (