handleIconClick function

Last updated: 2026-03-01T23:25:47.108Z

Metrics

LOC: 41 Complexity: 9 Params: 1

Signature

handleIconClick(e: Event): : Promise<void>

Source Code

async function handleIconClick(e: Event): Promise<void> {
  e.preventDefault();
  e.stopPropagation();

  if (!currentTarget) return;

  const el = currentTarget as
    | HTMLInputElement
    | HTMLSelectElement
    | HTMLTextAreaElement;

  const field: FormField = {
    element: el,
    selector: getUniqueSelector(el),
    category: "unknown",
    fieldType: "unknown",
    label: findLabel(el),
    name: el.name || undefined,
    id: el.id || undefined,
    placeholder:
      ("placeholder" in el ? el.placeholder : undefined) || undefined,
    autocomplete: el.autocomplete || undefined,
    required: el.required,
  };

  field.contextSignals = buildSignals(field);
  const pipelineResult = await DEFAULT_PIPELINE.runAsync(field);
  field.fieldType = pipelineResult.type;
  field.detectionMethod = pipelineResult.method;
  field.detectionConfidence = pipelineResult.confidence;

  const btn = iconElement?.querySelector(
    "#fill-all-field-icon-btn",
  ) as HTMLElement;
  if (btn) btn.classList.add("loading");

  await fillSingleField(field);

  if (btn) btn.classList.remove("loading");
  el.focus();
}

Dependencies (Outgoing)

graph LR handleIconClick["handleIconClick"] fillSingleField["fillSingleField"] handleIconClick -->|calls| fillSingleField style handleIconClick fill:#dbeafe,stroke:#2563eb,stroke-width:2px click handleIconClick "af8d17613426f252.html" click fillSingleField "e1740bceca6b34c2.html"
TargetType
fillSingleField calls

No incoming dependencies.