{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "primitives-effects-auto-height",
  "title": "Auto Height",
  "description": "An effect that automatically adjusts the height of an element based on its content.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "@unlumen-ui/primitives-animate-slot",
    "@unlumen-ui/hooks-use-auto-height"
  ],
  "files": [
    {
      "path": "registry/primitives/effects/auto-height/index.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport {\n  motion,\n  type HTMLMotionProps,\n  type LegacyAnimationControls,\n  type TargetAndTransition,\n  type Transition,\n} from \"motion/react\";\n\nimport { useAutoHeight } from \"@/hooks/use-auto-height\";\nimport { Slot, WithAsChild } from \"@/components/unlumen-ui/primitives/animate/slot\";\n\ntype AutoHeightProps = WithAsChild<\n  {\n    children: React.ReactNode;\n    deps?: React.DependencyList;\n    animate?: TargetAndTransition | LegacyAnimationControls;\n    transition?: Transition;\n  } & Omit<HTMLMotionProps<\"div\">, \"animate\">\n>;\n\nfunction AutoHeight({\n  children,\n  deps = [],\n  transition = {\n    type: \"spring\",\n    stiffness: 300,\n    damping: 30,\n    bounce: 0,\n    restDelta: 0.01,\n  },\n  style,\n  animate,\n  asChild = false,\n  ...props\n}: AutoHeightProps) {\n  const { ref, height } = useAutoHeight<HTMLDivElement>(deps);\n\n  const Comp = asChild ? Slot : motion.div;\n\n  return (\n    <Comp\n      style={{ overflow: \"hidden\", ...style }}\n      animate={{ height, ...animate }}\n      transition={transition}\n      {...props}\n    >\n      <div ref={ref}>{children}</div>\n    </Comp>\n  );\n}\n\nexport { AutoHeight, type AutoHeightProps };\n",
      "type": "registry:ui",
      "target": "components/unlumen-ui/primitives/effects/auto-height.tsx"
    }
  ],
  "type": "registry:ui"
}