import { getLogger } from "@commonfabric/utils/logger"; import { css, html, type PropertyValues } from "lit"; import { BaseElement } from "../../core/base-element.ts"; import "../cf-button/cf-button.ts"; const logger = getLogger("cf-submit-input", { enabled: false, level: "debug", }); /** * CFSubmitInput - A text field with a submit button whose click carries the * typed text on the event itself. * * The submit button click is a real (trusted) DOM gesture that bubbles to this * host. A pattern wires `onClick` on the host and reads `event.target.value`: * the host mirrors the field's text in its `value` property, so the submitted * text rides the trusted click — together with the surrounding surface's UI * integrity (data-ui-action / data-ui-event-integrity on the host and an * ancestor). Because the text travels in the event, the consuming handler needs * no durable draft cell, and the field clears itself in the DOM after submit — * deferred past the click's handling so the value is read first, and guarded so * a back-to-back submit's freshly typed name is never wiped. This * keeps a cross-space create handler stable across retries — the event payload * is fixed — with nothing to clobber. * * Pressing Enter in the field submits as well. The field sits inside a `
`; } } declare global { interface HTMLElementTagNameMap { "cf-submit-input": CFSubmitInput; } }