import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./elevated-card-radio-group.css.js";
import { ObcElevatedCardPosition } from "../elevated-card/elevated-card.js";
import "../elevated-card-radio/elevated-card-radio.js";
import { customElement } from "../../decorator.js";
import { classMap } from "lit/directives/class-map.js";
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 ObcElevatedCardRadioGroup = class extends LitElement {
  constructor() {
    super(...arguments);
    this.options = [];
    this.name = "default";
    this.value = "";
    this.disabled = false;
    this.required = false;
    this.top = false;
  }
  _handleValueChange(params) {
    const value = params.target.value;
    this.value = value;
    this.dispatchEvent(
      new CustomEvent("change", {
        detail: { value }
      })
    );
  }
  render() {
    const wrapperClasses = {
      wrapper: true,
      disabled: this.disabled
    };
    return html`<div class=${classMap(wrapperClasses)}>
      ${this.options.map((option, i) => {
      let position = ObcElevatedCardPosition.Center;
      if (i === 0 && this.top) {
        position = ObcElevatedCardPosition.Top;
      }
      if (i === this.options.length - 1) {
        position = ObcElevatedCardPosition.Bottom;
      }
      return html` <obc-elevated-card-radio
          .name=${this.name}
          .value=${option.value}
          .label=${option.label}
          ?checked=${this.value === option.value}
          ?disabled=${this.disabled}
          ?required=${this.required}
          .position=${position}
          @change=${this._handleValueChange}
        ></obc-elevated-card-radio>`;
    })}
    </div>`;
  }
};
ObcElevatedCardRadioGroup.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: Array })
], ObcElevatedCardRadioGroup.prototype, "options", 2);
__decorateClass([
  property({ type: String })
], ObcElevatedCardRadioGroup.prototype, "name", 2);
__decorateClass([
  property({ type: String })
], ObcElevatedCardRadioGroup.prototype, "value", 2);
__decorateClass([
  property({ type: Boolean })
], ObcElevatedCardRadioGroup.prototype, "disabled", 2);
__decorateClass([
  property({ type: Boolean })
], ObcElevatedCardRadioGroup.prototype, "required", 2);
__decorateClass([
  property({ type: Boolean })
], ObcElevatedCardRadioGroup.prototype, "top", 2);
ObcElevatedCardRadioGroup = __decorateClass([
  customElement("obc-elevated-card-radio-group")
], ObcElevatedCardRadioGroup);
export {
  ObcElevatedCardRadioGroup
};
//# sourceMappingURL=elevated-card-radio-group.js.map
