{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "native-delete-shadcnui", "type": "registry:component", "title": "Native Delete", "description": "Delete button that expands to show a confirmation button with smooth animations.", "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/native/native-delete-shadcnui.tsx", "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { AnimatePresence, motion, MotionConfig } from \"framer-motion\";\nimport { Check, Trash2, X } from \"lucide-react\";\nimport { useState } from \"react\";\n\nexport interface NativeDeleteProps {\n /**\n * Callback when delete button is first clicked (shows confirmation)\n */\n onConfirm: () => void;\n /**\n * Callback when delete is confirmed\n */\n onDelete: () => void;\n /**\n * Text to show on the delete button\n * Default: \"Delete\"\n */\n buttonText?: string;\n /**\n * Text to show on the confirm button\n * Default: \"Confirm\"\n */\n confirmText?: string;\n /**\n * Size variant\n * Default: \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /**\n * Show icon in button\n * Default: true\n */\n showIcon?: boolean;\n /**\n * Additional class names for the container\n */\n className?: string;\n /**\n * Disable the button\n */\n disabled?: boolean;\n}\n\nconst sizeVariants = {\n sm: \"h-8 text-xs px-3\",\n md: \"h-10 text-sm px-4\",\n lg: \"h-12 text-base px-6\",\n};\n\nconst iconSizeVariants = {\n sm: \"h-3 w-3\",\n md: \"h-4 w-4\",\n lg: \"h-5 w-5\",\n};\n\nconst cancelButtonSizes = {\n sm: \"h-8 w-8\",\n md: \"h-10 w-10\",\n lg: \"h-12 w-12\",\n};\n\n// Smooth spring preset for natural feel\nconst smoothSpring = {\n type: \"spring\" as const,\n bounce: 0,\n duration: 0.35,\n};\n\nexport function NativeDelete({\n onConfirm,\n onDelete,\n buttonText = \"Delete\",\n confirmText = \"Confirm\",\n size = \"md\",\n showIcon = true,\n className,\n disabled = false,\n}: NativeDeleteProps) {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const handleDeleteClick = () => {\n if (!disabled) {\n setIsExpanded(true);\n onConfirm();\n }\n };\n\n const handleConfirm = () => {\n onDelete();\n setIsExpanded(false);\n };\n\n const handleCancel = () => {\n setIsExpanded(false);\n };\n\n return (\n \n \n {/* Main Delete/Confirm button */}\n \n \n \n {showIcon && (\n \n {isExpanded ? (\n \n ) : (\n \n )}\n \n )}\n \n \n \n {isExpanded ? confirmText : buttonText}\n \n \n \n \n\n {/* Cancel button */}\n \n {isExpanded && (\n \n \n \n \n \n )}\n \n \n \n );\n}\n", "type": "registry:component", "target": "components/uitripled/native-delete-shadcnui.tsx" } ] }