Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/Radio/Radio.es",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","../hooks/useSyncValue.es","../util/setters.es","./Radio.scss"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n("@frontend-taglib-clay$clayui/form"),a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=r?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),l=n("../FieldBase/ReactFieldBase.es"),o=n("../hooks/useSyncValue.es"),i=n("../util/setters.es");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}n("./Radio.scss");var d=e=>{let{editingLanguageId:t,inline:n,name:u,onBlur:d,onChange:f,onFocus:p,options:y=[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],predefinedValue:v,readOnly:O,value:b}=e,g=s(e,["editingLanguageId","inline","name","onBlur","onChange","onFocus","options","predefinedValue","readOnly","value"]);const m=(0,a.useMemo)((()=>{if("string"==typeof v)return v;return((0,i.setJSONArrayValue)(v)||[])[0]}),[v]),[j,h]=(0,o.useSyncValue)(b||m,!0,t);return a.default.createElement(l.FieldBase,c({},g,{name:u,readOnly:O}),a.default.createElement("div",{className:"ddm__radio",onBlur:d,onFocus:p},y.map(((e,t)=>a.default.createElement(r.ClayRadio,{checked:j===e.value,disabled:O,inline:n,key:e.value,label:e.label,name:"".concat(u,"_").concat(t),onChange:t=>{h(e.value),f(t)},value:e.value})))),a.default.createElement("input",{name:u,type:"hidden",value:j}))};t.default=d}}));
//# sourceMappingURL=Radio.es.js.map