SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Function useFormulaInput

    • The headless formula input — everything a formula-backed field does except its chrome: text ⟷ ICalculation.IFormula parsing, acting as the reference-mode bus PRODUCER while focused (grid drags, header picks and keyboard point-nav all write into the field through the same machinery the cell editor uses), done-key handling (onDone returns focus to the FIELD, never the sheet), and keyboard pointing armed WITHOUT F2 — per grammar: a 'reference' field arms on engage (the Excel RefEdit contract — 'live' for the whole engagement, 'done' until typing); a 'formula' field arms by CARET CONTEXT (operand expected, or the caret on a reference token — the cell editor's model), showing its references without picking everywhere else. A pick re-arms; F2 stays as a manual toggle (the inline grid editor's convention).

      Two grammars share this one hook (see FormulaInputGrammar); 'formula' is the default. The grammar decides how text maps to picker ranges (tokens vs segments), how a pick writes back, and what validates — everything else (engagement, commit channels, key semantics) is identical by construction.

      Parameters

      Returns FormulaInputApi

      Framework-free on purpose (chromes are thin wrappers — a plain-DOM one ships in this package, the MUI one in studio-mui). Session-less: no IEditable involved; the bus state carries its own onDone. While POINTING, blur DISENGAGES only when focus lands in another text input (another dialog field) — focus moving to the grid, headers, or sheet tabs is a pick in progress and keeps the engagement, exactly like the editor's active-input claim persisting through a picker-drag blur. While merely SHOWING (formula grammar, not armed) there is no gesture to protect: ANY blur releases the bus and the displayed ranges clear — the highlight follows the active editor.