@loadsmart/miranda-wc
Version:
Miranda Web Components component library
136 lines (135 loc) • 4.6 kB
TypeScript
import type { PropertyValues } from 'lit';
import { Component } from '../component';
import type { FormComponentProps } from '../component';
import '../dots-loader';
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger' | 'icon' | 'icon-secondary';
export type ButtonSize = 'small' | 'default' | 'large';
export type ButtonType = HTMLButtonElement['type'];
export type ButtonTarget = HTMLAnchorElement['target'];
export interface ButtonProps extends FormComponentProps {
loading?: boolean;
size?: ButtonSize;
type?: ButtonType;
variant?: ButtonVariant;
href?: string;
download?: string;
target?: ButtonTarget;
formaction?: HTMLButtonElement['formAction'];
formenctype?: HTMLButtonElement['formEnctype'];
formmethod?: HTMLButtonElement['formMethod'];
formnovalidate?: HTMLButtonElement['formNoValidate'];
formtarget?: HTMLButtonElement['formTarget'];
}
declare const Button_base: import("../../utils/types").Constructor<import("../component/form-component.mixin").WithFormComponentMixinInterface> & typeof Component;
export declare class Button extends Button_base implements ButtonProps {
#private;
static shadowRootOptions: {
delegatesFocus: boolean;
mode: ShadowRootMode;
serializable?: boolean;
slotAssignment?: SlotAssignmentMode;
};
static styles: import("lit").CSSResult[][];
static get properties(): {
loading: {
type: BooleanConstructor;
reflect: boolean;
};
variant: {
type: StringConstructor;
reflect: boolean;
};
size: {
type: StringConstructor;
reflect: boolean;
};
type: {
type: StringConstructor;
reflect: boolean;
};
formaction: {
type: StringConstructor;
};
formenctype: {
type: StringConstructor;
};
formmethod: {
type: StringConstructor;
};
formnovalidate: {
type: BooleanConstructor;
};
formtarget: {
type: StringConstructor;
};
href: {
type: StringConstructor;
reflect: boolean;
};
target: {
type: StringConstructor;
};
download: {
type: StringConstructor;
};
};
/**
* The button is waiting for some operation to be finished.
*/
loading: ButtonProps['loading'];
/**
* Button variant.
*/
variant: ButtonProps['variant'];
/**
* Button size.
*/
size: ButtonProps['size'];
/**
* Specifies the type of button.
*/
type: ButtonProps['type'];
/**
* When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`.
*/
href: ButtonProps['href'];
/**
* Tell the browser where to open the link. Only used when `href` is set.
* */
target: ButtonProps['target'];
/**
* Causes the browser to treat the linked URL as a download. Only used when `href` is set.
*/
download: ButtonProps['download'];
/**
* The <form> element to associate the component with (its form owner). The value of
* this attribute must be the id of a <form> in the same document. (If this attribute
* is not set, the component is associated with its ancestor <form> element, if any).
* This is useful only when the component has a specific behavior related to form submission.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form|MDN docs, button}
*/
form: ButtonProps['form'];
formaction: ButtonProps['formaction'];
formenctype: ButtonProps['formenctype'];
formmethod: ButtonProps['formmethod'];
formnovalidate: ButtonProps['formnovalidate'];
formtarget: ButtonProps['formtarget'];
static define(): void;
constructor();
connectedCallback(): void;
disconnectedCallback(): void;
protected updated(changedProperties: PropertyValues<this>): void;
renderContent(): import("lit-html").TemplateResult<1>;
renderAsButton(): import("lit-html").TemplateResult<1>;
renderAsLink(): import("lit-html").TemplateResult<1>;
render(): import("lit-html").TemplateResult<1>;
get button(): HTMLButtonElement | null;
get anchor(): HTMLAnchorElement | null;
formDisabledCallback(disabled: boolean): void;
}
declare global {
interface HTMLElementTagNameMap {
'm-button': Button;
}
}
export {};