import { html } from 'lit';
import { property } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { boolean } from '../../internal/boolean.mjs';
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
import { watch } from '../../internal/watch.mjs';
import styles from './tab-panel.styles.mjs';

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};
let id = 0;
class FlowUiTabPanel extends FlowRdfElement {
  constructor() {
    super(...arguments);
    this.attrId = ++id;
    this.componentId = `flow-ui-tab-panel-${this.attrId}`;
    this.name = "";
    this.active = false;
    this.scrollable = false;
    this.padding = false;
  }
  connectedCallback() {
    super.connectedCallback();
    this.active = boolean(this.active, true);
    this.scrollable = boolean(this.scrollable, true);
    this.padding = boolean(this.padding, true);
    this.id = this.id.length > 0 ? this.id : this.componentId;
    this.setAttribute("role", "tabpanel");
  }
  handleActiveChange() {
    this.setAttribute("aria-hidden", this.active ? "false" : "true");
  }
  render() {
    return html`
      <div
        class=${classMap({
      panel: true,
      "panel--active": this.active,
      "panel--scrollable": this.scrollable,
      "panel--with-padding": this.padding
    })}
      >
        <div class="panel__body-wrapper">
          <div part="body" class="panel__body">
            <slot></slot>
          </div>
        </div>
      </div>
    `;
  }
}
FlowUiTabPanel.styles = styles;
__decorateClass([
  property({ reflect: true })
], FlowUiTabPanel.prototype, "name", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], FlowUiTabPanel.prototype, "active", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], FlowUiTabPanel.prototype, "scrollable", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], FlowUiTabPanel.prototype, "padding", 2);
__decorateClass([
  watch("active")
], FlowUiTabPanel.prototype, "handleActiveChange", 1);

export { FlowUiTabPanel as default };
