import { EventEmitter } from "../../stencil-public-runtime"; import { A11yComponent, FormComponent, ThemeableComponent } from "../../common"; import { DuetColor, DuetIconName, DuetLanguage, DuetMargin, DuetPadding, DuetTheme } from "../../common-types"; import { DuetLangObject } from "../../utils/language-utils"; export type DuetButtonVariation = "default" | "primary" | "secondary" | "negative" | "destructive" | "destructive-primary" | "destructive-secondary" | "plain" | "input-button-primary" | "input-button-secondary" | "input-button-embedded" | "input-button-left-primary" | "input-button-left-secondary" | "square"; export type DuetButtonNegative = true | false | undefined; export type DuetButtonWrapping = "auto" | "none"; export type DuetButtonTextCentering = true | false | undefined; export type DuetButtonIconSize = "small" | "medium-small" | "medium" | "large"; export type DuetButtonSize = "x-small" | "small" | "medium"; export declare class DuetButton implements ThemeableComponent, FormComponent, A11yComponent { /** * Own Properties */ private nativeButton?; private proxyButton; /** * Reference to host HTML element. */ element: HTMLElement; /** * Adds accessible label for the button that is only shown for screen readers. * Typically, this label text replaces the visible text on the button for * users who use assistive technology. */ accessibleLabel: string; /** * Use this property to add an aria-controls attribute to the button. Use * the attribute to point to the unique id of the content that the button manages. */ accessibleControls: string; /** * Use this property to add an aria-haspopup attribute to a button, if you are using it as a menu button. */ accessiblePopup: string; /** * Indicates the id of a related component’s visually focused element. */ accessibleActiveDescendant: string; /** * Indicates the id of a component owned by the button. */ accessibleOwns: string; /** * Indicates the id of a component that describes the button. */ accessibleDescribedBy: string; /** * Details of the component */ accessibleDetails: string; /** * String of id's that indicate alternative labels elements */ accessibleLabelledBy: string; /** * Aria description the button */ accessibleDescription: string; /** * If a button expands or collapses adjacent content, then use the ariaExpanded * prop to add the aria-expanded attribute to the button. Set the value to convey * the current expanded (true) or collapsed (false) state of the content. */ accessibleExpanded: boolean; /** * Tells screen reader the element is pressed. */ accessiblePressed: boolean; /** * Loading state of the button */ loading: boolean; /** * Style variation of the button. * @negative - value is deprecated and should be used in combination with negative prop in the future * @destructive - value is deprecated and should be replace with destructive-secondary */ variation: DuetButtonVariation; /** * Negative variation, can be combined with Variation to produce negative versions */ negative: boolean; /** * Theme of the button. */ theme: DuetTheme; /** * Controls the margin of the component. */ margin: DuetMargin; /** * ID of associated form element. */ form: string; /** * Controls the padding of the plain variation button - has no effect for other variations. */ padding: DuetPadding; /** * Centers the text of a button */ centerText: DuetButtonTextCentering; /** * Controls the text wrapping. */ wrapping: DuetButtonWrapping; /** * Expands the button to fill 100% of the container width. */ expand: boolean; /** * Keep the button fixed width even on mobile viewports. */ fixed: boolean; /** * Makes the button component disabled. This prevents users from being able to * interact with the button, and conveys its inactive state to assistive technologies. */ disabled: boolean; /** * The name of the button, which gets paired with the button's value when submitted as part of a form. * Corresponds with the native HTML name attribute. */ name: string; /** * The value of the button, which gets paired with the button's name when submitted as part of a form. * Corresponds with the native HTML value attribute. */ value: string; /** * Adds a unique identifier for the button. Please note that with this particular * component this id is added inside Shadow DOM. If you need an id on the html * element, use regular id attribute instead. */ identifier: string; /** * Allows the button to submit a form. */ submit: boolean; /** * Forces URL to open in a new browser tab. Used together with URL prop. */ external: boolean; /** * @deprecated this is now handled via the html lang tag, and is no longer used - kept to avoid breaking changes and ease unit testing * @default "fi" */ language: DuetLanguage; /** * Property to change accessibleLabelExternal defaults on the component. * normally you would handle these strings on an application level and override accessibleLabelExternal when needed * @default {fi: "Avautuu uuteen ikkunaan",sv: "Öppnas i nytt fönster",en: "Opens in a new window"} */ accessibleLabelExternalDefaults: DuetLangObject | string; /** * Adds accessible label for tooltip that is shown in external link (url & external have both been set) * @default {fi: "Avautuu uuteen ikkunaan",sv: "Öppnas i nytt fönster",en: "Opens in a new window"} */ accessibleLabelExternal: string; /** * Property to change accessibleLabelLoading defaults on the component. * normally you would handle these strings on an application level and override accessibleLabelLoading when needed * @default {fi: "Ladataan",sv: "Lastning",en: "Loading…"} */ accessibleLabelLoadingDefaults: DuetLangObject | string; /** * Adds accessible label for button in "loading" state * @default {fi: "Ladataan",sv: "Lastning",en: "Loading…"} */ accessibleLabelLoading: string; /** * Icon to display to the left of the button content. * This is ignored/overridden when button is used as an external link. */ icon: DuetIconName; /** * Custom color to be used for text, as a design token entered in camelCase or * kebab-case. Example: "color-primary". */ color: DuetColor; /** * Show icon on the right side of the button content. */ iconRight: boolean; /** * Icon size. */ iconSize: DuetButtonIconSize; /** * Button’s size. */ size: DuetButtonSize; /** * Whether this button should use styles meant for displaying just an icon. */ iconOnly: boolean; /** * A destination to link to, rendered in the href attribute of a link. */ url: string; /** * Emitted when the button has focus. */ duetFocus: EventEmitter; /** * Emitted when the button loses focus. */ duetBlur: EventEmitter; /** * Component lifecycle events. */ componentWillLoad(): void; connectedCallback(): void; disconnectedCallback(): void; componentDidRender(): void; private proxyButtonSetUp; /** * Component event handling. */ private handleClick; private onFocus; private onBlur; private getButtonType; private getButtonIconSize; /** * Sets focus on the specified `duet-button`. Use this method instead of the global * `button.focus()`. */ setFocus(options?: FocusOptions): Promise; /** * render() function. * Always the last one in the class. */ render(): any; }