import { cn } from "#lib/utils.ts";
import { trigger as styles } from "./classes.ts";

/**
 * Deviation from source: the React version accepts `asChild` (via Radix
 * `Slot.Root`) to merge these props/classes onto an arbitrary child element
 * instead of rendering its own `<button>`. Marko 6 has no dynamic-tag /
 * props-merging primitive equivalent to `Slot.Root`, and this codebase's
 * other ports (e.g. `marker.marko`, `bubble-content.marko`) already drop
 * `asChild` for the same reason, so `AttachmentTrigger` always renders a
 * `<button>` here. `asChild` is accepted for API parity but is a no-op.
 */
export interface Input extends Marko.Input<"button"> {
  asChild?: boolean;
}

<const/{ class: className, asChild, type, content, ...rest }=input/>

<button
  data-slot="attachment-trigger"
  type=(type ?? "button")
  class=cn(styles.root, className)
  ...rest
>
  <${content}/>
</button>
