import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import"./CtrlEnumInline.scss";import React from"react";export default function CtrlEnumInline({currMod:n,updatePath:e,prop:i,value:t,inheritVal:o,deleteProp:l,updateProps:r}){if(!i.options)return _jsx("div",{children:"Missing options for enum-inline"});const a=i.options.length&&"object"==typeof i.options[0]?i.options.findIndex((n=>n.value===t)):i.options.indexOf(t);return _jsxs(React.Fragment,{children:[!1!==i.clearable&&t&&!o&&_jsx("div",{className:"ctrl-enum-inline__clear-btn",onClick:()=>l(e),children:"Clear"}),_jsxs("div",{className:"ctrl-enum-inline__options-container",children:[i.options.map((i=>_jsx("div",{onClick:()=>{r(n.id,e,i?.value??i)},className:"ctrl-enum-inline__options-container__option "+(t===(i?.value??i)?o?"ctrl-enum-inline__options-container__option--active-inherit-val":"ctrl-enum-inline__options-container__option--active":"ctrl-enum-inline__options-container__option--inactive"),children:i?.label??i},i?.value??i))),i.allowOther&&_jsx("div",{onClick:()=>{r(n.id,e,"other")},className:"ctrl-enum-inline__options-container__option-other "+(a>-1?"ctrl-enum-inline__options-container__option-other--inactive":o?"ctrl-enum-inline__options-container__option-other--active-inherit-val":"ctrl-enum-inline__options-container__option-other--active"),children:"Other"})]}),i.allowOther&&-1===i.options.map((n=>"object"==typeof n?n.value:n)).indexOf(t)&&_jsx("input",{className:"ctrl-enum-inline__other-input-field",type:"text",placeholder:o?t:"",value:o?"":t,onChange:i=>r(n.id,e,i.target.value)},n.id+e)]},n.id+e)}