UNPKG

@ark-ui/solid

Version:

A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.

36 lines (32 loc) 1.26 kB
import { JSX } from 'solid-js'; import { HTMLProps, PolymorphicProps } from '../factory.js'; import { FileMimeType } from '@zag-js/file-utils'; import { a as MaybePromise, M as MaybeAccessor } from '../../types-Sr_80hg9.js'; type DownloadableData = string | Blob | File; interface UseDownloadProps { /** * The name of the file to download */ fileName: string; /** * The MIME type of the data to download */ mimeType: FileMimeType; /** * The data to download */ data: DownloadableData | (() => MaybePromise<DownloadableData>); } interface UseDownloadReturn { /** * Triggers the download, resolving `data` first if it's a function or promise. */ download: () => void; } declare const useDownload: (props: MaybeAccessor<UseDownloadProps>) => UseDownloadReturn; interface DownloadTriggerBaseProps extends PolymorphicProps<'button'>, UseDownloadProps { } interface DownloadTriggerProps extends HTMLProps<'button'>, DownloadTriggerBaseProps { } declare function DownloadTrigger(props: DownloadTriggerProps): JSX.Element; export { DownloadTrigger, type DownloadTriggerBaseProps, type DownloadTriggerProps, type DownloadableData, type UseDownloadProps, type UseDownloadReturn, useDownload };