import { r as registerInstance, h } from './index-c269755a.js';
import { u as uniqueId } from './uniqueId-2052fef6.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 = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    /** 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))));
  }
};
TeliaRadioButton.style = teliaRadioButtonCss;

export { TeliaRadioButton as telia_radio_button };
