import{v as u,h as n,x as p,H as f,r as m,m as b}from"./index-BeCeuELg.js";import{n as v}from"./dev.utils-109baad9-BGIjjL5C.js";import{t as h,s as y}from"./events-29e84d75-CETYymUM.js";import{g}from"./controller-fe4af011-DCaVWhXc.js";import{a as _}from"./controller-06f2bcc0-CrEafCKk.js";import{p as w}from"./controller-3786e9f3-yqOVbNhO.js";import"./i18n-43b7aa72-DSS4ELtF.js";import{F as k}from"./FormFieldMsg-ba89943d-CF4yysBa.js";import"./tslib.es6-1173d062-BGVaTf34.js";import"./associated.controller-b3473c2a-BVdUJnUP.js";import"./access-and-short-key-f4e18d87-DqWg2s_b.js";import"./hide-label-a27a203c-Dfejlhn8.js";import"./label-3757689e-D7ErDa5R.js";import"./tooltip-align-184e92e1-DetagLgg.js";import"./align-a1976178-CkMi2aRf.js";import"./clsx-09a06a12-B-dksMZM.js";import"./Alert-733b0883-Df5pVzCu.js";const x=`@layer kol-component {
  :host {
    display: block;
  }
}
@layer kol-component {
  .kol-tooltip-wc {
    display: contents;
  }
  .kol-tooltip-wc .tooltip-floating {
    opacity: 0;
    display: none;
    position: fixed;
    /* Avoid layout interference - see https://floating-ui.com/docs/computePosition */
    top: 0;
    left: 0;
    /* Can be used to specify the tooltip-width from the outside. Unset by default. */
    width: var(--kol-tooltip-width, unset);
    max-width: 90vw;
    max-height: 90vh;
    animation-direction: normal;
    /* Can be used to specify the animation duration from the outside. 250ms by default. */
    animation-duration: var(--kolibri-tooltip-animation-duration, 250ms);
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
    animation-timing-function: ease-in;
  }
  .kol-tooltip-wc .tooltip-floating.hide {
    animation-name: hideTooltip;
  }
  .kol-tooltip-wc .tooltip-floating.show {
    animation-name: showTooltip;
  }
  /* Shared between content and arrow */
  .kol-tooltip-wc .tooltip-area {
    color: #000;
    background-color: #fff;
  }
  .kol-tooltip-wc .tooltip-arrow {
    transform: rotate(45deg);
    position: absolute;
    z-index: 999;
    width: calc(10rem / var(--kolibri-root-font-size, 16));
    height: calc(10rem / var(--kolibri-root-font-size, 16));
  }
  .kol-tooltip-wc .tooltip-content {
    position: relative;
    z-index: 1000;
  }
  @keyframes hideTooltip {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      display: none;
    }
  }
  @keyframes showTooltip {
    0% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }
}
/*
 * This file contains all rules for accessibility.
 */
@layer kol-a11y {
  :host {
    /*
     * Minimum size of interactive elements.
     */
    --a11y-min-size: calc(44rem / var(--kolibri-root-font-size, 16));
    color: black;
    /*
     * No element should be used without a background and font color whose contrast ratio has
     * not been checked. By initially setting the background color to white and the font color
     * to black, the contrast ratio is ensured and explicit adjustment is forced.
     */
    background-color: white;
    /*
     * Verdana is an accessible font that can be used without requiring additional loading time.
     */
    font-family: Verdana;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  * {
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    hyphens: auto;
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    word-break: break-word;
  }
  /*
   * All interactive elements should have a minimum size of rem(44).
   */
  /* input:not([type='checkbox'], [type='radio'], [type='range']), */
  /* option, */
  /* select, */
  /* textarea, */
  button,
  .kol-input .input {
    min-width: var(--a11y-min-size);
    min-height: var(--a11y-min-size);
  }
  /*
   * Some interactive elements should not inherit the font-family and font-size.
   */
  a,
  button,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  input,
  option,
  select,
  textarea {
    /*
     * All elements should inherit the font family from his parent element.
     */
    font-family: inherit;
    /*
     * All elements should inherit the font size from his parent element.
     */
    font-size: inherit;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  /**
  * Sometimes we need the semantic element for accessibility reasons,
  * but we don't want to show it.
  *
  * - https://www.a11yproject.com/posts/how-to-hide-content/
  */
  .visually-hidden {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }
}
@layer kol-global {
  /*
   * Dieses CSS stellt sicher, dass der Standard-Style
   * von A und Button resettet werden.
   */
  :is(a, button) {
    background-color: transparent;
    width: 100%; /* 100% needed for custom width from outside */
    margin: 0;
    padding: 0;
    border: none;
  }
  /*
   * Ensure elements with hidden attribute to be actually not visible
   * @see https://meowni.ca/hidden.is.a.lie.html
   */
  [hidden] {
    display: none !important;
  }
}
@layer kol-global {
  :host {
    /*
     * The max-width is needed to prevent the table from overflowing the
     * parent node, if the table is wider than the parent node.
     */
    max-width: 100%;
    font-size: calc(16rem / var(--kolibri-root-font-size, 16));
  }
  * {
    /*
     * We prefer to box-sizing: border-box for all elements.
     */
    box-sizing: border-box;
  }
  /* KolSpan is a layout component with icons in all directions and a label text in the middle. */
  .kol-span-wc {
    display: grid;
    place-items: center;
  }
  /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */
  .kol-span-wc > span {
    display: flex;
    place-items: center;
  }
  a,
  button {
    cursor: pointer;
  }
  /* This is the text label. */
  .hide-label > .kol-span-wc > span > span {
    display: none;
  }
  /* Reset browser agent style. */
  button:disabled {
    color: unset;
  }
  .disabled label,
  .disabled:focus-within label,
  [aria-disabled=true],
  [aria-disabled=true]:focus,
  [disabled],
  [disabled]:focus {
    opacity: 0.5;
    outline: none;
    cursor: not-allowed;
  }
  [aria-disabled=true]:focus .kol-span-wc,
  [disabled]:focus .kol-span-wc {
    outline: none !important;
  }
  .badge-text-hint {
    color: black;
    background-color: lightgray;
  }
}
@layer kol-component {
  .required label > span::after,
  .required legend > span::after {
    content: "*";
  }
}
@layer kol-component {
  input,
  textarea {
    cursor: text;
  }
  input[type=checkbox],
  input[type=color],
  input[type=file],
  input[type=radio],
  input[type=range],
  label,
  option,
  select {
    cursor: pointer;
  }
  /* input[type='checkbox'], */
  /* input[type='radio'], */
  /* input[type='range'], */
  input[type=color],
  input[type=date],
  input[type=datetime-local],
  input[type=email],
  input[type=file],
  input[type=month],
  input[type=number],
  input[type=password],
  input[type=search],
  input[type=tel],
  input[type=text],
  input[type=time],
  input[type=url],
  input[type=week],
  option,
  select,
  textarea {
    background-color: transparent;
    width: 100%;
  }
  /* needed hack for vertical alignment */
  input[type=file] {
    padding: calc((var(--a11y-min-size) - (16rem / var(--kolibri-root-font-size, 16))) / 10) 0.5em;
  }
  /* needed hack for vertical alignment */
  select[multiple] option {
    padding: calc((var(--a11y-min-size) - (16rem / var(--kolibri-root-font-size, 16))) / 2) 0.5em;
  }
}
@layer kol-component {
  .kol-alert-wc {
    display: grid;
  }
  .kol-alert-wc .heading {
    display: flex;
    place-items: center;
  }
  .kol-alert-wc .heading > div {
    flex-grow: 1;
  }
  .close {
    /* Visible with forced colors */
    outline: transparent solid calc(1rem / var(--kolibri-root-font-size, 16));
  }
}
@layer kol-component {
  :host {
    --border-width: 2px;
    --input-size: 1.5em;
  }
  .kol-input .icons {
    display: none;
  }
  label {
    cursor: pointer;
  }
  input {
    border-style: solid;
    border-radius: 100%;
    display: flex;
    width: var(--input-size);
    min-width: var(--input-size);
    height: var(--input-size);
    min-height: var(--input-size);
    margin: 0;
    padding: 0;
    border-width: var(--border-width);
    appearance: none;
    cursor: pointer;
  }
  input:before {
    border-radius: 100%;
    width: calc(var(--input-size) / 2);
    height: calc(var(--input-size) / 2);
    margin: auto;
    content: "";
  }
  input:checked:before {
    background-color: #000;
  }
  @media (forced-colors: active) {
    input:checked:before {
      /* Give it a visible background in forced colors mode */
      background-color: selectedItem !important;
    }
  }
  fieldset {
    display: flex;
  }
  fieldset.vertical {
    flex-direction: column;
  }
  fieldset .input-slot {
    display: flex;
    align-items: center;
  }
  /* required star is on fieldset legend */
  .required label > span::after {
    content: "";
  }
}`,z=x,T=class{async getValue(){return this.currentValue}async focus(){await this.kolFocus()}async kolFocus(){return new Promise(e=>{requestAnimationFrame(()=>{var t;(t=this.inputRef)===null||t===void 0||t.focus(),e()})})}render(){const{ariaDescribedBy:e,hasError:t,hasHint:o}=g(this.state),i=u(this.state._label);return n(f,{key:"aacd43f73967156ee1ffd5452d05d554e9011d53",class:"kol-input-radio"},n("fieldset",{key:"55b6be289684f3d28474fb465d89d7756b577c97","aria-describedby":e.length>0?e.join(" "):void 0,class:{fieldset:!0,disabled:this.state._disabled===!0,error:t===!0,required:this.state._required===!0,"hidden-error":this._hideError===!0,[this.state._orientation]:!0}},n("legend",{key:"7ddc271483f90f25372c6a5ddba259f18bb6df04",class:"block w-full mb-1 leading-normal"},n("span",{key:"b34e2b42ec642bf033a7c58e905992258295f4ca"},n("span",{key:"fdd91949f409e495b6ba8a027cd7959cf23af153",slot:"label"},i?n("slot",{name:"expert"}):this._label))),this.state._options.map((a,r)=>{const l=`${this.state._id}-${r}`,d=`radio-${r}`,c=this.state._value===a.value;return n(p,{class:{radio:!0,disabled:!!(this.state._disabled||a.disabled)},key:l,_disabled:this.state._disabled||a.disabled,_hideLabel:this.state._hideLabel,_hint:a.hint,_id:l,_label:a.label,_renderNoLabel:!0,_required:this.state._required,_slotName:d,_tooltipAlign:this._tooltipAlign,_touched:this.state._touched},n("div",{slot:d,class:"radio-input-wrapper"},n("input",Object.assign({ref:this.state._value===a.value?this.catchRef:void 0,title:"","aria-label":this.state._hideLabel&&typeof a.label=="string"?a.label:void 0,type:"radio",id:l,checked:c,name:this.state._name||this.state._id,disabled:this.state._disabled||a.disabled,required:this.state._required,tabIndex:this.state._tabIndex,value:`-${r}`},this.controller.onFacade,{onChange:this.onChange,onClick:void 0,onInput:this.onInput,onKeyDown:this.onKeyDown.bind(this),onFocus:s=>{this.controller.onFacade.onFocus(s),this.inputHasFocus=!0},onBlur:s=>{this.controller.onFacade.onBlur(s),this.inputHasFocus=!1}})),n("label",{class:"radio-label",htmlFor:`${l}`,style:{height:this.state._hideLabel?"0":void 0,margin:this.state._hideLabel?"0":void 0,padding:this.state._hideLabel?"0":void 0,visibility:this.state._hideLabel?"hidden":void 0}},n("span",null,n("span",{class:"radio-label-span-inner"},a.label)))))}),t&&n(k,{key:"5ec08b6bdaf01d265a24a3f61c8306f94f3e4645",_alert:this.showAsAlert(),_hideError:this.state._hideError,_msg:this.state._msg,_id:this.state._id}),o&&n("span",{key:"2a023220b8f779bed5c706a200086a6893c7f49e",class:"hint",id:`${this.state._id}-hint`},this.state._hint)))}constructor(e){m(this,e),this.catchRef=t=>{this.inputRef=t},this.onInput=t=>{var o;if(t.target instanceof HTMLInputElement){const i=this.controller.getOptionByKey(t.target.value);i!==void 0&&(h("input",this.host,i.value),typeof((o=this.state._on)===null||o===void 0?void 0:o.onInput)=="function"&&this.state._on.onInput(t,i.value))}},this.onChange=t=>{var o;if(t.target instanceof HTMLInputElement){const i=this.controller.getOptionByKey(t.target.value);i!==void 0&&(y(t),h("change",this.host,i.value),this.controller.setFormAssociatedValue(i.value),typeof((o=this.state._on)===null||o===void 0?void 0:o.onChange)=="function"&&this.state._on.onChange(t,i.value),this.currentValue=i.value)}},this.onKeyDown=t=>{(t.code==="Enter"||t.code==="NumpadEnter")&&w({form:this.host,ref:this.inputRef})},this._alert=void 0,this._disabled=!1,this._error=void 0,this._hideError=!1,this._hideLabel=!1,this._hint="",this._id=void 0,this._label=void 0,this._msg=void 0,this._name=void 0,this._on=void 0,this._options=void 0,this._orientation="vertical",this._required=!1,this._syncValueBySelector=void 0,this._tabIndex=void 0,this._tooltipAlign="top",this._touched=!1,this._value=void 0,this.state={_hideError:!1,_id:`id-${v()}`,_label:"",_options:[],_orientation:"vertical"},this.inputHasFocus=!1,this.controller=new _(this,"radio",this.host)}showAsAlert(){return this.state._alert===void 0?!!this.state._touched&&!this.inputHasFocus:this.state._alert}validateTooltipAlign(e){this.controller.validateTooltipAlign(e)}validateAlert(e){this.controller.validateAlert(e)}validateDisabled(e){this.controller.validateDisabled(e)}validateError(e){this.controller.validateError(e)}validateHideLabel(e){this.controller.validateHideLabel(e)}validateHideError(e){this.controller.validateHideError(e)}validateHint(e){this.controller.validateHint(e)}validateId(e){this.controller.validateId(e)}validateLabel(e){this.controller.validateLabel(e)}validateMsg(e){this.controller.validateMsg(e)}validateName(e){this.controller.validateName(e)}validateOn(e){this.controller.validateOn(e)}validateOptions(e){this.controller.validateOptions(e)}validateOrientation(e){this.controller.validateOrientation(e)}validateRequired(e){this.controller.validateRequired(e)}validateSyncValueBySelector(e){this.controller.validateSyncValueBySelector(e)}validateTabIndex(e){this.controller.validateTabIndex(e)}validateTouched(e){this.controller.validateTouched(e)}validateValue(e){this.controller.validateValue(e)}componentWillLoad(){this._touched=this._touched===!0,this.currentValue=this._value,this.controller.componentWillLoad()}static get delegatesFocus(){return!0}get host(){return b(this)}static get watchers(){return{_tooltipAlign:["validateTooltipAlign"],_alert:["validateAlert"],_disabled:["validateDisabled"],_error:["validateError"],_hideLabel:["validateHideLabel"],_hideError:["validateHideError"],_hint:["validateHint"],_id:["validateId"],_label:["validateLabel"],_msg:["validateMsg"],_name:["validateName"],_on:["validateOn"],_options:["validateOptions"],_orientation:["validateOrientation"],_required:["validateRequired"],_syncValueBySelector:["validateSyncValueBySelector"],_tabIndex:["validateTabIndex"],_touched:["validateTouched"],_value:["validateValue"]}}};T.style={default:z};export{T as kol_input_radio};
//# sourceMappingURL=kol-input-radio.entry-Bx2SUKvJ.js.map
