Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.122/Checkbox/Checkbox",["module","exports","require","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Main=void 0;var l=a("@frontend-taglib-clay$clayui/form"),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),r=_interopRequireDefault(a("liferay!frontend-js-react-web$react")),i=a("../FieldBase/ReactFieldBase.es");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e}).apply(this,arguments)}function _objectWithoutProperties(e,t){if(null==e)return{};var a,l,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var a,l,n={},r=Object.keys(e);for(l=0;l<r.length;l++)a=r[l],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(l=0;l<r.length;l++)a=r[l],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}const Switcher=({checked:e,disabled:t,label:a,name:i,onChange:o,required:s,showLabel:d,showMaximumRepetitionsInfo:c,systemSettingsURL:u})=>r.default.createElement(r.default.Fragment,null,r.default.createElement("label",{className:"toggle-switch"},r.default.createElement(l.ClayToggle,{disabled:t,name:i,onToggle:e=>{o({target:{value:e}})},toggled:e,value:String(e)}),d&&a,s&&r.default.createElement(n.default,{className:"reference-mark",symbol:"asterisk"})),e&&c&&r.default.createElement("div",{className:"ddm-info"},r.default.createElement("span",{className:"ddm-tooltip"},r.default.createElement(n.default,{symbol:"info-circle"})),r.default.createElement("div",{className:"ddm-info-text",dangerouslySetInnerHTML:{__html:Liferay.Util.sub(Liferay.Language.get("for-security-reasons-upload-field-repeatability-is-limited-the-limit-is-defined-in-x-system-settings-x"),"<a href=".concat(u,' target="_blank">'),"</a>")}}))),Checkbox=({checked:e,disabled:t,label:a,name:i,onChange:o,required:s,showLabel:d})=>r.default.createElement(l.ClayCheckbox,{checked:e,disabled:t,label:d?a:"",name:i,onChange:({target:{checked:e}})=>{o({target:{value:e}})}},d&&s&&r.default.createElement("span",{className:"ddm-label-required reference-mark"},r.default.createElement(n.default,{symbol:"asterisk"}))),Main=e=>{let{label:t,name:a,onChange:n,predefinedValue:o,readOnly:s,required:d,showAsSwitcher:c=!0,showLabel:u=!0,showMaximumRepetitionsInfo:f=!1,systemSettingsURL:m,value:b,visible:y}=e,h=_objectWithoutProperties(e,["label","name","onChange","predefinedValue","readOnly","required","showAsSwitcher","showLabel","showMaximumRepetitionsInfo","systemSettingsURL","value","visible"]);const g=c?Switcher:Checkbox,p=!!(null!=b?b:Array.isArray(o)?"true"===o[0]:o);return r.default.createElement(i.FieldBase,_extends({name:a,showLabel:!1,visible:y},h),r.default.createElement(g,{checked:p,disabled:s,label:t,name:a,onChange:n,required:d,showLabel:u,showMaximumRepetitionsInfo:f,systemSettingsURL:m}),r.default.createElement(l.ClayInput,{name:a,type:"hidden",value:"".concat(p)}))};t.Main=Main,Main.displayName="Checkbox";var o=Main;t.default=o}}));
//# sourceMappingURL=Checkbox.js.map