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