// axi0 Motion 0.2.0: Fuse undo. An action button whose done state carries an Undo on a burning fuse; the action commits only when the fuse runs out.
// Generated from src/fuse-undo/meta.json by motion-pack: a thin wrapper. The loader (motion.js) must be on the page once;
// it starts the effect on the element this renders. Options left out keep the effect's own defaults.
import { createElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";

export interface FuseUndoProps extends HTMLAttributes<HTMLElement> {
  /** the label after the press (default "Archived") */
  done?: string;
  /** how long Undo stays (default 5000) */
  window?: number;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));

export function FuseUndo({ as = "div", done, window, ...rest }: FuseUndoProps) {
  return createElement(as, { ...rest, "data-motion": "fuse-undo", "data-motion-done": s(done), "data-motion-window": s(window) });
}

export default FuseUndo;
