phx-react
Version:
PHX REACT
81 lines (80 loc) • 2.83 kB
TypeScript
import type React from 'react';
export type Target = '_blank' | '_self' | '_parent' | '_top';
type Falsy = boolean | undefined | null | 0;
export declare function classNames(...classes: (string | Falsy)[]): string;
export interface BaseInput {
register?: any;
errors?: any;
setError?: any;
clearErrors?: any;
}
export interface BaseButton {
/** A unique identifier for the button */
id?: string;
/** A destination to link to, rendered in the href attribute of a link */
url?: string;
/** Forces url to open in a new tab */
external?: boolean;
/** Tells the browser to download the url instead of opening it. Provides a hint for the downloaded filename if it is a string value */
download?: string | boolean;
/** Allows the button to submit a form */
submit?: boolean;
/** Disables the button, disallowing merchant interaction */
disabled?: boolean;
/** Replaces button text with a spinner while a background action is being performed */
loading?: boolean;
/** Callback when clicked */
onClick?(): unknown;
className?: string;
}
export type IconSource = React.FunctionComponent<React.SVGProps<SVGSVGElement>> | 'placeholder' | string;
export interface ComplexAction extends Action, SubmitAction, DisableableAction, DestructableAction, LoadableAction {
}
export interface MenuActionDescriptor extends ComplexAction, TooltipAction {
/** Zero-indexed numerical position. Overrides the action's order in the menu */
index?: number;
}
export interface Action {
/** A unique identifier for the action */
id?: string;
/** Content the action displays */
content?: string;
/** Visually hidden text for screen readers */
accessibilityLabel?: string;
/** A destination to link to, rendered in the action */
url?: string;
/** Forces url to open in a new tab */
external?: boolean;
/** Where to display the url */
target?: Target;
/** Action loading */
loading?: boolean;
/** Callback when an action takes place */
onClick?(): void;
onDelete?(): void;
/** Callback when mouse enter */
onMouseEnter?(): void;
/** Callback when element is touched */
onTouchStart?(): void;
}
export interface DisableableAction extends Action {
/** Whether or not the action is disabled */
disabled?: boolean;
}
export interface SubmitAction extends Action {
/** Whether or not the action is disabled */
submit?: boolean;
}
export interface DestructableAction extends Action {
/** Destructive action */
destructive?: boolean;
}
export interface LoadableAction extends Action {
/** Should a spinner be displayed */
loading?: boolean;
}
export interface TooltipAction {
/** Text content to render in a tooltip */
helpText?: React.ReactNode;
}
export {};