/* ============================================================ SHLOK — Step content renderer → window.StepContent ============================================================ */ const { useState: useS, useEffect: useE, useRef: useR } = React; function StepHead({ step }) { return (
{step.eyebrow ?
{step.eyebrow}
: null}

{step.title}

{step.sub ?

{step.sub}

: null} {step.microcopy ? (
{step.microcopy}
) : null}
); } /* ---------- SINGLE (cards or chips) ---------- */ function SingleStep({ step, data, set, requestAdvance }) { const val = data[step.key]; const [query, setQuery] = useS(""); function pick(opt) { set(step.key, opt.v); if (step.allowOther && opt.v !== "Other") set(step.otherKey, ""); if (step.autoAdvance) requestAdvance(); } if (step.chips) { const filtered = step.options.filter((o) => o.v.toLowerCase().includes(query.toLowerCase().trim()) ); const isOther = val === "Other"; return (
{step.search ? (
setQuery(e.target.value)} placeholder="Search your business type…" aria-label="Search business type" />
) : null}
{filtered.map((o) => ( pick(o)} /> ))} {filtered.length === 0 ? (
No match — pick “Other” below to tell us.
) : null}
{isOther ? (
Tell us what kind of business (optional)
set(step.otherKey, e.target.value)} placeholder="e.g. Solar installation, Travel agency…" />
) : null}
); } return (
{step.options.map((o) => ( pick(o)} /> ))}
); } /* ---------- MULTI ---------- */ function MultiStep({ step, data, set }) { const arr = data[step.key] || []; const max = typeof step.maxSelections === "number" ? step.maxSelections : null; function toggle(opt) { set(step.key, (prev) => { const cur = prev || []; if (cur.includes(opt.v)) return cur.filter((x) => x !== opt.v); if (max !== null && cur.length >= max) return cur; return [...cur, opt.v]; }); } return (
{step.options.map((o) => ( toggle(o)} /> ))}
); } /* ---------- RANK (top 3) ---------- */ function RankStep({ step, data, set }) { const arr = data[step.key] || []; const max = typeof step.maxSelections === "number" ? step.maxSelections : step.max; const full = arr.length >= max; function toggle(opt) { set(step.key, (prev) => { const cur = prev || []; if (cur.includes(opt.v)) return cur.filter((x) => x !== opt.v); if (cur.length >= max) return cur; return [...cur, opt.v]; }); } return (
{step.options.map((o) => { const idx = arr.indexOf(o.v); const selected = idx >= 0; return ( toggle(o)} /> ); })}
); } /* ---------- SLIDERS ---------- */ function SliderRow({ s, value, onChange }) { const [active, setActive] = useS(false); const pct = ((value - 1) / 9) * 100; const lo = value <= 4, hi = value >= 7; return (
{s.name} {value}
onChange(parseInt(e.target.value, 10))} onPointerDown={() => setActive(true)} onPointerUp={() => setActive(false)} onBlur={() => setActive(false)} aria-label={`${s.name}: ${s.lo} to ${s.hi}, currently ${value} of 10`} />
{s.lo} {s.hi}
); } function SlidersStep({ step, data, set }) { const scores = data[step.key] || {}; function setOne(k, v) { set(step.key, { ...scores, [k]: v, _touched: true }); } return (
{step.sliders.map((s) => ( setOne(s.key, v)} /> ))}
); } /* ---------- LOSS (multi chips + optional note) ---------- */ function NoteArea({ type, text, onType, onText }) { return (
{type === "text" ? (