{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"opening-checklist-where-each-task-ticks-off-in-turn","type":"registry:component","title":"Opening Checklist That Ticks Off in Turn","description":"","dependencies":[],"files":[{"path":"components/we-inc/opening-checklist-where-each-task-ticks-off-in-turn.tsx","type":"registry:component","content":"import { useEffect, useRef, type CSSProperties } from \"react\";\n\n/* Styles shared with the HTML version; class and keyframe names are prefixed so several pieces can share a page. */\nconst css = `\n  /* Change these: page, card, ink, accent (ticked boxes), gap between ticks during the entrance. */\n  .m3tsk { --m3tsk-bg: #e7ece6; --m3tsk-card: #fcfdfb; --m3tsk-ink: #1d2a22; --m3tsk-accent: #2c5e45; --m3tsk-gap: .22s; }\n  .m3tsk { background: var(--m3tsk-bg); padding: 64px 16px; font-family: \"Inter Tight\", \"Inter\", ui-sans-serif, system-ui, sans-serif; color: var(--m3tsk-ink); }\n  .m3tsk-card { max-width: 480px; margin: 0 auto; background: var(--m3tsk-card); border: 1px solid #dbe3db; border-radius: 20px; padding: 26px 24px 22px; box-shadow: 0 1px 2px rgba(29,42,34,.05), 0 22px 44px -28px rgba(29,42,34,.38); }\n  .m3tsk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }\n  .m3tsk-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--m3tsk-accent); }\n  .m3tsk-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }\n  .m3tsk-replay { min-height: 40px; padding: 0 14px; border: 1px solid #d3ddd4; border-radius: 999px; background: #fff; color: #3b4a40; font: inherit; font-size: 13px; cursor: pointer; }\n  .m3tsk-list { list-style: none; margin: 18px 0 0; padding: 0; }\n  .m3tsk-list li + li { border-top: 1px solid #edf1ec; }\n  .m3tsk-row { position: relative; display: flex; align-items: center; gap: 14px; min-height: 56px; cursor: pointer; }\n  .m3tsk-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }\n  .m3tsk-box { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; border: 1.75px solid #9aa89e; background: #fff; position: relative; overflow: hidden; }\n  .m3tsk-box::before { content: \"\"; position: absolute; inset: 0; background: var(--m3tsk-accent); opacity: 0; transform: scale(.4); border-radius: 6px; transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.3,1); }\n  .m3tsk-box svg { position: relative; width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }\n  .m3tsk-tick { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .3s ease-out .08s; }\n  .m3tsk-row input:checked + .m3tsk-box { border-color: var(--m3tsk-accent); }\n  .m3tsk-row input:checked + .m3tsk-box::before { opacity: 1; transform: none; }\n  .m3tsk-row input:checked + .m3tsk-box .m3tsk-tick { stroke-dashoffset: 0; }\n  .m3tsk-row input:focus-visible + .m3tsk-box { outline: 2px solid var(--m3tsk-accent); outline-offset: 3px; }\n  .m3tsk-replay:focus-visible { outline: 2px solid var(--m3tsk-accent); outline-offset: 3px; }\n  .m3tsk-label { position: relative; flex: 0 1 auto; font-size: 15.5px; transition: color .3s ease; }\n  .m3tsk-label::after { content: \"\"; position: absolute; left: 0; top: 52%; width: 100%; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s ease .1s; }\n  .m3tsk-row input:checked ~ .m3tsk-label { color: #56645a; }\n  .m3tsk-row input:checked ~ .m3tsk-label::after { transform: scaleX(1); }\n  .m3tsk-time { margin-left: auto; font-size: 13px; color: #56645a; font-variant-numeric: tabular-nums; }\n  .m3tsk-done { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #e9f1eb; color: var(--m3tsk-accent); font-size: 14.5px; font-weight: 600; transition: opacity .3s ease; }\n  /* Entrance: the boxes fill and tick one after another, then the summary appears. */\n  .m3tsk[data-play] .m3tsk-box::before { animation: m3tsk-fill .3s calc(var(--i) * var(--m3tsk-gap) + .15s) cubic-bezier(.2,.8,.3,1) both; }\n  .m3tsk[data-play] .m3tsk-tick { animation: m3tsk-draw .3s calc(var(--i) * var(--m3tsk-gap) + .3s) ease-out both; }\n  .m3tsk[data-play] .m3tsk-label::after { animation: m3tsk-strike .35s calc(var(--i) * var(--m3tsk-gap) + .35s) ease both; }\n  .m3tsk[data-play] .m3tsk-done { animation: m3tsk-rise .4s 1.2s ease-out both; }\n  @keyframes m3tsk-fill { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }\n  @keyframes m3tsk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }\n  @keyframes m3tsk-strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }\n  @keyframes m3tsk-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }\n  @media (prefers-reduced-motion: reduce) { .m3tsk * { animation: none !important; transition: none !important; } .m3tsk *::before, .m3tsk *::after { animation: none !important; transition: none !important; } }\n`;\n\nexport default function OpeningChecklistThatTicksOff() {\n  const ref = useRef<HTMLElement>(null);\n\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    // Plays once when the list comes into view of its nearest scroller; ticking a box by hand updates the summary.\n    const boxes = Array.from(root.querySelectorAll<HTMLInputElement>(\"input\"));\n    const done = root.querySelector<HTMLElement>(\".m3tsk-done\")!;\n    let t = 0;\n    const count = () => {\n      const n = boxes.filter((b) => b.checked).length;\n      done.textContent = n === boxes.length ? `All ${n} tasks done` : `${n} of ${boxes.length} tasks done`;\n    };\n    const play = () => {\n      boxes.forEach((b) => { b.checked = true; });\n      count();\n      root.removeAttribute(\"data-play\");\n      void root.offsetWidth; // restart the keyframes\n      root.setAttribute(\"data-play\", \"\");\n      window.clearTimeout(t);\n      t = window.setTimeout(() => root.removeAttribute(\"data-play\"), 1700);\n    };\n    const onChange = () => { root.removeAttribute(\"data-play\"); count(); };\n    boxes.forEach((b) => b.addEventListener(\"change\", onChange));\n    const io = new IntersectionObserver(([en]) => {\n      if (en.isIntersecting) { play(); io.disconnect(); }\n    });\n    io.observe(root);\n    const replay = root.querySelector(\".m3tsk-replay\")!;\n    replay.addEventListener(\"click\", play);\n    return () => {\n      window.clearTimeout(t);\n      io.disconnect();\n      boxes.forEach((b) => b.removeEventListener(\"change\", onChange));\n      replay.removeEventListener(\"click\", play);\n    };\n  }, []);\n\n  return (\n    <>\n      <style>{css}</style>\n      <section ref={ref} className=\"m3tsk\" aria-labelledby=\"m3tsk-h\">\n        <div className=\"m3tsk-card\">\n          <div className=\"m3tsk-head\">\n            <div>\n              <p className=\"m3tsk-kicker\">Hollis Street Cafe</p>\n              <h2 className=\"m3tsk-title\" id=\"m3tsk-h\">Opening checklist</h2>\n            </div>\n            <button className=\"m3tsk-replay\" type=\"button\">Replay</button>\n          </div>\n          <ul className=\"m3tsk-list\">\n            <li style={{ \"--i\": \"0\" } as CSSProperties}><label className=\"m3tsk-row\" htmlFor=\"m3tsk-c1\"><input id=\"m3tsk-c1\" type=\"checkbox\" defaultChecked /><span className=\"m3tsk-box\" aria-hidden=\"true\"><svg viewBox=\"0 0 24 24\"><path className=\"m3tsk-tick\" pathLength={1} d=\"M6.5 12.5l3.6 3.6 7.4-7.6\"/></svg></span><span className=\"m3tsk-label\">Grinder calibrated</span><span className=\"m3tsk-time\">6:42</span></label></li>\n            <li style={{ \"--i\": \"1\" } as CSSProperties}><label className=\"m3tsk-row\" htmlFor=\"m3tsk-c2\"><input id=\"m3tsk-c2\" type=\"checkbox\" defaultChecked /><span className=\"m3tsk-box\" aria-hidden=\"true\"><svg viewBox=\"0 0 24 24\"><path className=\"m3tsk-tick\" pathLength={1} d=\"M6.5 12.5l3.6 3.6 7.4-7.6\"/></svg></span><span className=\"m3tsk-label\">Pastry case filled</span><span className=\"m3tsk-time\">6:50</span></label></li>\n            <li style={{ \"--i\": \"2\" } as CSSProperties}><label className=\"m3tsk-row\" htmlFor=\"m3tsk-c3\"><input id=\"m3tsk-c3\" type=\"checkbox\" defaultChecked /><span className=\"m3tsk-box\" aria-hidden=\"true\"><svg viewBox=\"0 0 24 24\"><path className=\"m3tsk-tick\" pathLength={1} d=\"M6.5 12.5l3.6 3.6 7.4-7.6\"/></svg></span><span className=\"m3tsk-label\">Milk delivery checked</span><span className=\"m3tsk-time\">6:55</span></label></li>\n            <li style={{ \"--i\": \"3\" } as CSSProperties}><label className=\"m3tsk-row\" htmlFor=\"m3tsk-c4\"><input id=\"m3tsk-c4\" type=\"checkbox\" defaultChecked /><span className=\"m3tsk-box\" aria-hidden=\"true\"><svg viewBox=\"0 0 24 24\"><path className=\"m3tsk-tick\" pathLength={1} d=\"M6.5 12.5l3.6 3.6 7.4-7.6\"/></svg></span><span className=\"m3tsk-label\">Front door unlocked</span><span className=\"m3tsk-time\">7:00</span></label></li>\n          </ul>\n          <p className=\"m3tsk-done\" role=\"status\">All 4 tasks done</p>\n        </div>\n      </section>\n    </>\n  );\n}\n"}]}
