{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"classic-css-typewriter-line-with-steps-and-blinking-caret","type":"registry:component","title":"Classic CSS Typewriter Line","description":"Free CSS typing animation: one line typed with steps() and ch widths, a blinking block caret, an erase and retype loop, and a still line for reduced motion.","dependencies":["framer-motion"],"files":[{"path":"components/we-inc/classic-css-typewriter-line-with-steps-and-blinking-caret.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport { useReducedMotion } from \"framer-motion\";\n\n// The typed line. Its length sets the steps() count and the ch width below.\nconst LINE = \"Open until the last loaf sells out.\";\n\nexport default function ClassicCssTypewriterLine() {\n  const rootRef = useRef<HTMLElement>(null);\n  const [paused, setPaused] = useState(false);\n  const reduce = useReducedMotion();\n\n  useEffect(() => {\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(([entry]) => setPaused(!entry.isIntersecting));\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  return (\n    <section\n      ref={rootRef}\n      data-paused={paused ? \"true\" : \"false\"}\n      data-still={reduce ? \"true\" : \"false\"}\n      className=\"ctw-root bg-white px-4 py-20 sm:py-28\"\n      style={{ [\"--ctw-n\" as string]: LINE.length }}\n    >\n      <style>{`\n        .ctw-root { container-type: inline-size; }\n        .ctw-line {\n          display: inline-block; position: relative;\n          font-family: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n          font-size: min(2.75rem, 4.3cqi); font-weight: 600; letter-spacing: 0;\n          color: #1e293b; width: calc(var(--ctw-n) * 1ch + 0.6ch); text-align: left; white-space: nowrap;\n        }\n        .ctw-typed {\n          display: inline-block; overflow: hidden; vertical-align: bottom;\n          width: calc(var(--ctw-n) * 1ch);\n          animation: ctw-type 7s infinite; animation-delay: -1.3s;\n        }\n        .ctw-caret {\n          display: inline-block; width: 0.55ch; height: 1.1em; margin-left: 0.05ch; vertical-align: -0.18em;\n          background: #c2410c; animation: ctw-blink 1s steps(1) infinite;\n        }\n        @keyframes ctw-type {\n          0% { width: 0; animation-timing-function: steps(${LINE.length}, end); }\n          42% { width: calc(var(--ctw-n) * 1ch); animation-timing-function: linear; }\n          86% { width: calc(var(--ctw-n) * 1ch); animation-timing-function: steps(${LINE.length}, end); }\n          98%, 100% { width: 0; }\n        }\n        @keyframes ctw-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }\n        .ctw-root[data-paused=\"true\"] .ctw-typed, .ctw-root[data-paused=\"true\"] .ctw-caret { animation-play-state: paused; }\n        .ctw-root[data-still=\"true\"] .ctw-typed, .ctw-root[data-still=\"true\"] .ctw-caret { animation: none; }\n        @media (prefers-reduced-motion: reduce) { .ctw-typed, .ctw-caret { animation: none; } }\n      `}</style>\n      <div className=\"mx-auto max-w-4xl text-center\">\n        <p className=\"text-xs font-semibold uppercase tracking-[0.2em] text-slate-600\">Marlow Lane Bakery</p>\n        <h1 className=\"mt-6\">\n          <span className=\"sr-only\">{LINE}</span>\n          <span className=\"ctw-line\" aria-hidden=\"true\">\n            <span className=\"ctw-typed\">{LINE}</span>\n            <span className=\"ctw-caret\" />\n          </span>\n        </h1>\n        <p className=\"mx-auto mt-6 max-w-md text-base text-slate-600\">Doors at seven, rye on Tuesdays, and the oven stays warm until the shelves are empty.</p>\n        <a href=\"#\" className=\"mt-8 inline-flex h-11 items-center rounded-full bg-slate-900 px-6 text-sm font-semibold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-700 focus-visible:ring-offset-2\">See today&apos;s bake</a>\n      </div>\n    </section>\n  );\n}\n"}]}
