'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-a7b0c73d.js');
require('./ApplicationUtils-5cc05979.js');
const CSSVarsUtils = require('./CSSVarsUtils-f20973d1.js');
require('./DialogType-2114c337.js');
require('./CheckMode-ecb90b87.js');
require('@sankhyalabs/core');
const index$1 = require('./index-1be40f19.js');
require('./FormLayout-18853e70.js');

const ezSplitItemCss = ".box_split-item{background-color:var(--background--xlight);width:100%;height:100%;border-radius:var(--border--radius-medium);box-shadow:var(--shadow--xsmall);flex-direction:column;overflow:hidden;display:flex;padding:var(--space--nano)}.box_split-item>.ez-split-item--content{overflow:auto}.expanded__item{position:absolute;z-index:var(--more-visible);top:0;left:0;width:100%;height:100%}.ez-split-item--header{display:flex;align-items:center;justify-content:space-between}.ez-split-item--header-title{flex:1;white-space:nowrap;overflow:hidden}.ez-split-item--header-title h3{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.ez-split-item--header-buttons{display:flex;align-items:center;max-height:20px}.ez-split-item--content{display:block;height:100%}h3.ez-margin--small{margin-left:var(--space--small)}.structural__item{background:none;box-shadow:none;padding:0;margin:0;border:0}.content__item{margin:var(--space--extra-small);width:calc(100% - 2*(var(--space--extra-small)));height:calc(100% - 2*(var(--space--extra-small)))}";

const SplitItem = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.label = undefined;
    this.enableExpand = true;
    this._expanded = false;
    this.size = undefined;
    this.structural = false;
  }
  /**
   * Alterna a visibilidade do painel.
   */
  toggleExpandItem() {
    var _a, _b;
    this._expanded = !this._expanded;
    (_b = (_a = this.expandButtonRef.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('button')) === null || _b === void 0 ? void 0 : _b.blur();
  }
  async componentWillLoad() {
    this.i18n = await index$1.initI18n();
  }
  componentDidLoad() {
    CSSVarsUtils.CSSVarsUtils.applyVarsGrid(this._element, this._slot.children[0]);
  }
  render() {
    return (index.h(index.Host, { class: `box_split-item ${this._expanded ? 'expanded__item' : ''} ${this.structural ? 'structural__item' : 'content__item'}`, ref: el => (this._element = el) }, index.h("div", { class: "ez-split-item--header" }, index.h("slot", { name: "leftButtons" }), index.h("div", { class: "ez-split-item--header-title" }, this.label && (index.h("h3", { class: "ez-text ez-text--primary ez-title ez-title--medium ez-margin--small", title: this.label }, this.label))), index.h("div", { class: "ez-split-item--header-buttons" }, index.h("slot", { name: "rightButtons" }), this.enableExpand && (index.h("ez-button", { ref: el => this.expandButtonRef = el, size: "small", mode: "icon", iconName: "expand", class: 'ez-button--tertiary', onClick: () => this.toggleExpandItem(), title: this._expanded ? this.i18n('app.collapse') : this.i18n('app.expand') })))), index.h("div", { class: "ez-split-item--content grid_height-0", ref: el => (this._slot = el) }, index.h("slot", null))));
  }
};
SplitItem.style = ezSplitItemCss;

exports.ez_split_item = SplitItem;
