{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "transition-parallax-slide",
  "type": "registry:component",
  "title": "Transition Parallax Slide",
  "description": "A push navigation: the new view slides over the old one, which drifts back and darkens under it. Children marked data-depth 1 to 3 inside either view travel at their own speed for depth.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "transitions",
    "slide",
    "parallax",
    "push",
    "onboarding",
    "transition"
  ],
  "docs": "https://hyperblur.dev/effects/transition-parallax-slide",
  "files": [
    {
      "path": "registry/hyperblur/transition-parallax-slide.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/transition-parallax-slide.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TransitionParallaxSlideProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  children?: React.ReactNode;\n  from?: React.ReactNode;\n  to?: React.ReactNode;\n  active?: boolean;\n  defaultActive?: boolean;\n  onActiveChange?: (active: boolean) => void;\n  autoPlay?: boolean;\n  interval?: number;\n  duration?: number;\n  direction?: \"left\" | \"right\";\n  parallax?: number;\n}\n\nconst css = `\n.hb-vj12 {\n  position: relative;\n  display: grid;\n  grid-template: minmax(0, 1fr) / minmax(0, 1fr);\n  overflow: hidden;\n  isolation: isolate;\n  box-sizing: border-box;\n  font-family: inherit;\n  background: #050506;\n  --hb-vj12-s: 1;\n}\n.hb-vj12[data-direction=\"right\"] { --hb-vj12-s: -1; }\n.hb-vj12 *, .hb-vj12 *::before, .hb-vj12 *::after { box-sizing: border-box; }\n.hb-vj12-l {\n  grid-area: 1 / 1;\n  display: grid;\n  min-width: 0;\n  min-height: 0;\n  position: relative;\n  transition: transform var(--hb-vj12-d) var(--hb-vj12-e), box-shadow var(--hb-vj12-d) var(--hb-vj12-e), visibility 0s linear 0s;\n}\n.hb-vj12-l [data-depth] { transition: transform var(--hb-vj12-d) var(--hb-vj12-e); }\n.hb-vj12-from { z-index: 1; }\n.hb-vj12-from::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  pointer-events: none;\n  background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.75));\n  opacity: 0;\n  transition: opacity var(--hb-vj12-d) var(--hb-vj12-e);\n}\n.hb-vj12-to {\n  z-index: 2;\n  transform: translateX(calc(var(--hb-vj12-s) * 101%));\n  box-shadow: 0 0 0 rgba(0, 0, 0, 0);\n  visibility: hidden;\n  transition: transform var(--hb-vj12-d) var(--hb-vj12-e), box-shadow var(--hb-vj12-d) var(--hb-vj12-e), visibility 0s linear var(--hb-vj12-d);\n}\n.hb-vj12-to::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  width: 1px;\n  left: 0;\n  z-index: 1;\n  pointer-events: none;\n  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));\n}\n.hb-vj12[data-direction=\"right\"] .hb-vj12-to::before { left: auto; right: 0; }\n.hb-vj12[data-active=\"true\"] .hb-vj12-to {\n  transform: translateX(0);\n  visibility: visible;\n  box-shadow: calc(var(--hb-vj12-s) * -28px) 0 56px -10px rgba(0, 0, 0, 0.75);\n  transition: transform var(--hb-vj12-d) var(--hb-vj12-e), box-shadow var(--hb-vj12-d) var(--hb-vj12-e), visibility 0s linear 0s;\n}\n.hb-vj12[data-active=\"true\"] .hb-vj12-from {\n  transform: translateX(calc(var(--hb-vj12-s) * -30%)) scale(0.97);\n  visibility: hidden;\n  transition: transform var(--hb-vj12-d) var(--hb-vj12-e), box-shadow var(--hb-vj12-d) var(--hb-vj12-e), visibility 0s linear var(--hb-vj12-d);\n}\n.hb-vj12[data-active=\"true\"] .hb-vj12-from::after { opacity: 1; }\n.hb-vj12-to [data-depth=\"1\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * 1)); }\n.hb-vj12-to [data-depth=\"2\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * 2)); }\n.hb-vj12-to [data-depth=\"3\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * 3.2)); }\n.hb-vj12[data-active=\"true\"] .hb-vj12-to [data-depth] { transform: none; }\n.hb-vj12[data-active=\"true\"] .hb-vj12-from [data-depth=\"1\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * -0.6)); }\n.hb-vj12[data-active=\"true\"] .hb-vj12-from [data-depth=\"2\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * -1.2)); }\n.hb-vj12[data-active=\"true\"] .hb-vj12-from [data-depth=\"3\"] { transform: translateX(calc(var(--hb-vj12-s) * var(--hb-vj12-px) * -2)); }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vj12-l, .hb-vj12-l [data-depth], .hb-vj12-from::after,\n  .hb-vj12[data-active=\"true\"] .hb-vj12-to, .hb-vj12[data-active=\"true\"] .hb-vj12-from { transition: none; }\n}\n`;\n\nfunction useSwap(\n  active: boolean | undefined,\n  defaultActive: boolean,\n  onActiveChange: ((active: boolean) => void) | undefined,\n  autoPlay: boolean,\n  interval: number,\n) {\n  const [inner, setInner] = React.useState(defaultActive);\n  const controlled = active !== undefined;\n  const value = controlled ? active : inner;\n  const set = React.useCallback(\n    (next: boolean) => {\n      if (!controlled) setInner(next);\n      onActiveChange?.(next);\n    },\n    [controlled, onActiveChange],\n  );\n  React.useEffect(() => {\n    if (!autoPlay) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const id = window.setTimeout(() => set(!value), interval);\n    return () => window.clearTimeout(id);\n  }, [autoPlay, interval, value, set]);\n  return value;\n}\n\nfunction Scene({ tone, kicker, title, mark }: { tone: string; kicker: string; title: string; mark: string }) {\n  return (\n    <div style={{ position: \"relative\", display: \"grid\", alignContent: \"end\", gap: 4, padding: 20, minHeight: 180, background: tone, color: \"#ededed\", overflow: \"hidden\" }}>\n      <div data-depth=\"1\" style={{ position: \"absolute\", right: -30, top: -40, width: 160, height: 160, borderRadius: \"50%\", background: mark, opacity: 0.35 }} />\n      <div data-depth=\"2\" style={{ position: \"absolute\", right: 36, top: 26, width: 54, height: 54, borderRadius: 14, background: mark }} />\n      <span data-depth=\"3\" style={{ position: \"relative\", fontSize: 11, letterSpacing: \"0.14em\", textTransform: \"uppercase\", color: \"rgba(237,237,237,0.6)\" }}>{kicker}</span>\n      <strong data-depth=\"3\" style={{ position: \"relative\", fontSize: 20, fontWeight: 600, letterSpacing: \"-0.01em\" }}>{title}</strong>\n    </div>\n  );\n}\n\nexport function TransitionParallaxSlide({\n  children,\n  from,\n  to,\n  active,\n  defaultActive = false,\n  onActiveChange,\n  autoPlay = false,\n  interval = 2800,\n  duration = 900,\n  direction = \"left\",\n  parallax = 24,\n  className,\n  style,\n  ...rest\n}: TransitionParallaxSlideProps) {\n  const value = useSwap(active, defaultActive, onActiveChange, autoPlay, interval);\n  const kids = React.Children.toArray(children);\n  const a = from ?? kids[0] ?? <Scene tone=\"linear-gradient(160deg, #13203a, #090d16)\" kicker=\"Step 1 of 3\" title=\"Plan the route\" mark=\"#2f7bff\" />;\n  const b = to ?? kids[1] ?? <Scene tone=\"linear-gradient(160deg, #2a1838, #0e0913)\" kicker=\"Step 2 of 3\" title=\"Book in one tap\" mark=\"#b46bff\" />;\n\n  const vars = {\n    \"--hb-vj12-d\": `${duration}ms`,\n    \"--hb-vj12-e\": \"cubic-bezier(0.32, 0.72, 0, 1)\",\n    \"--hb-vj12-px\": `${parallax}px`,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      className={[\"hb-vj12\", className].filter(Boolean).join(\" \")}\n      style={{ ...vars, ...style }}\n      data-active={value}\n      data-direction={direction}\n      {...rest}\n    >\n      <style href=\"hb-transition-parallax-slide\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vj12-l hb-vj12-from\" aria-hidden={value} inert={value}>{a}</div>\n      <div className=\"hb-vj12-l hb-vj12-to\" aria-hidden={!value} inert={!value}>{b}</div>\n    </div>\n  );\n}\n"
    }
  ]
}