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 { Host, h } from '@stencil/core';
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import { arrayToClassString } from '../../../../utils/ui';
import ResponsiveFormatFacade from '../../../../helpers/formatter/responsive-map-formatter/responsive-format-facade';
import { DomNodeSubjectObserverFactory } from '../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-observer-factory';
import { VegaLabelButtonClick } from '../../../../helpers/event-manager/event-id/vega-event-id';
/** The `VegaInputSelectRenderer` class is a TypeScript React component that renders a select input field with various properties and methods. */
export class VegaInputSelectRenderer extends VegaSlimmer {
  constructor() {
    super(...arguments);
    this.renderErrorMessage = () => {
      return h("div", { class: "vega-input-select-error-message" });
    };
    this.renderHelpMessage = () => {
      return h("div", { class: "vega-input-select-hint" }, this.hint);
    };
    this.handleLabelButtonClick = () => {
      this.labelButtonClickEventEmitter.emit();
    };
  }
  render() {
    return (h(Host, { class: arrayToClassString([
        this.disabled ? 'vega-input-select-disabled' : '',
        ResponsiveFormatFacade.formatCustom(this.size),
      ]) },
      this.renderLabel(),
      this.dropdownRenderer.render(),
      this.renderErrorMessage(),
      this.hint && this.renderHelpMessage()));
  }
  renderLabel() {
    return (this.label && (h("vega-field-label", { "is-field-required": this.required, disabled: this.disabled, label: this.label, suffixButtonConfig: this.labelSuffixButtonConfig, ref: (node) => {
        DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, VegaLabelButtonClick, this.handleLabelButtonClick);
      } })));
  }
}
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "disabled", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "size", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "hint", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "label", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "required", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "labelSuffixButtonConfig", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectRenderer.prototype, "labelButtonClickEventEmitter", void 0);
__decorate([
  MapToComponentField({ componentFieldName: 'vegaInputSelectDropdownRenderer' })
], VegaInputSelectRenderer.prototype, "dropdownRenderer", void 0);
