{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"button-press","type":"registry:component","title":"Button Press","description":"Cursor clicks a button: a cursor walks onto a split action button (label, divider, chevron), it darkens on hover, gives on press, spins while pending and lands on a drawn tick. The deploy, publish or send beat of every launch video.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json","https://kuchi.kalarislabs.com/r/cursor-track.json"],"files":[{"path":"components/kuchi/button-press.tsx","type":"registry:component","target":"components/kuchi/button-press.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Inter\";\r\nimport type { ReactNode } from \"react\";\r\nimport {\r\n  AbsoluteFill,\r\n  Easing,\r\n  interpolate,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport { CursorTrack } from \"@/components/kuchi/cursor-track\";\r\nimport {\r\n  mixOklch,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n  withAlpha,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\nconst { fontFamily: SANS } = loadSans(\"normal\", {\r\n  weights: [\"500\"],\r\n  subsets: [\"latin\"],\r\n});\r\n\r\n/**\r\n * The click every launch video has: a cursor walks onto a split action button\r\n * (label, divider, chevron), it darkens on hover, gives on press, spins while\r\n * it works and lands on a tick. Three labels, one fixed width — the button\r\n * never reflows, so the cursor resting on it never has to chase it.\r\n */\r\nexport interface ButtonPressProps {\r\n  /** Idle label. */\r\n  label?: string;\r\n  /** While it works. */\r\n  pending?: string;\r\n  /** When it is done. */\r\n  done?: string;\r\n  /** Button width at 720p. Size it for the longest label. */\r\n  width?: number;\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  /** Time multiplier. */\r\n  speed?: number;\r\n  className?: string;\r\n}\r\n\r\n/** Cursor lands and clicks. */\r\nexport const CLICK_AT = 36;\r\n/** Frames spent pending before the tick. */\r\nexport const PENDING_FRAMES = 40;\r\nexport const BUTTON_PRESS_FRAMES = 126;\r\n\r\nconst H = 76;\r\nconst EASE = Easing.bezier(0.2, 0.6, 0.35, 1);\r\nconst CLAMP = {\r\n  extrapolateLeft: \"clamp\",\r\n  extrapolateRight: \"clamp\",\r\n} as const;\r\n\r\n/** A label sliding in from below and out above, 8 frames each way. No `to`: it stays. */\r\nfunction phase(frame: number, from: number, to?: number) {\r\n  const inP = interpolate(frame, [from, from + 8], [0, 1], {\r\n    ...CLAMP,\r\n    easing: EASE,\r\n  });\r\n  const outP =\r\n    to === undefined\r\n      ? 0\r\n      : interpolate(frame, [to, to + 8], [0, 1], { ...CLAMP, easing: EASE });\r\n  return { opacity: inP * (1 - outP), y: (1 - inP) * 14 - outP * 14 };\r\n}\r\n\r\n/** The chevron segment's width, as a multiple of the button height. */\r\nconst CHEVRON_W = 0.86;\r\n\r\n/**\r\n * A primary split button: the action, a hairline divider, a chevron. Takes its\r\n * paint from the theme; the label area is whatever you pass as children. Only\r\n * the surface presses (`press`, 1 at rest) — the label never scales, so it has\r\n * no glyph snapping to fight.\r\n */\r\nexport function SplitButton({\r\n  t,\r\n  width,\r\n  height,\r\n  background,\r\n  press = 1,\r\n  children,\r\n}: {\r\n  t: KuchiTheme;\r\n  /** px */\r\n  width: number;\r\n  /** px */\r\n  height: number;\r\n  /** Fill; defaults to the theme's primary. */\r\n  background?: string;\r\n  press?: number;\r\n  children: ReactNode;\r\n}) {\r\n  const chevron = height * CHEVRON_W;\r\n  return (\r\n    <div\r\n      style={{\r\n        position: \"relative\",\r\n        width,\r\n        height,\r\n        color: t.primaryForeground,\r\n        whiteSpace: \"nowrap\",\r\n      }}\r\n    >\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          inset: 0,\r\n          // shadcn's button radius, kept in proportion at this height.\r\n          borderRadius: t.radius * (height / 36),\r\n          backgroundColor: background ?? t.primary,\r\n          scale: press,\r\n        }}\r\n      />\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          left: 0,\r\n          top: 0,\r\n          bottom: 0,\r\n          right: chevron,\r\n          overflow: \"hidden\",\r\n        }}\r\n      >\r\n        {children}\r\n      </div>\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          right: chevron,\r\n          top: height * 0.24,\r\n          bottom: height * 0.24,\r\n          width: Math.max(1, height / 76),\r\n          backgroundColor: withAlpha(t.primaryForeground, 0.32),\r\n        }}\r\n      />\r\n      <svg\r\n        viewBox=\"0 0 24 24\"\r\n        width={height * 0.34}\r\n        height={height * 0.34}\r\n        style={{\r\n          position: \"absolute\",\r\n          right: (chevron - height * 0.34) / 2,\r\n          top: height * 0.33,\r\n        }}\r\n      >\r\n        <title>More</title>\r\n        <path\r\n          d=\"M6 9.5 L12 15.5 L18 9.5\"\r\n          fill=\"none\"\r\n          stroke={t.primaryForeground}\r\n          strokeWidth={2.6}\r\n          strokeLinecap=\"round\"\r\n          strokeLinejoin=\"round\"\r\n        />\r\n      </svg>\r\n    </div>\r\n  );\r\n}\r\n\r\nexport function ButtonPress({\r\n  label = \"Deploy\",\r\n  pending = \"Deploying…\",\r\n  done = \"Deployed\",\r\n  width: w = 320,\r\n  theme,\r\n  mode,\r\n  speed = 1,\r\n  className,\r\n}: ButtonPressProps) {\r\n  const frame = useCurrentFrame() * speed;\r\n  const { height } = useVideoConfig();\r\n  const t = useKuchiTheme(theme, mode);\r\n  const s = height / 720;\r\n\r\n  const doneAt = CLICK_AT + PENDING_FRAMES;\r\n  const path = [\r\n    { at: 8, x: 0.86, y: 1.08, duration: 6 },\r\n    { at: 14, x: 0.47, y: 0.53, duration: CLICK_AT - 14, click: true },\r\n    { at: doneAt + 14, x: 0.62, y: 0.7, duration: 18 },\r\n  ];\r\n\r\n  const enter = interpolate(frame, [0, 14], [0, 1], { ...CLAMP, easing: EASE });\r\n  const hover = interpolate(frame, [CLICK_AT - 6, CLICK_AT], [0, 1], CLAMP);\r\n  // Press returns exactly to 1, and only on the surface: the label never\r\n  // scales, so there is no glyph snapping to fight.\r\n  const pressP = interpolate(frame, [CLICK_AT, CLICK_AT + 10], [0, 1], CLAMP);\r\n  const press = 1 - Math.sin(pressP * Math.PI) * 0.035;\r\n\r\n  const idle = phase(frame, -8, CLICK_AT + 2);\r\n  const busy = phase(frame, CLICK_AT + 2, doneAt);\r\n  const ok = phase(frame, doneAt);\r\n  const tick = interpolate(frame, [doneAt + 4, doneAt + 14], [0, 1], {\r\n    ...CLAMP,\r\n    easing: EASE,\r\n  });\r\n\r\n  const bg = mixOklch(t.primary, t.foreground, hover * 0.14);\r\n  const icon = 26 * s;\r\n  const row = (y: number, opacity: number, children: ReactNode) => (\r\n    <div\r\n      style={{\r\n        position: \"absolute\",\r\n        inset: 0,\r\n        display: \"flex\",\r\n        alignItems: \"center\",\r\n        justifyContent: \"center\",\r\n        gap: 12 * s,\r\n        opacity,\r\n        transform: `translateY(${y * s}px)`,\r\n      }}\r\n    >\r\n      {children}\r\n    </div>\r\n  );\r\n\r\n  return (\r\n    <CursorTrack path={path} theme={theme} mode={mode} speed={speed}>\r\n      <AbsoluteFill\r\n        className={className}\r\n        style={{\r\n          backgroundColor: t.background,\r\n          alignItems: \"center\",\r\n          justifyContent: \"center\",\r\n          fontFamily: SANS,\r\n          fontWeight: 500,\r\n          textRendering: \"geometricPrecision\",\r\n        }}\r\n      >\r\n        <div\r\n          style={{\r\n            opacity: enter,\r\n            transform: `translateY(${(1 - enter) * 12 * s}px)`,\r\n            fontSize: 28 * s,\r\n            letterSpacing: \"-0.01em\",\r\n          }}\r\n        >\r\n          <SplitButton\r\n            t={t}\r\n            width={w * s}\r\n            height={H * s}\r\n            background={bg}\r\n            press={press}\r\n          >\r\n            {row(idle.y, idle.opacity, label)}\r\n            {row(\r\n              busy.y,\r\n              busy.opacity,\r\n              <>\r\n                <svg\r\n                  viewBox=\"0 0 24 24\"\r\n                  width={icon}\r\n                  height={icon}\r\n                  style={{ rotate: `${frame * 12}deg` }}\r\n                >\r\n                  <title>Pending</title>\r\n                  <circle\r\n                    cx={12}\r\n                    cy={12}\r\n                    r={9}\r\n                    fill=\"none\"\r\n                    stroke={t.primaryForeground}\r\n                    strokeOpacity={0.3}\r\n                    strokeWidth={2.6}\r\n                  />\r\n                  <path\r\n                    d=\"M12 3 A9 9 0 0 1 21 12\"\r\n                    fill=\"none\"\r\n                    stroke={t.primaryForeground}\r\n                    strokeWidth={2.6}\r\n                    strokeLinecap=\"round\"\r\n                  />\r\n                </svg>\r\n                {pending}\r\n              </>,\r\n            )}\r\n            {row(\r\n              ok.y,\r\n              ok.opacity,\r\n              <>\r\n                <svg viewBox=\"0 0 24 24\" width={icon} height={icon}>\r\n                  <title>Done</title>\r\n                  <path\r\n                    d=\"M5 12.5 L10 17 L19 7.5\"\r\n                    fill=\"none\"\r\n                    stroke={t.primaryForeground}\r\n                    strokeWidth={2.8}\r\n                    strokeLinecap=\"round\"\r\n                    strokeLinejoin=\"round\"\r\n                    pathLength={1}\r\n                    strokeDasharray={1}\r\n                    strokeDashoffset={1 - tick}\r\n                  />\r\n                </svg>\r\n                {done}\r\n              </>,\r\n            )}\r\n          </SplitButton>\r\n        </div>\r\n      </AbsoluteFill>\r\n    </CursorTrack>\r\n  );\r\n}\r\n"}]}