/**
 * `<button-ui>` — Clickable button with text, icon, and variant support. Supports submit type for forms.
 *
 * @see https://ui-kit.exe.xyz/site/components/button
 *
 * Type declarations generated by scripts/build/dts-codegen.mjs from
 * the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
 * run `npm run build:components`, then `npm run codegen:dts` to
 * regenerate; or hand-author this file fully if rich event types are
 * needed beyond what the yaml `events:` block can express.
 */

import { UIElement } from '../../core/element.js';

export type ButtonPressEvent = CustomEvent<unknown>;

export class UIButton extends UIElement {
  /** HTML button type (button, submit, reset) */
  type: string;
  /** Semantic intent — composes with [variant]. `<button-ui variant="solid" color="danger">` = filled destructive action; `<button-ui variant="outline" color="success">` = outlined success affordance. */
  color: 'default' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
  /** Disables interaction and prevents click/press events */
  disabled: boolean;
  /** Leading Phosphor icon name (rendered before text). */
  icon: string;
  /** Sizing scale (xs/sm/md/lg/xl). */
  size: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
  /** Makes the button stretch to fill the parent's width */
  stretch: boolean;
  /** Button text, rendered via CSS attr(text) on ::after */
  text: string;
  /** Button label. Renderer routes this to the `text` attribute, which is rendered via CSS attr(text) on ::after and mirrored to aria-label. */
  textContent: string;
  /** Visual style — `solid` (default fill), `outline`, `ghost`. `default` / `primary` are aliases of `solid`. Style is independent of semantic intent — to express destructive / success / info / warning intent, set [color="…"] alongside.
For **inline navigation** (Terms of Service, Privacy Policy, footer links, "Sign in" / "Sign up" cross-page affordances) use `<link-ui>` instead — it carries proper `<a href>` semantics, keyboard handling (Enter only, no Space), middle-click open-new-tab, and screen-reader announces "link" instead of "button". Mixing navigation and action affordances under the same primitive is a category error fixed at this junction. */
  variant: 'default' | 'solid' | 'outline' | 'ghost' | 'primary';

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UIButton, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'press', listener: (ev: ButtonPressEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
