import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { u as uniqueId } from './uniqueId.js';
import { d as defineCustomElement$4 } from './telia-field-assistive-text2.js';
import { d as defineCustomElement$3 } from './telia-label2.js';
import { d as defineCustomElement$2 } from './telia-vst2.js';

const teliaRadioButtonCss = ":host{display:inline-block}.telia-radio-button__main{align-items:center;display:inline-flex;position:relative}.telia-radio-button__main label{cursor:pointer}.telia-radio-button__input{z-index:1;appearance:none;cursor:pointer;height:calc(4.4rem * var(--voca-rem-multiplier));left:calc(calc(2.4rem * var(--voca-rem-multiplier)) / 2);margin:0;opacity:0;padding:0;position:absolute;top:calc(calc(2.4rem * var(--voca-rem-multiplier)) / 2);transform:translate(-50%, -50%);width:calc(4.4rem * var(--voca-rem-multiplier))}.telia-radio-button__input:focus~.telia-radio-button__label::before{border-radius:calc(0.2rem * var(--voca-rem-multiplier));box-shadow:0 0 0 calc(0.3rem * var(--voca-rem-multiplier)) #0099ff;bottom:calc(-1 * calc(0.2rem * var(--voca-rem-multiplier)));content:\"\";display:block;left:calc(-1 * calc(0.2rem * var(--voca-rem-multiplier)));position:absolute;right:calc(-1 * calc(0.2rem * var(--voca-rem-multiplier)));top:calc(-1 * calc(0.2rem * var(--voca-rem-multiplier)));height:calc(100% + calc(0.8rem * var(--voca-rem-multiplier)));top:calc(-1 * calc(0.4rem * var(--voca-rem-multiplier)));width:calc(100% + calc(0.4rem * var(--voca-rem-multiplier)))}.telia-radio-button__input:not(:focus-visible):focus~.telia-radio-button__label::before{box-shadow:none;outline:0}.telia-radio-button__input:checked~.telia-radio-button__fake-radio-button{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #29003e}.telia-radio-button__input:checked~.telia-radio-button__fake-radio-button .telia-radio-button__fake-dot{background-color:#29003e}.telia-radio-button__input:disabled{cursor:not-allowed}.telia-radio-button__input:disabled~.telia-radio-button__fake-radio-button{background-color:rgba(0, 0, 0, 0.1);border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.15);box-shadow:none;cursor:not-allowed}.telia-radio-button__input:disabled~.telia-radio-button__label{color:rgba(0, 0, 0, 0.4);cursor:not-allowed}.telia-radio-button__input:disabled:checked~.telia-radio-button__fake-radio-button{background-color:#ffffff;border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-radio-button__input:disabled:checked~.telia-radio-button__fake-radio-button .telia-radio-button__fake-dot{background-color:rgba(0, 0, 0, 0.6)}.telia-radio-button__input:hover:not(:disabled)~.telia-radio-button__fake-radio-button{border:calc(0.2rem * var(--voca-rem-multiplier)) solid #29003e}.telia-radio-button__input:hover:not(:disabled):checked~.telia-radio-button__fake-radio-button{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #29003e}.telia-radio-button__fake-radio-button{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3);background-color:#ffffff;border-radius:calc(99.9rem * var(--voca-rem-multiplier));display:inline-block;height:calc(2.4rem * var(--voca-rem-multiplier));min-width:calc(2.4rem * var(--voca-rem-multiplier));position:relative;vertical-align:top;width:calc(2.4rem * var(--voca-rem-multiplier))}.telia-radio-button__fake-dot{background-color:transparent;border-radius:calc(99.9rem * var(--voca-rem-multiplier));height:calc(1.6rem * var(--voca-rem-multiplier));left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);width:calc(1.6rem * var(--voca-rem-multiplier))}.telia-radio-button__label{font-family:\"TeliaSans\", Helvetica, Arial, \"Lucida Grande\", sans-serif;font-weight:normal;font-size:calc(1.6rem * var(--voca-rem-multiplier));line-height:1.5;color:rgba(0, 0, 0, 0.85);cursor:pointer;display:inline-block;min-height:calc(2.4rem * var(--voca-rem-multiplier));padding:0 0 0 calc(1.2rem * var(--voca-rem-multiplier));width:calc(100% - calc(2.4rem * var(--voca-rem-multiplier)))}.telia-radio-button--disabled .telia-radio-button__additional{color:rgba(0, 0, 0, 0.4);cursor:not-allowed}";

const TeliaRadioButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /** Set radio button disabled */
    this.disabled = false;
    /** Additional description id */
    this.additionalId = uniqueId('additional');
    /** Tracking id is used to identify and count Component usage */
    this.dataTrackingId = 'telia-radio-button';
    /**
     * Renders content passed in via props or fallbacks to slot
     * @private
     */
    this.renderContent = () => {
      if (this.label) {
        return this.label;
      }
      return h("slot", null);
    };
  }
  componentDidRender() {
    // This check is for Stencil unit tests. Input element is mocked,
    // but setCustomValidity method is not. It is undefined.
    var _a;
    // eslint-disable-next-line @stencil/strict-boolean-conditions
    if (this.htmlForm) {
      (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setAttribute('form', this.htmlForm);
    }
  }
  render() {
    const showAdditional = !!this.additional;
    return (h("div", { class: `telia-radio-button ${this.disabled ? 'telia-radio-button--disabled' : ''}` }, h("telia-label", { class: "telia-radio-button__main", dataTestid: this.dataTestid }, h("input", { class: "telia-radio-button__input", type: "radio", name: this.name, ref: ref => (this.inputElement = ref), value: this.value, disabled: this.disabled, checked: this.checked, "aria-labelledby": this.labelledby, form: this.htmlForm }), h("div", { class: "telia-radio-button__fake-radio-button" }, h("div", { class: "telia-radio-button__fake-dot" })), !this.labelledby && (h("span", { class: "telia-radio-button__label" }, this.renderContent())), h("telia-vst", { dataTrackingId: this.dataTrackingId })), showAdditional && (h("telia-field-assistive-text", { class: "telia-radio-button__additional", id: this.additionalId }, this.additional))));
  }
  static get style() { return teliaRadioButtonCss; }
}, [4, "telia-radio-button", {
    "dataTestid": [1, "data-testid"],
    "disabled": [4],
    "htmlForm": [1, "html-form"],
    "value": [1],
    "name": [1],
    "additional": [1],
    "additionalId": [1, "additional-id"],
    "checked": [4],
    "labelledby": [1],
    "label": [1]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["telia-radio-button", "telia-field-assistive-text", "telia-label", "telia-vst"];
  components.forEach(tagName => { switch (tagName) {
    case "telia-radio-button":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, TeliaRadioButton$1);
      }
      break;
    case "telia-field-assistive-text":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "telia-label":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "telia-vst":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}
defineCustomElement$1();

const TeliaRadioButton = TeliaRadioButton$1;
const defineCustomElement = defineCustomElement$1;

export { TeliaRadioButton, defineCustomElement };
