import { CortexFormControl, default as CortexElement } from '../../../../base/src/cortex-element.ts';
import { ButtonCaretDirection, ButtonSize, ButtonVariant, ButtonWidthType } from '../../../../types/src/button';
import { CSSResultGroup } from 'lit';
import { default as CxIcon } from '../icon/icon';
import { default as CxSpinner } from '../spinner/spinner';

/**
 * @summary Button represent actions that are available to the user.
 *
 * @event cx-blur - Emitted when the button loses focus.
 * @event cx-focus - Emitted when the button gains focus.
 * @event cx-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
 *
 * @slot (default) - The button's label.
 * @slot prefix - A presentational prefix icon or similar element.
 * @slot suffix - A presentational suffix icon or similar element.
 *
 * @csspart base - The component's base wrapper.
 * @csspart prefix - The container that wraps the prefix.
 * @csspart label - The button's label.
 * @csspart suffix - The container that wraps the suffix.
 * @csspart caret - The button's caret icon, an `<cx-icon>` element.
 * @csspart spinner - The spinner that shows when the button is in the loading state.
 *
 * @cssproperty [--font-weight] - Overrides the label font weight (defaults to regular).
 * @cssproperty [--min-height] - Sets `min-height` on the inner button (defaults to `auto`).
 * @cssproperty [--justify-content] - Flex alignment along the main axis (defaults to `center`).
 * @cssproperty [--gap] - Gap between flex items in the button (defaults to `0`).
 */
export default class CxButton extends CortexElement implements CortexFormControl {
    static readonly styles: CSSResultGroup;
    static readonly dependencies: {
        'cx-icon': typeof CxIcon;
        'cx-spinner': typeof CxSpinner;
    };
    private readonly formControlController;
    private readonly hasSlotController;
    private readonly localize;
    protected forceButtonNavigation: boolean;
    button: HTMLButtonElement | HTMLLinkElement;
    private hasFocus;
    invalid: boolean;
    private isParentDropdownOpened;
    title: string;
    /** The button's theme variant. */
    variant: ButtonVariant;
    /** The button's size. */
    size: ButtonSize;
    /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */
    caret: boolean;
    /** Direction of the caret. */
    caretDirection: ButtonCaretDirection;
    /** Disables the button. */
    disabled: boolean;
    /** Draws the button in a loading state. */
    loading: boolean;
    /** Draws an outlined button. */
    outline: boolean;
    /** Draws a pill-style button with rounded edges. */
    pill: boolean;
    /**
     * Draws a circular icon button. When this attribute is present, the button expects a single `<cx-icon>` in the
     * default slot.
     */
    circle: boolean;
    /**
     * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native
     * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.
     */
    type: 'button' | 'submit' | 'reset';
    /**
     * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.
     * This attribute is ignored when `href` is present.
     */
    name: string;
    /**
     * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this
     * button is the submitter. This attribute is ignored when `href` is present.
     */
    value: string;
    /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */
    href: string;
    /**
     *  Override href property
     *  [Use]: When need bubble up click event to do something but not want to navigate
     *  [Use]: When handle extra navigation logic on click event in handleClick function
     *  [Reason]: Bubble up click event meet href property in cx-button will cause navigation
     * */
    link: string;
    /** Tells the browser where to open the link. Only used when `href` is present. */
    target: '_blank' | '_parent' | '_self' | '_top';
    /**
     * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the
     * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a
     * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by
     * setting the attribute to an empty string or a value of your choice, respectively.
     */
    rel: string;
    /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */
    download?: string;
    /**
     * The "form owner" to associate the button with. If omitted, the closest containing form will be used instead. The
     * value of this attribute must be an id of a form in the same document or shadow root as the button.
     */
    form: string | HTMLElement | undefined;
    /** Used to override the form owner's `action` attribute. */
    formAction: string;
    /** Used to override the form owner's `enctype` attribute.  */
    formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
    /** Used to override the form owner's `method` attribute.  */
    formMethod: 'post' | 'get';
    /** Used to override the form owner's `novalidate` attribute. */
    formNoValidate: boolean;
    /** Used to override the form owner's `target` attribute. */
    formTarget: '_self' | '_blank' | '_parent' | '_top' | string;
    /**
     * The width type of the button.
     */
    widthType: ButtonWidthType;
    /**
     * Button label.
     */
    label: string;
    /**
     * Mapped button label.
     */
    mappedLabel: string;
    private styleObserver;
    private parentDropdownObserver;
    /** Gets the validity state object */
    get validity(): ValidityState;
    /** Gets the validation message */
    get validationMessage(): string;
    get hasPrefix(): boolean;
    get hasSuffix(): boolean;
    get hasLabel(): boolean;
    runFirstUpdated(): void;
    connectedUpdatedCallback(): void;
    disconnectedCallback(): void;
    syncStyles(): void;
    private handleBlur;
    private handleFocus;
    handleClick(event: MouseEvent): void;
    private handleInvalid;
    private isButton;
    private isLink;
    handleLabelSlotChange(): void;
    handleDisabledChange(): void;
    /** Simulates a click on the button. */
    click(): void;
    /** Sets focus on the button. */
    focus(options?: FocusOptions): void;
    /** Removes focus from the button. */
    blur(): void;
    /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
    checkValidity(): boolean;
    /** Gets the associated form, if one exists. */
    getForm(): HTMLFormElement | null;
    /** Checks for validity and shows the browser's validation message if the control is invalid. */
    reportValidity(): boolean;
    /** Sets a custom validation message. Pass an empty string to restore validity. */
    setCustomValidity(message: string): void;
    protected renderLabel(): import('lit').TemplateResult;
    render(): import('lit').TemplateResult;
}
declare global {
    interface HTMLElementTagNameMap {
        'cx-button': CxButton;
    }
}
