import { FocusEventProps } from './events'; import { AnyString } from './utils'; export interface ButtonBehaviorProps extends InteractionProps, FocusEventProps { /** * The behavior of the button. * * 'submit' - Used to indicate the component acts as a submit button, meaning it submits the closest form. * 'button' - Used to indicate the component acts as a button, meaning it has no default action. * 'reset' - Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values). * * This property is ignored if the component supports `href` or `activateTarget`/`activateAction` and one of them is set. * * @default 'button' */ type?: 'submit' | 'button' | 'reset'; /** * Callback when the button is activated. * This will be called before the action indicated by `type`. */ onClick?: () => void; /** * Disables the button, meaning it cannot be clicked or receive focus. */ disabled?: boolean; /** * Replaces content with a loading indicator while a background action is being performed. * * This also disables the button. */ loading?: boolean; } export interface LinkBehaviorProps extends InteractionProps, FocusEventProps { /** * The URL to link to. * * - If set, it will navigate to the location specified by `href` after executing the `onClick` callback. * - If an `activateTarget` is set, the `activateAction` will be executed instead of the navigation. */ href?: string; /** * Specifies where to display the linked URL * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target * * 'auto' - The target is automatically determined based on the origin of the URL. Surfaces can set specific rules on how they handle each URL. * It’s expected that the behavior of `auto` is as `_self` except in specific cases. * For example, a surface could decide to open cross-origin URLs in a new window (as `_blank`). * * @default 'auto' */ target?: 'auto' | '_blank' | '_self' | '_parent' | '_top' | AnyString; /** * Causes the browser to treat the linked URL as a download with the string being the file name. * Download only works for same-origin URLs, or the blob: and data: schemes. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download */ download?: string; /** * Callback when the link is activated. * This will be called before navigating to the location specified by `href`. */ onClick?: () => void; } export interface InteractionProps { /** * ID of a component that should respond to activations (e.g. clicks) on this clickable. * * See `activateAction` for how to control the behavior of the target. */ activateTarget?: string; /** * Sets the action the `activateTarget` should take when this clickable is activated. * * See the documentation of particular components for the actions they support. * * @default 'auto' - a default action for the target component. */ activateAction?: 'auto' | 'show' | 'hide' | 'toggle' | 'copy'; } export interface BaseClickableProps extends ButtonBehaviorProps, LinkBehaviorProps { }