/**
 * `<action-list-ui>` — Inline list of command actions with keyboard navigation. Fires action event when an item is clicked or activated via keyboard.
 *
 * @see https://ui-kit.exe.xyz/site/components/action-list
 *
 * 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 interface ActionListActionEventDetail {
  /** The triggering list-item element. */
  item: Record<string, unknown>;
  /** Item text content or [text] attribute. */
  text: string;
  /** Item value attribute (preferred over text for stable IDs). */
  value: string;
}

export type ActionListActionEvent = CustomEvent<ActionListActionEventDetail>;

export class UIActionList extends UIElement {

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

export class UIActionItem extends UIElement {
  /** Disables click + keyboard activation; aria-disabled is set. */
  disabled: boolean;
  /** Leading icon name (Phosphor). */
  icon: string;
  /** Action label. */
  text: string;
  /** Identifier passed to the action-list change/activate handlers. */
  value: string;
  /** Visual variant (default | accent | danger). */
  variant: string;
}
