import { ElementIDUtils } from '@sankhyalabs/core';
import { h, Host } from '@stencil/core';
import initI18n from '../../utils/i18n';
const ANIMATION_TIMINGS = {
  PRESSED_DURATION: 150,
  RIPPLE_DURATION: 600
};
/**
 * Split Button Component
 *
 * @example
 * ```html
 * <ez-split-button
 *   label="Save"
 *   mode="icon-left"
 *   left-icon-name="save"
 *   size="medium"
 *   variant="primary">
 * </ez-split-button>
 * ```
 *
 * @fires buttonClick - Emitido quando o botão principal é clicado
 * @fires dropdownItemClick - Emitido quando um botão do dropdown é clicado
 * @fires dropdownSubActionClick - Emitido quando uma subação de um item do dropdown é clicada
 */
export class EzSplitButton {
  constructor() {
    this.rippleCounter = 0;
    this.eventListeners = new WeakMap();
    this.createRipple = (event, isLeftButton) => {
      const button = isLeftButton ? this.leftButton : this.rightButton;
      if (!button || this.isButtonDisabled || this.suppressAnimation)
        return;
      const coordinates = this.getEventCoordinates(event);
      const rect = button.getBoundingClientRect();
      const ripplePosition = {
        x: coordinates.x - rect.left,
        y: coordinates.y - rect.top
      };
      const newRipple = Object.assign(Object.assign({}, ripplePosition), { id: ++this.rippleCounter });
      this.addRippleToButton(newRipple, isLeftButton);
    };
    /**
     * Método responsável em posicionar o dropdown na tela.
     * Faz com que o dropdown se ajuste automaticamente ao espaco na tela
     */
    this.positionDropdown = () => {
      if (!this.rightButton || !this.dropdownParent)
        return;
      requestAnimationFrame(() => {
        const { rightButton, dropdownParent } = this;
        const rightButtonRect = rightButton.getBoundingClientRect();
        const dropdownRect = dropdownParent.getBoundingClientRect();
        const viewportHeight = window.innerHeight;
        const viewportWidth = window.innerWidth;
        // Calcule posições de forma mais eficiente
        const spaceBelow = viewportHeight - rightButtonRect.bottom;
        const spaceAbove = rightButtonRect.top;
        const spaceRight = viewportWidth - rightButtonRect.left;
        const spaceLeft = rightButtonRect.left;
        const shouldOpenUpward = spaceBelow < dropdownRect.height && spaceAbove > dropdownRect.height;
        const shouldOpenLeftward = spaceRight < dropdownRect.width && spaceLeft > dropdownRect.width;
        const styles = this.calculateDropdownPosition(rightButtonRect, dropdownRect, shouldOpenUpward, shouldOpenLeftward);
        Object.assign(dropdownParent.style, styles);
      });
    };
    this.removeForcedFocusVisibleLeft = () => {
      var _a;
      (_a = this.leftButton) === null || _a === void 0 ? void 0 : _a.classList.remove('force-focus-visible');
    };
    this.removeForcedFocusVisibleRight = () => {
      var _a;
      (_a = this.rightButton) === null || _a === void 0 ? void 0 : _a.classList.remove('force-focus-visible');
    };
    this.leftRipples = [];
    this.rightRipples = [];
    this.isLeftPressed = false;
    this.isRightPressed = false;
    this.show = false;
    this.enabled = true;
    this.isDisabled = false;
    this.iconName = undefined;
    this.leftIconName = undefined;
    this.rightIconName = undefined;
    this.image = undefined;
    this.items = undefined;
    this.label = undefined;
    this.leftTitle = undefined;
    this.rightTitle = undefined;
    this.mode = 'default';
    this.size = 'medium';
    this.variant = undefined;
    this.suppressAnimation = false;
    this.itemBuilder = undefined;
  }
  /**
   * Remove o foco de ambos os botões.
   */
  async setBlur() {
    this.leftButton.blur();
    this.rightButton.blur();
  }
  /**
   * Aplica o foco no botão principal.
   */
  async setLeftButtonFocus() {
    this.leftButton.focus();
    this.leftButton.classList.add("force-focus-visible");
  }
  /**
   * Aplica o foco no botão do dropdown.
  */
  async setRightButtonFocus() {
    this.rightButton.focus();
    this.rightButton.classList.add("force-focus-visible");
  }
  /**
   * Abre ou Fecha o dropdown do Split Button.
   */
  async toggleDropdown() {
    this.show = !this.show;
  }
  /**
   * Informa se a lista de ações está aberta.
   */
  async isOpenedDropdown() {
    return this.show;
  }
  getEventCoordinates(event) {
    if (event instanceof MouseEvent) {
      return { x: event.clientX, y: event.clientY };
    }
    return {
      x: event.touches[0].clientX,
      y: event.touches[0].clientY
    };
  }
  addRippleToButton(ripple, isLeftButton) {
    if (isLeftButton) {
      this.leftRipples = [...this.leftRipples, ripple];
      this.setButtonPressed(true, true);
      this.scheduleRippleCleanup(ripple, true);
    }
    else {
      this.rightRipples = [...this.rightRipples, ripple];
      this.setButtonPressed(false, true);
      this.scheduleRippleCleanup(ripple, false);
    }
  }
  setButtonPressed(isLeftButton, pressed) {
    if (isLeftButton) {
      this.isLeftPressed = pressed;
    }
    else {
      this.isRightPressed = pressed;
    }
  }
  scheduleRippleCleanup(ripple, isLeftButton) {
    setTimeout(() => {
      this.setButtonPressed(isLeftButton, false);
    }, ANIMATION_TIMINGS.PRESSED_DURATION);
    setTimeout(() => {
      this.removeRipple(ripple.id, isLeftButton);
    }, ANIMATION_TIMINGS.RIPPLE_DURATION);
  }
  removeRipple(rippleId, isLeftButton) {
    if (isLeftButton) {
      this.leftRipples = this.leftRipples.filter(ripple => ripple.id !== rippleId);
    }
    else {
      this.rightRipples = this.rightRipples.filter(ripple => ripple.id !== rippleId);
    }
  }
  onMouseDown(event) {
    const composedPath = event.composedPath();
    const isLeftButton = composedPath.includes(this.leftButton);
    const isRightButton = composedPath.includes(this.rightButton);
    if (isLeftButton) {
      this.createRipple(event, true);
      return;
    }
    if (isRightButton) {
      this.createRipple(event, false);
      return;
    }
  }
  onTouchStart(event) {
    const composedPath = event.composedPath();
    const isLeftButton = composedPath.includes(this.leftButton);
    const isRightButton = composedPath.includes(this.rightButton);
    if (isLeftButton) {
      this.createRipple(event, true);
      return;
    }
    if (isRightButton) {
      this.createRipple(event, false);
      return;
    }
  }
  clickListener(evt) {
    const isDisabled = !this.enabled ||
      this.isDisabled === true ||
      this.isDisabled === "" ||
      this.isDisabled === "full";
    if (isDisabled) {
      evt.preventDefault();
      evt.stopPropagation();
      evt.stopImmediatePropagation();
    }
  }
  shouldShowLabelOnLeftButton() {
    return this.mode !== 'icon-only';
  }
  shouldShowIconOnLeftButton() {
    return this.mode !== 'default';
  }
  getIconSize(defaultSize = 'medium') {
    var _a;
    const validSizes = ['small', 'medium', 'large'];
    const sizeLowerCase = (_a = this.size) === null || _a === void 0 ? void 0 : _a.toLowerCase();
    return validSizes.includes(sizeLowerCase) ? sizeLowerCase : defaultSize;
  }
  closeDropdown() {
    this.show = false;
  }
  handleButtonClick() {
    this.buttonClick.emit();
  }
  handleDropdownItemClick(evt) {
    this.dropdownItemClick.emit(evt.detail);
    evt.stopPropagation();
    this.closeDropdown();
  }
  handleDropdownSubActionClick(evt) {
    this.dropdownSubActionClick.emit(evt.detail);
    evt.stopPropagation();
    this.closeDropdown();
  }
  calculateDropdownPosition(buttonRect, dropdownRect, openUpward, openLeftward) {
    const baseOffset = this.offsetParentRect || { top: 0, left: 0 };
    return {
      top: openUpward ? 'auto' : `${buttonRect.bottom - baseOffset.top + window.scrollY}px`,
      bottom: openUpward ? `${window.innerHeight - buttonRect.top - window.scrollY}px` : 'auto',
      left: openLeftward
        ? `${buttonRect.right - dropdownRect.width - baseOffset.left + window.scrollX}px`
        : `${buttonRect.left - baseOffset.left + window.scrollX}px`,
      maxHeight: openUpward ? `${buttonRect.top - baseOffset.top}px` : 'none'
    };
  }
  setupEventListeners() {
    const controller = new AbortController();
    const { signal } = controller;
    window.addEventListener('scroll', this.positionDropdown, { signal, passive: true });
    window.addEventListener('resize', this.positionDropdown, { signal, passive: true });
    this.eventListeners.set(this._element, controller);
  }
  cleanupEventListeners() {
    const controller = this.eventListeners.get(this._element);
    if (controller) {
      controller.abort();
      this.eventListeners.delete(this._element);
    }
  }
  async componentWillLoad() {
    this.i18n = await initI18n();
  }
  componentDidLoad() {
    this.addElementIDs();
    this.setupEventListeners();
    this.addBlurListeners();
    setTimeout(() => this.positionDropdown(), 0);
  }
  disconnectedCallback() {
    this.cleanupEventListeners();
    this.removeBlurListeners();
  }
  componentDidUpdate() {
    if (this.show) {
      this.positionDropdown();
    }
  }
  addElementIDs() {
    if (this._element) {
      ElementIDUtils.addIDInfo(this._element);
    }
    if (this.leftButton) {
      ElementIDUtils.addIDInfo(this.leftButton, 'leftButton', { id: 'embedded' });
    }
    if (this.rightButton) {
      ElementIDUtils.addIDInfo(this.rightButton, 'rightButton', { id: 'embedded' });
    }
  }
  renderRipples(ripples) {
    return ripples.map((ripple) => (h("span", { key: ripple.id, class: "ripple", style: {
        left: `${ripple.x - 10}px`,
        top: `${ripple.y - 10}px`,
      } })));
  }
  render() {
    const hasIconButton = this.shouldShowIconOnLeftButton();
    const hasLabelButton = this.shouldShowLabelOnLeftButton();
    const iconSize = this.getIconSize();
    return (h(Host, { class: this.variant ? `ez-split-button--${this.variant}` : '' }, h("div", { class: `ez-split-button ${this.size} ${this.mode}` }, this.renderLeftButton(hasIconButton, hasLabelButton, iconSize), this.renderDivider(), this.renderDropdownSection(iconSize))));
  }
  renderLeftButton(hasIconButton, hasLabelButton, iconSize) {
    return (h("button", { class: `ez-split-button__left-button ${iconSize} ${this.mode} ${this.isLeftPressed ? 'pressed' : ''}`, title: this.leftTitle || this.label, type: "button", disabled: this.isButtonDisabled, "aria-disabled": this.isButtonAriaDisabled, onClick: () => this.handleButtonClick(), ref: el => (this.leftButton = el) }, hasIconButton && this.renderLeftIcon(iconSize), hasLabelButton && this.renderLabel(), !this.suppressAnimation && this.renderRipples(this.leftRipples)));
  }
  renderDivider() {
    return h("div", { class: `ez-split-button__divider ${this.mode} ez-split-button__divider--${this.size} ${this.isButtonDisabled ? 'disabled' : ''}`, "aria-disabled": this.isButtonAriaDisabled });
  }
  renderDropdownSection(iconSize) {
    return (h("div", { class: "dropdown" }, this.renderRightButton(iconSize), this.renderDropdownContent()));
  }
  renderRightButton(iconSize) {
    return (h("button", { class: `ez-split-button__right-button ${iconSize} ez-split-button__right-button--${iconSize} ${this.isRightPressed ? 'pressed' : ''}`, title: this.rightTitle || this.i18n("ez-split-button.moreOptions"), type: "button", disabled: this.isButtonDisabled, "aria-disabled": this.isButtonAriaDisabled, onClick: () => this.toggleDropdown(), ref: el => (this.rightButton = el) }, this.renderRightIcon(iconSize), !this.suppressAnimation && this.renderRipples(this.rightRipples)));
  }
  renderDropdownContent() {
    return (h("div", { class: `dropdown-content dropdown-content--${this.size}`, ref: (ref) => (this.dropdownParent = ref) }, this.show && this.renderDropdown()));
  }
  renderLeftIcon(iconSize) {
    return (h("ez-icon", { href: this.image, iconName: this.leftIconName || this.iconName, size: iconSize }));
  }
  renderLabel() {
    return h("label", { title: this.leftTitle || this.label }, this.label);
  }
  renderRightIcon(iconSize) {
    const iconName = this.rightIconName || 'chevron-down';
    const containerClass = `ez-split-button__right-button-container ${iconSize ? `btn-icon--${iconSize}` : ''}`;
    return (h("ez-icon", { class: containerClass, iconName: iconName, size: iconSize }));
  }
  renderDropdown() {
    return (h("ez-dropdown", { items: this.items, onClick: evt => evt.stopPropagation(), onEzOutsideClick: () => this.closeDropdown(), onEzClick: evt => this.handleDropdownItemClick(evt), onEzSubActionClick: evt => this.handleDropdownSubActionClick(evt), itemBuilder: this.itemBuilder }));
  }
  addBlurListeners() {
    var _a, _b;
    this.removeBlurListeners();
    (_a = this.leftButton) === null || _a === void 0 ? void 0 : _a.addEventListener('blur', this.removeForcedFocusVisibleLeft);
    (_b = this.rightButton) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.removeForcedFocusVisibleRight);
  }
  removeBlurListeners() {
    var _a, _b;
    (_a = this.leftButton) === null || _a === void 0 ? void 0 : _a.removeEventListener('blur', this.removeForcedFocusVisibleLeft);
    (_b = this.rightButton) === null || _b === void 0 ? void 0 : _b.removeEventListener('blur', this.removeForcedFocusVisibleRight);
  }
  connectedCallback() {
    this.addBlurListeners();
  }
  get isButtonDisabled() {
    return this.isDisabled === "full" || !this.enabled;
  }
  get isButtonAriaDisabled() {
    return this.isDisabled === true || this.isDisabled === "";
  }
  static get is() { return "ez-split-button"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["ez-split-button.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["ez-split-button.css"]
    };
  }
  static get properties() {
    return {
      "show": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Se true, o dropdown do bot\u00E3o \u00E9 exibido."
        },
        "attribute": "show",
        "reflect": true,
        "defaultValue": "false"
      },
      "enabled": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "deprecated",
              "text": "Use `isDisabled` prop instead."
            }],
          "text": "Se false o usu\u00E1rio n\u00E3o pode interagir com o bot\u00E3o."
        },
        "attribute": "enabled",
        "reflect": true,
        "defaultValue": "true"
      },
      "isDisabled": {
        "type": "any",
        "mutable": false,
        "complexType": {
          "original": "boolean | \"full\" | \"\"",
          "resolved": "\"\" | \"full\" | boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Se verdadeiro o clique no bot\u00E3o fica desabilitado mas a navega\u00E7\u00E3o continua funcional.\nSe full, o usu\u00E1rio n\u00E3o pode interagir com o bot\u00E3o."
        },
        "attribute": "is-disabled",
        "reflect": true,
        "defaultValue": "false"
      },
      "iconName": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "deprecated",
              "text": "Use `leftIconName` prop instead."
            }],
          "text": "Define o \u00EDcone a ser usado da biblioteca de \u00EDcones: [ez-icons](https://gilded-nasturtium-6b64dd.netlify.app/docs/components/layout-doc/icons/)"
        },
        "attribute": "icon-name",
        "reflect": true
      },
      "leftIconName": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o \u00EDcone esquerdo a ser usado da biblioteca de \u00EDcones: [ez-icons](https://gilded-nasturtium-6b64dd.netlify.app/docs/components/layout-doc/icons/)"
        },
        "attribute": "left-icon-name",
        "reflect": true
      },
      "rightIconName": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o \u00EDcone direito a ser usado da biblioteca de \u00EDcones: [ez-icons](https://gilded-nasturtium-6b64dd.netlify.app/docs/components/layout-doc/icons/)"
        },
        "attribute": "right-icon-name",
        "reflect": true
      },
      "image": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o caminho usado nos modos `icon-only` e `icon-left` para imagens n\u00E3o contempladas na biblioteca de \u00EDcones."
        },
        "attribute": "image",
        "reflect": true
      },
      "items": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<IDropdownItem>",
          "resolved": "IDropdownItem[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "IDropdownItem": {
              "location": "import",
              "path": "../ez-dropdown/structure/DropdownItem"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o conte\u00FAdo do dropdown."
        }
      },
      "label": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Texto a ser apresentado como label do bot\u00E3o."
        },
        "attribute": "label",
        "reflect": true
      },
      "leftTitle": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Texto a ser apresentado como title do bot\u00E3o principal"
        },
        "attribute": "left-title",
        "reflect": true
      },
      "rightTitle": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Texto a ser apresentado como title do bot\u00E3o dropdown"
        },
        "attribute": "right-title",
        "reflect": true
      },
      "mode": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "ButtonMode",
          "resolved": "\"default\" | \"icon-left\" | \"icon-only\"",
          "references": {
            "ButtonMode": {
              "location": "global"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o modo de uso do bot\u00E3o."
        },
        "attribute": "mode",
        "reflect": true,
        "defaultValue": "'default'"
      },
      "size": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "ButtonSize",
          "resolved": "\"large\" | \"medium\" | \"small\"",
          "references": {
            "ButtonSize": {
              "location": "global"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o tamanho do ez-split-button."
        },
        "attribute": "size",
        "reflect": true,
        "defaultValue": "'medium'"
      },
      "variant": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "\"primary\" | \"secondary\" | \"tertiary\"",
          "resolved": "\"primary\" | \"secondary\" | \"tertiary\"",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Define a variante do ez-split-button."
        },
        "attribute": "variant",
        "reflect": true
      },
      "suppressAnimation": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Se verdadeiro, desabilita a anima\u00E7\u00E3o de ripple."
        },
        "attribute": "suppress-animation",
        "reflect": true,
        "defaultValue": "false"
      },
      "itemBuilder": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "(item: IDropdownItem, level: number) => HTMLElement | string",
          "resolved": "(item: IDropdownItem, level: number) => string | HTMLElement",
          "references": {
            "IDropdownItem": {
              "location": "import",
              "path": "../ez-dropdown/structure/DropdownItem"
            },
            "HTMLElement": {
              "location": "global"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Fun\u00E7\u00E3o builder que possibilita alterar como o item da lista vai ser apresentado.\nObserva\u00E7\u00E3o: No react ele se transforma em VNode e n\u00E3o como HTMLElement."
        }
      }
    };
  }
  static get states() {
    return {
      "leftRipples": {},
      "rightRipples": {},
      "isLeftPressed": {},
      "isRightPressed": {}
    };
  }
  static get events() {
    return [{
        "method": "buttonClick",
        "name": "buttonClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando o bot\u00E3o principal \u00E9 clicado"
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }, {
        "method": "dropdownItemClick",
        "name": "dropdownItemClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando um item do dropdown \u00E9 clicado"
        },
        "complexType": {
          "original": "IDropdownItem",
          "resolved": "IDropdownItem",
          "references": {
            "IDropdownItem": {
              "location": "import",
              "path": "../ez-dropdown/structure/DropdownItem"
            }
          }
        }
      }, {
        "method": "dropdownSubActionClick",
        "name": "dropdownSubActionClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando uma subAction de um item do dropdown \u00E9 clicada"
        },
        "complexType": {
          "original": "IDropdownSubAction",
          "resolved": "IDropdownSubAction",
          "references": {
            "IDropdownSubAction": {
              "location": "import",
              "path": "../ez-dropdown/structure/DropdownItem"
            }
          }
        }
      }];
  }
  static get methods() {
    return {
      "setBlur": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Remove o foco de ambos os bot\u00F5es.",
          "tags": []
        }
      },
      "setLeftButtonFocus": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Aplica o foco no bot\u00E3o principal.",
          "tags": []
        }
      },
      "setRightButtonFocus": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Aplica o foco no bot\u00E3o do dropdown.",
          "tags": []
        }
      },
      "toggleDropdown": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Abre ou Fecha o dropdown do Split Button.",
          "tags": []
        }
      },
      "isOpenedDropdown": {
        "complexType": {
          "signature": "() => Promise<boolean>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<boolean>"
        },
        "docs": {
          "text": "Informa se a lista de a\u00E7\u00F5es est\u00E1 aberta.",
          "tags": []
        }
      }
    };
  }
  static get elementRef() { return "_element"; }
  static get listeners() {
    return [{
        "name": "mousedown",
        "method": "onMouseDown",
        "target": undefined,
        "capture": false,
        "passive": true
      }, {
        "name": "touchstart",
        "method": "onTouchStart",
        "target": undefined,
        "capture": false,
        "passive": true
      }, {
        "name": "click",
        "method": "clickListener",
        "target": undefined,
        "capture": true,
        "passive": false
      }];
  }
}
