import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { vui } from "../core/vui.js";
import button_default from "../button/button.js";
import "../button/index.js";
import "../core/index.js";
import { useCopyToClipboard } from "./useCopyToClipboard.js";
import { jsx } from "react/jsx-runtime";

//#region src/copyToClipboard/copyToClipboard.tsx
const defaultIcon = "falCopy";
/**
* A helper button component.
*
* Copies the provided text to clipboard.
*
* Copying is available only for a secure environment (https://), otherwise the button is disabled.
*
*/
const CopyToClipboard = vui((props, ref) => {
	const { disabled, copyText, className, icon = defaultIcon, size = "sm", variant = "tertiaryDark", ...rest } = props;
	const { copy, isCopyDisabled } = useCopyToClipboard(copyText);
	return /* @__PURE__ */ jsx(button_default, {
		"aria-label": `Copy to clipboard ${copyText}`,
		className: cs("vui-copy-to-clipboard", className),
		disabled: disabled || isCopyDisabled,
		icon,
		onClick: () => copy(),
		ref,
		size,
		variant,
		...rest
	});
});
CopyToClipboard.displayName = "CopyToClipboard";

//#endregion
export { CopyToClipboard };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=copyToClipboard.js.map