{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"mouse-outline-scroll-cue-with-rolling-wheel-dot","type":"registry:block","title":"Mouse Outline Scroll Cue With Rolling Wheel Dot","description":"","dependencies":[],"files":[{"path":"components/we-inc/mouse-outline-scroll-cue-with-rolling-wheel-dot.tsx","type":"registry:component","content":"import { useEffect, useRef } from \"react\";\n\n// Change these first: --m5mse-loop (how long one roll of the wheel dot takes), --m5mse-ink (cue and heading colour), --m5mse-box (height of the scrolling frame), and the photo in .m5mse-photo.\n// Same markup, styles and script as the plain HTML version.\nconst CSS = `\n.m5mse { position: relative; box-sizing: border-box; height: var(--m5mse-box); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; font-family: \"Inter Tight\", \"Inter\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; -webkit-font-smoothing: antialiased; }\n/* To use on a real page: delete height and overflow above, make the hero 100vh, and set BOX = null in the script. */\n.m5mse *, .m5mse *::before, .m5mse *::after { box-sizing: border-box; }\n.m5mse:focus-visible { outline: 3px solid var(--m5mse-focus); outline-offset: -3px; }\n.m5mse [tabindex=\"-1\"]:focus { outline: none; }\n.m5mse-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }\n.m5mse-hint { position: sticky; top: 0; height: 0; z-index: 6; display: flex; justify-content: center; align-items: flex-start; pointer-events: none; }\n.m5mse-hint span { margin: 10px 0 0; padding: 4px 11px; border-radius: 999px; background: var(--m5mse-hintbg); color: var(--m5mse-hintfg); font-size: 11.5px; letter-spacing: .04em; transition: opacity .5s ease; }\n.m5mse[data-touched] .m5mse-hint span { opacity: 0; }\n@media (max-width: 600px) { .m5mse-hint { justify-content: flex-end; } .m5mse-hint span { margin-right: 10px; } }\n.m5mse-hero { position: relative; min-height: var(--m5mse-box); }\n.m5mse-cue { -webkit-tap-highlight-color: transparent; transition: opacity .45s ease, transform .45s ease, visibility 0s linear 0s; }\n.m5mse-cue:focus-visible { outline: 2px solid var(--m5mse-focus); outline-offset: 4px; }\n/* Faded once the marker below the hero is in view; the loop is paused while hidden or off screen. */\n.m5mse[data-gone] .m5mse-cue { opacity: 0; visibility: hidden; transform: translateY(10px); pointer-events: none; transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s; }\n.m5mse[data-gone] .m5mse-cue *, .m5mse[data-off] .m5mse-cue * { animation-play-state: paused !important; }\n.m5mse-mark { height: 1px; margin-bottom: -1px; }\n/* Reduced motion: the cue stands still at full strength and the link jumps instead of gliding. */\n@media (prefers-reduced-motion: reduce) {\n  .m5mse *, .m5mse *::before, .m5mse *::after { animation: none !important; transition: none !important; }\n}\n.m5mse { --m5mse-box: 620px; --m5mse-bg: #141a15; --m5mse-ink: #f3f1ea; --m5mse-quiet: #c9cdc3; --m5mse-moss: #a9c49a; --m5mse-focus: #f3f1ea; --m5mse-hintbg: rgba(20,26,21,.7); --m5mse-hintfg: #f3f1ea; --m5mse-loop: 2.2s;\n  background: var(--m5mse-bg); color: var(--m5mse-ink); }\n.m5mse-hero { overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 26px clamp(20px, 5vw, 56px) 34px; }\n.m5mse-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; transform: scaleX(-1); }\n.m5mse-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,19,15,.55) 0%, rgba(14,19,15,.1) 34%, rgba(14,19,15,.25) 58%, rgba(14,19,15,.86) 100%); }\n.m5mse-bar, .m5mse-copy, .m5mse-cue { position: relative; }\n.m5mse-bar { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; letter-spacing: .02em; }\n.m5mse-brand { font-weight: 650; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; }\n.m5mse-where { color: var(--m5mse-quiet); }\n.m5mse-copy { max-width: 560px; margin-top: auto; padding-bottom: 92px; }\n.m5mse-eyebrow { margin: 0 0 12px; color: var(--m5mse-moss); font-size: 12.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }\n.m5mse-h { margin: 0; font-family: Georgia, \"Iowan Old Style\", \"Times New Roman\", serif; font-weight: 400; font-size: clamp(36px, 5.4vw, 60px); line-height: 1.02; letter-spacing: -.02em; }\n.m5mse-lede { margin: 16px 0 0; max-width: 30em; color: #e2e4dc; font-size: 16px; line-height: 1.6; }\n.m5mse-cue { position: absolute; left: 0; right: 0; bottom: 26px; margin: 0 auto; width: max-content; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0; color: var(--m5mse-ink); text-decoration: none; }\n.m5mse-mouse { width: 26px; height: 41px; display: block; overflow: visible; }\n.m5mse-body { fill: rgba(243,241,234,.06); stroke: currentColor; stroke-width: 1.6; }\n.m5mse-dot { fill: currentColor; transform-box: fill-box; transform-origin: center; animation: m5mse-wheel var(--m5mse-loop) cubic-bezier(.45,0,.3,1) infinite; }\n.m5mse-label { white-space: nowrap; font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--m5mse-quiet); }\n.m5mse-cue:hover .m5mse-label { color: var(--m5mse-ink); }\n/* The wheel dot rolls down the mouse and fades, then reappears at the top. */\n@keyframes m5mse-wheel {\n  0%, 30% { transform: translateY(0) scale(1); opacity: 1; }\n  72% { transform: translateY(11px) scale(.8); opacity: 0; }\n  73% { transform: translateY(0) scale(.8); opacity: 0; }\n  92%, 100% { transform: translateY(0) scale(1); opacity: 1; }\n}\n.m5mse-next { padding: 64px clamp(20px, 5vw, 56px) 80px; background: #f3f1ea; color: #1c241d; }\n.m5mse-h2 { margin: 0 0 28px; font-family: Georgia, \"Times New Roman\", serif; font-weight: 400; font-size: 34px; letter-spacing: -.01em; }\n.m5mse-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 28px; }\n.m5mse-list li { padding: 18px 0; border-top: 1px solid #cfd2c6; }\n.m5mse-list h3 { margin: 0; font-size: 17px; font-weight: 650; }\n.m5mse-list p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: #4a5248; }\n@media (max-width: 600px) { .m5mse-where { display: none; } .m5mse-copy { padding-bottom: 104px; } }\n@media (prefers-reduced-motion: reduce) { .m5mse-dot { opacity: 1; transform: none; } }\n`;\n\nexport default function MouseOutlineScrollCueWithRolling() {\n  const rootRef = useRef<any>(null);\n\n  // Fades the cue when a marker below the hero scrolls into view, pauses the loop off screen,\n  // and glides to the next section on click (a plain jump when reduced motion is requested).\n  useEffect(() => {\n    const root: any = rootRef.current;\n    if (!root) return;\n    var off = [];\n    var BOX = root; // the scrolling box; set to null when the hero is on the page itself\n    var cue = root.querySelector(\".m5mse-cue\"), mark = root.querySelector(\".m5mse-mark\");\n    var reduce = matchMedia(\"(prefers-reduced-motion: reduce)\");\n    function on(el, n, f, o) { el.addEventListener(n, f, o); off.push(function () { el.removeEventListener(n, f, o); }); }\n    function watch(cb, opts, el) { var o = new IntersectionObserver(cb, opts); o.observe(el); off.push(function () { o.disconnect(); }); }\n    // Fade the cue once the marker just below the hero comes into view (or has gone past the top).\n    watch(function (es) {\n      var e = es[0], top = e.rootBounds ? e.rootBounds.top : 0;\n      root.toggleAttribute(\"data-gone\", e.isIntersecting || e.boundingClientRect.top < top);\n    }, { root: BOX, rootMargin: \"0px 0px -12% 0px\" }, mark);\n    // Pause the loop while the whole piece is off screen.\n    watch(function (es) { root.toggleAttribute(\"data-off\", !es[0].isIntersecting); }, {}, root);\n    on(BOX || window, \"scroll\", function () { root.setAttribute(\"data-touched\", \"\"); }, { passive: true, once: true });\n    function go(ev) {\n      var t = root.querySelector(cue.getAttribute(\"href\"));\n      if (!t) return;\n      ev.preventDefault();\n      var y = BOX ? t.getBoundingClientRect().top - BOX.getBoundingClientRect().top + BOX.scrollTop : t.getBoundingClientRect().top + scrollY;\n      (BOX || window).scrollTo({ top: y, behavior: reduce.matches ? \"auto\" : \"smooth\" });\n      t.focus({ preventScroll: true });\n    }\n    on(cue, \"click\", go);\n    return () => off.forEach((f: any) => f());\n  }, []);\n\n  return (\n    <section ref={rootRef} className=\"m5mse\" data-m5mse=\"\" tabIndex=\"0\" aria-label=\"Larchwood Cabins first screen, scrollable\">\n      <style>{CSS}</style>\n      <div className=\"m5mse-hint\" aria-hidden=\"true\"><span>Scroll inside</span></div>\n      <header className=\"m5mse-hero\">\n        <img className=\"m5mse-photo\" src=\"https://images.pexels.com/photos/19367250/pexels-photo-19367250.jpeg?auto=compress&cs=tinysrgb&w=1600\" alt=\"A weathered wooden cabin on a grassy slope below a misty pine forest\" width=\"1600\" height=\"1067\" />\n        <div className=\"m5mse-shade\" aria-hidden=\"true\"></div>\n        <div className=\"m5mse-bar\">\n          <span className=\"m5mse-brand\">Larchwood Cabins</span>\n          <span className=\"m5mse-where\">Glen Ardle, open all year</span>\n        </div>\n        <div className=\"m5mse-copy\">\n          <p className=\"m5mse-eyebrow\">Four cabins, one hillside</p>\n          <h1 className=\"m5mse-h\">Wake up above the fog line.</h1>\n          <p className=\"m5mse-lede\">Timber cabins with wood stoves and no signal, a short walk up from the lane. Bring boots; we bring the kindling.</p>\n        </div>\n        <a className=\"m5mse-cue\" href=\"#m5mse-next\">\n          <svg className=\"m5mse-mouse\" viewBox=\"0 0 28 44\" aria-hidden=\"true\" focusable=\"false\">\n            <rect className=\"m5mse-body\" x=\"1.5\" y=\"1.5\" width=\"25\" height=\"41\" rx=\"12.5\" />\n            <circle className=\"m5mse-dot\" cx=\"14\" cy=\"12\" r=\"2.6\" />\n          </svg>\n          <span className=\"m5mse-label\">Scroll to the cabins</span>\n        </a>\n      </header>\n      <div className=\"m5mse-mark\" aria-hidden=\"true\"></div>\n      <section className=\"m5mse-next\" id=\"m5mse-next\" tabIndex=\"-1\" aria-labelledby=\"m5mse-cabins\">\n        <h2 className=\"m5mse-h2\" id=\"m5mse-cabins\">The cabins</h2>\n        <ul className=\"m5mse-list\">\n          <li><h3>Rowan</h3><p>Sleeps two. A box bed under the window that faces down the glen.</p></li>\n          <li><h3>Alder</h3><p>Sleeps four. Bunk room for children and a porch with a bench.</p></li>\n          <li><h3>Birch</h3><p>Sleeps two. The highest cabin, with a cast iron bath on the deck.</p></li>\n          <li><h3>Holly</h3><p>Sleeps three. Step-free from the track, closest to the wood store.</p></li>\n        </ul>\n      </section>\n    </section>\n  );\n}\n"}]}
