import { EventObject, Machine, Service } from "@zag-js/core"; import { DataUrlType } from "@zag-js/dom-query"; import { CommonProperties, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types"; import { QrCodeGenerateOptions, QrCodeGenerateOptions as QrCodeGenerateOptions$1, QrCodeGenerateResult, QrCodeGenerateResult as QrCodeGenerateResult$1 } from "uqr"; export interface ValueChangeDetails { value: string; } export interface ElementIds { root?: string | undefined; frame?: string | undefined; overlay?: string | undefined; } export interface QrCodeProps extends DirectionProperty, CommonProperties { /** * The controlled value to encode. */ value?: string | undefined; /** * The initial value to encode when rendered. * Use when you don't need to control the value of the qr code. */ defaultValue?: string | undefined; /** * The element ids. */ ids?: ElementIds | undefined; /** * The qr code encoding options. */ encoding?: QrCodeGenerateOptions$1 | undefined; /** * Callback fired when the value changes. */ onValueChange?: ((details: ValueChangeDetails) => void) | undefined; /** * The pixel size of the qr code. */ pixelSize?: number | undefined; } type PropsWithDefault = "pixelSize" | "defaultValue"; type Computed = Readonly<{ encoded: QrCodeGenerateResult$1; }>; export interface QrCodeSchema { props: RequiredBy; context: { value: string; }; computed: Computed; state: "idle"; event: EventObject; action: string; effect: string; guard: string; } export type QrCodeService = Service; export type QrCodeMachine = Machine; export interface DownloadTriggerProps { /** * The mime type of the image. */ mimeType: DataUrlType; /** * The quality of the image. */ quality?: number | undefined; /** * The name of the file. */ fileName: string; } export interface QrCodeApi { /** * The value to encode. */ value: string; /** * Set the value to encode. */ setValue: (value: string) => void; /** * Returns the data URL of the qr code. Includes the overlay when present. */ getDataUrl: (type: DataUrlType, quality?: number) => Promise; getRootProps: () => T["element"]; getFrameProps: () => T["svg"]; getPatternProps: () => T["path"]; getOverlayProps: () => T["element"]; getDownloadTriggerProps: (props: DownloadTriggerProps) => T["button"]; } export type { QrCodeGenerateOptions, QrCodeGenerateResult };