import "./icon-CTW4Gr4z.js"; import "./button-yMIli_DJ.js"; import { CSSResultGroup, PropertyValues } from "lit"; import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element"; //#region src/components/copy/copy.d.ts /** * * * @summary Copies text and other types of data to the clipboard. * @tag sigvelo-copy * @documentation https://design-system.sigvelo.com/docs/components/copy * @status stable * @since 1.0 * * @dependency sigvelo-button * @dependency sigvelo-icon * * @slot - A custom button to use instead of the default. * * @event sigvelo-copy - Emitted when the content has been copied. This event does not bubble. You can inspect * `event.detail.data` to see the content that was copied. * @event sigvelo-copy-error - Emitted when the browser refuses to allow the content to be copied. This event does not * bubble. You can inspect `event.detail.error` to see the error that occurred. * * @csspart copy-button - The default copy button, a `` element. * @csspart copy-button__button - The default copy button's `button` part. * @csspart copy-icon - The default copy icon, a `` element. * @csspart copy-icon__svg - The copy icon's `svg` part. * @csspart feedback - The feedback that shows when copying. * * @example Default * ```html * * ``` * * **Note:** This component uses the Clipboard API's [`writeText()`](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) method, which requires a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). In other words, for maximum browser support, make sure the URL starts with `https://`. * * @example Copying text * Use the `data` attribute to set the text that will be copied when the button is activated. * * ```html * * ``` * * @example Using custom buttons * Use a custom button by simply slotting it in. Both Sigvelo buttons and native buttons are supported. * * ```html * * * * Copy * * * * * * * ``` * * @example Feedback placement * Copy feedback shows above the button by default. Use the `feedback-placement` attribute to change where it gets shown. The actual placement may vary if there's insufficient room to display it in the viewport. To hide the feedback, set it to `hidden`. * * ```html * * * * * ``` * * @example Copying HTML content * You can copy HTML content using the ClipboardItem API. For best results, make sure to provide `text/html` and `text/plain` types. * * ```html *

* This content will be copied to the clipboard. * Try pasting it into another app. *

* * * Copy HTML * * * * ``` * * @example Copying PNG images * Most browsers support writing PNG image data with the `ClipboardItem` API used in this example. Try copying the image using the button below, then paste it into an image editing app. * * ```html * Three tabby kittens * * * Copy PNG image * * * * ``` * * @example Copying non-PNG images * Copying non-PNG images a trickier due to limited browser support. You can use web custom formats, but they don't seem to be widely supported by platform applications yet. * * For now, the most effective way to copy a non-PNG image is to render it in a `` element, convert it to a blob, and copy it as a PNG. * * ```html * A kitten posing behind a tree * * * Copy JPEG image * * * * ``` * * @example Disabling * Add the `disabled` attribute to disable the button and prevent copying. * * ```html * * ``` */ declare class SigveloCopy extends SigveloElement { static styles: CSSResultGroup; private localize; private feedback; /** The text content that will be copied to the clipboard. */ data: string | ClipboardItem[]; /** Disables the button. */ disabled: boolean; /** The placement of the feedback animation. */ feedbackPlacement: "top" | "right" | "bottom" | "left" | "hidden"; updated(changedProperties: PropertyValues): void; private handleClick; /** Shows copy feedback with an animation */ private showFeedback; render(): import("lit-html").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { "sigvelo-copy": SigveloCopy; } } //#endregion export { SigveloCopy as t };