var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { h } from '@stencil/core';
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import { VegaInternalIconManager } from '../../../../../helpers/icon/internal-icon-manager';
import chevronDown from '../../../../../global/icons/chevron-down';
export class VegaRichTextEditorToolbarButtonRenderer extends VegaSlimmer {
  constructor() {
    super(...arguments);
    this.handleClick = (e) => {
      if (this.disabled) {
        e.preventDefault();
      }
      else {
        this.clickEventEmitter.emit(undefined, e);
      }
    };
  }
  render() {
    return (h("button", { part: "rich-text-editor-toolbar-button", class: {
        'rich-text-editor-toolbar-btn': true,
        'rich-text-editor-toolbar-button-disabled': this.disabled,
        'rich-text-editor-toolbar-button-hidden': this.hidden,
        'rich-text-editor-toolbar-button-selected': this.selected,
      }, onClick: this.handleClick, disabled: this.disabled, hidden: this.hidden },
      h("vega-flex", { gap: "size-8", justifyContent: "center", alignItems: "center" },
        this.icon && (h("vega-icon", { size: "size-16", color: this.iconColor, icon: VegaInternalIconManager.getIconKey(this.icon) })),
        this.showArrowIcon && (h("vega-icon", { size: "size-8", color: "text-secondary", icon: VegaInternalIconManager.getIconKey('chevron-down') }))),
      h("slot", null)));
  }
}
(() => {
  VegaInternalIconManager.register({
    'chevron-down': chevronDown,
  });
})();
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "disabled", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "hidden", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "selected", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "showArrowIcon", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "icon", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "iconColor", void 0);
__decorate([
  MapToComponentField()
], VegaRichTextEditorToolbarButtonRenderer.prototype, "clickEventEmitter", void 0);
