{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shape-divider",
  "title": "Shape Divider",
  "description": "SVG dividers that shape the edge between two sections: waves that drift in a seamless loop, a curve, a tilt, a peak, a zigzag or steps, layered in up to three tones, at the top or bottom of a section and mirrored if you like.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/shape-divider/shape-divider.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type DividerShape = \"wave\" | \"curve\" | \"tilt\" | \"triangle\" | \"zigzag\" | \"steps\";\n\nexport interface ShapeDividerProps {\n  shape?: DividerShape;\n  /** top: hangs from the top edge of a section. bottom: sits on the bottom edge. */\n  position?: \"top\" | \"bottom\";\n  /** Mirror it left to right. */\n  flip?: boolean;\n  height?: number;\n  /** Fill colour; match it to the section the shape grows out of. */\n  color?: string;\n  /** Extra softer copies behind the main shape (1 to 3 in total). */\n  layers?: 1 | 2 | 3;\n  /** Waves drift sideways in a seamless loop. */\n  animated?: boolean;\n  /** Seconds for one loop of the drift. */\n  speed?: number;\n  className?: string;\n}\n\nconst W = 1200;\nconst H = 120;\n\n// Every shape is drawn for a divider sitting at the bottom of a section (filled below the line).\n// Waves are built over two widths so they can slide by one width and loop without a seam.\nfunction wavePath(amp: number, base: number, periods: number, phase: number) {\n  const pts: string[] = [];\n  const width = W * 2;\n  for (let x = 0; x <= width; x += 20) {\n    const y = base + Math.sin((x / W) * periods * Math.PI * 2 + phase) * amp;\n    pts.push(`${x},${y.toFixed(1)}`);\n  }\n  return `M0,${H} L${pts.join(\" L\")} L${width},${H} Z`;\n}\n\nconst SHAPES: Record<Exclude<DividerShape, \"wave\">, (i: number) => string> = {\n  curve: (i) => `M0,${H} L0,${40 + i * 18} Q${W / 2},${-30 + i * 30} ${W},${40 + i * 18} L${W},${H} Z`,\n  tilt: (i) => `M0,${H} L0,${H - 10 - i * 8} L${W},${20 + i * 22} L${W},${H} Z`,\n  triangle: (i) => `M0,${H} L0,${H - 4} L${W / 2},${18 + i * 26} L${W},${H - 4} L${W},${H} Z`,\n  zigzag: (i) => {\n    const n = 16;\n    const pts = Array.from({ length: n + 1 }, (_, k) => `${(W / n) * k},${(k % 2 ? 60 : 92) - i * 10}`);\n    return `M0,${H} L${pts.join(\" L\")} L${W},${H} Z`;\n  },\n  steps: (i) => {\n    const n = 6;\n    let d = `M0,${H}`;\n    for (let k = 0; k < n; k++) {\n      const y = 100 - k * 14 + i * 8;\n      d += ` L${(W / n) * k},${y} L${(W / n) * (k + 1)},${y}`;\n    }\n    return `${d} L${W},${H} Z`;\n  },\n};\n\nexport function ShapeDivider({ shape = \"wave\", position = \"bottom\", flip = false, height = 96, color = \"#F5F4F1\", layers = 3, animated = true, speed = 14, className }: ShapeDividerProps) {\n  const reduce = Boolean(useReducedMotion());\n  const count = Math.max(1, Math.min(3, layers));\n  const order = Array.from({ length: count }, (_, k) => count - 1 - k); // back layers first\n  const drift = shape === \"wave\" && animated && !reduce;\n\n  return (\n    <div\n      aria-hidden=\"true\"\n      className={cn(\"pointer-events-none relative w-full overflow-hidden leading-[0]\", className)}\n      style={{ height, transform: `${position === \"top\" ? \"scaleY(-1)\" : \"\"} ${flip ? \"scaleX(-1)\" : \"\"}`.trim() || undefined }}\n    >\n      {/* A new shape rises in (paths with different point counts can't morph cleanly). */}\n      <motion.svg key={shape} viewBox={`0 0 ${W} ${H}`} preserveAspectRatio=\"none\" width=\"100%\" height=\"100%\" className=\"block\" initial={reduce ? false : { opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, ease: [0.22, 1, 0.36, 1] }}>\n        {order.map((i) => {\n          const opacity = i === 0 ? 1 : i === 1 ? 0.45 : 0.22;\n          if (shape === \"wave\") {\n            const d = wavePath(14 - i * 3, 64 - i * 16, 2 + (i % 2), i * 1.7);\n            return (\n              <motion.path\n                key={i}\n                d={d}\n                fill={color}\n                fillOpacity={opacity}\n                initial={false}\n                animate={drift ? { x: i % 2 ? [-W, 0] : [0, -W] } : { x: 0 }}\n                transition={drift ? { duration: speed * (1 + i * 0.45), ease: \"linear\", repeat: Infinity } : { duration: 0 }}\n              />\n            );\n          }\n          return <path key={i} d={SHAPES[shape](i)} fill={color} fillOpacity={opacity} />;\n        })}\n      </motion.svg>\n    </div>\n  );\n}\n\nexport default ShapeDivider;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}