import AWCElement from '../../internal/awc-element.js'; import AWCIcon from '../icon/icon.component.js'; import AWCSpinner from '../spinner/spinner.component.js'; import type { AWCFormControl } from '../../internal/awc-element.js'; import type { CSSResultGroup } from 'lit'; /** * @summary Buttons represent actions that are available to the user. * @documentation https://webcomponents.adeliom.io/?path=/docs/components-button--documentation * @status stable * @since 1.0 * * @dependency awc-icon * @dependency awc-spinner * * @event awc-blur - Emitted when the button loses focus. * @event awc-focus - Emitted when the button gains focus. * @event awc-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * * @slot - 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 `` element. * @csspart spinner - The spinner that shows when the button is in the loading state. */ export default class AWCButton extends AWCElement implements AWCFormControl { static styles: CSSResultGroup; static dependencies: { 'awc-icon': typeof AWCIcon; 'awc-spinner': typeof AWCSpinner; }; private readonly formControlController; private readonly hasSlotController; private readonly localize; button: HTMLButtonElement | HTMLLinkElement; private hasFocus; invalid: boolean; title: string; /** The button's theme variant. */ variant: 'default' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'neutral' | 'warning' | 'danger' | 'ghost' | 'text' | 'link'; /** The button's size. */ size: 'small' | 'medium' | 'large'; /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */ caret: boolean; /** Disables the button. */ disabled: boolean; /** Draws the button in a loading state. */ loading: boolean; /** Draws an outlined button. */ outline: boolean; /** Draws an colored button. */ colored: boolean; /** Draws a pill-style button with rounded edges. */ pill: boolean; /** * Draws a icon button with the corresponding shape. When this attribute is present, the button expects a single `` in the * default slot. */ icon?: 'circle' | 'square'; /** * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native * `