{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "native-liquid-button-baseui",
  "type": "registry:component",
  "title": "Native Liquid Button",
  "description": "Button with animated liquid fill effect, progress tracking, and multiple visual variants for engaging interactions. (Base UI)",
  "registryDependencies": [
    "button"
  ],
  "dependencies": [
    "framer-motion",
    "react"
  ],
  "files": [
    {
      "path": "@uitripled/react-baseui/src/components/native/native-liquid-button-baseui.tsx",
      "content": "\"use client\";\n\nimport {\n  NativeButton,\n  type NativeButtonProps,\n} from \"@/components/uitripled/native-button-baseui\";\nimport { cn } from \"@/lib/utils\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { Loader2 } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\n\nexport interface NativeLiquidButtonProps\n  extends Omit<NativeButtonProps, \"onClick\" | \"loading\"> {\n  /**\n   * Progress value (0-100)\n   */\n  progress?: number;\n  /**\n   * Loading state\n   */\n  loading?: boolean;\n  /**\n   * Callback when button is clicked\n   */\n  onClick?: () => void | Promise<void>;\n  /**\n   * Visual variant\n   * Default: \"default\"\n   */\n  liquidVariant?: \"default\" | \"gradient\" | \"glow\" | \"wave\";\n  /**\n   * Liquid color\n   */\n  liquidColor?: string;\n  /**\n   * Show percentage text\n   * Default: false\n   */\n  showPercentage?: boolean;\n  /**\n   * Auto-simulate loading (for demo purposes)\n   */\n  autoSimulate?: boolean;\n  /**\n   * Success state\n   */\n  success?: boolean;\n  /**\n   * Error state\n   */\n  error?: boolean;\n}\n\nconst sizeVariants = {\n  sm: \"h-9 px-4 text-sm min-w-[100px]\",\n  default: \"h-11 px-6 text-base min-w-[140px]\",\n  lg: \"h-14 px-8 text-lg min-w-[180px]\",\n  icon: \"h-11 px-6 text-base min-w-[140px]\",\n};\n\nexport function NativeLiquidButton({\n  children,\n  className,\n  variant = \"default\",\n  size = \"default\",\n  progress = 0,\n  loading = false,\n  onClick,\n  disabled,\n  liquidVariant = \"default\",\n  liquidColor,\n  showPercentage = false,\n  autoSimulate = false,\n  success = false,\n  error = false,\n  ...props\n}: NativeLiquidButtonProps) {\n  const [internalProgress, setInternalProgress] = useState(progress);\n  const [isSimulating, setIsSimulating] = useState(false);\n  const shouldReduceMotion = useReducedMotion() ?? false;\n\n  useEffect(() => {\n    setInternalProgress(progress);\n  }, [progress]);\n\n  useEffect(() => {\n    if (autoSimulate && isSimulating) {\n      const interval = setInterval(() => {\n        setInternalProgress((prev) => {\n          if (prev >= 100) {\n            clearInterval(interval);\n            setIsSimulating(false);\n            return 100;\n          }\n          return prev + Math.random() * 10;\n        });\n      }, 200);\n      return () => clearInterval(interval);\n    }\n  }, [autoSimulate, isSimulating]);\n\n  const handleClick = async () => {\n    if (disabled || loading) return;\n\n    if (autoSimulate) {\n      setIsSimulating(true);\n      setInternalProgress(0);\n    }\n\n    if (onClick) {\n      await onClick();\n    }\n  };\n\n  const getLiquidColor = () => {\n    if (success) return \"bg-green-500\";\n    if (error) return \"bg-red-500\";\n    if (liquidColor) return liquidColor;\n\n    switch (liquidVariant) {\n      case \"gradient\":\n        return \"bg-gradient-to-r from-primary via-primary/80 to-primary\";\n      case \"glow\":\n        return \"bg-primary\";\n      default:\n        return \"bg-primary\";\n    }\n  };\n\n  const clampedProgress = Math.min(Math.max(internalProgress, 0), 100);\n  const isFilling = clampedProgress > 0 && clampedProgress < 100;\n  const showAmbient = !shouldReduceMotion && clampedProgress > 0;\n\n  return (\n    <div className=\"relative inline-block\">\n      <NativeButton\n        variant={variant}\n        size={size}\n        loading={false}\n        disabled={disabled || loading}\n        onClick={handleClick}\n        aria-busy={loading || isSimulating}\n        className={cn(\n          sizeVariants[size || \"default\"],\n          \"relative overflow-hidden font-semibold transition-[box-shadow,background-color,border-color,color] duration-300\",\n          \"before:absolute before:inset-0 before:bg-background/20 before:pointer-events-none before:rounded-md\",\n          liquidVariant === \"glow\" &&\n            !disabled &&\n            \"shadow-lg shadow-primary/30\",\n          className\n        )}\n        {...props}\n      >\n        {/* Liquid fill — width-based so the liquid inside never distorts */}\n        <motion.div\n          aria-hidden=\"true\"\n          className={cn(\n            \"pointer-events-none absolute inset-y-0 left-0 overflow-hidden transition-colors duration-300\",\n            getLiquidColor()\n          )}\n          initial={false}\n          animate={{ width: `${clampedProgress}%` }}\n          transition={\n            shouldReduceMotion\n              ? { duration: 0.2, ease: \"easeOut\" }\n              : { type: \"spring\", stiffness: 100, damping: 20 }\n          }\n        >\n          {/* Meniscus — bright leading edge where the liquid meets air */}\n          {isFilling && (\n            <div className=\"absolute inset-y-0 right-0 w-3 bg-gradient-to-l from-white/30 to-transparent\" />\n          )}\n\n          {/* Rising bubbles */}\n          {liquidVariant === \"default\" && showAmbient && (\n            <>\n              {[...Array(4)].map((_, i) => (\n                <motion.div\n                  key={i}\n                  className=\"absolute bottom-0 h-1.5 w-1.5 rounded-full bg-white/40\"\n                  style={{\n                    left: `${15 + i * 22}%`,\n                  }}\n                  animate={{\n                    y: [2, -36],\n                    opacity: [0, 0.8, 0],\n                    scale: [0.6, 1, 0.7],\n                  }}\n                  transition={{\n                    duration: 1.8,\n                    repeat: Number.POSITIVE_INFINITY,\n                    delay: i * 0.45,\n                    ease: \"easeOut\",\n                  }}\n                />\n              ))}\n            </>\n          )}\n\n          {/* Shimmer effect for gradient */}\n          {liquidVariant === \"gradient\" && showAmbient && (\n            <motion.div\n              className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent\"\n              animate={{\n                x: [\"-100%\", \"200%\"],\n              }}\n              transition={{\n                duration: 1.5,\n                repeat: Number.POSITIVE_INFINITY,\n                ease: \"linear\",\n              }}\n            />\n          )}\n        </motion.div>\n\n        {/* Wave — a translucent surface layer sloshing around the fill edge */}\n        {liquidVariant === \"wave\" && showAmbient && isFilling && (\n          <motion.div\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute inset-y-0 left-0 bg-white/15\"\n            animate={{\n              width: [\n                `${Math.max(clampedProgress - 6, 0)}%`,\n                `${Math.min(clampedProgress + 4, 100)}%`,\n                `${Math.max(clampedProgress - 6, 0)}%`,\n              ],\n            }}\n            transition={{\n              duration: 2.2,\n              repeat: Number.POSITIVE_INFINITY,\n              ease: \"easeInOut\",\n            }}\n          />\n        )}\n\n        {/* Button content */}\n        <span className=\"relative z-10 flex items-center justify-center gap-2\">\n          <AnimatePresence mode=\"wait\">\n            {loading && (\n              <motion.div\n                key=\"loading\"\n                initial={{ opacity: 0 }}\n                animate={{ opacity: 1 }}\n                exit={{ opacity: 0 }}\n              >\n                <Loader2 aria-hidden=\"true\" className=\"w-4 h-4 animate-spin\" />\n              </motion.div>\n            )}\n          </AnimatePresence>\n\n          <motion.span\n            animate={\n              loading && !shouldReduceMotion\n                ? { opacity: [1, 0.5, 1] }\n                : { opacity: 1 }\n            }\n            transition={\n              loading && !shouldReduceMotion\n                ? {\n                    duration: 1.5,\n                    repeat: Number.POSITIVE_INFINITY,\n                    ease: \"easeInOut\",\n                  }\n                : { duration: 0.2 }\n            }\n          >\n            {children}\n          </motion.span>\n\n          {showPercentage && (\n            <span className=\"text-xs tabular-nums\">\n              {Math.round(clampedProgress)}%\n            </span>\n          )}\n        </span>\n\n        {/* Glow effect */}\n        {liquidVariant === \"glow\" && !disabled && showAmbient && (\n          <motion.div\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute inset-0 bg-primary/20 blur-xl\"\n            animate={{\n              opacity: [0.3, 0.6, 0.3],\n            }}\n            transition={{\n              duration: 2,\n              repeat: Number.POSITIVE_INFINITY,\n              ease: \"easeInOut\",\n            }}\n          />\n        )}\n      </NativeButton>\n\n      {clampedProgress > 0 && (\n        <span\n          role=\"progressbar\"\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={Math.round(clampedProgress)}\n          className=\"sr-only\"\n        >\n          {Math.round(clampedProgress)}%\n        </span>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/uitripled/native-liquid-button-baseui.tsx"
    }
  ]
}