Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/ColorPicker/ColorPicker.es",["module","exports","require","@frontend-taglib-clay$clayui/color-picker","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es"],(function(e,t,r){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=(n=r("@frontend-taglib-clay$clayui/color-picker"))&&n.__esModule?n:{default:n},o=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 r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),l=r("../FieldBase/ReactFieldBase.es");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}const e=["000000","5F5F5F","9A9A9A","CBCBCB","E1E1E1","FFFFFF","FF0D0D","FF8A1C","2BA676","006EF8","7F26FF","FF21A0"],f=({inputValue:t,name:r,onBlur:n,onFocus:l,onValueChange:u,readOnly:i,spritemap:c})=>{const[s,f]=(0,o.useState)(e),[d,p]=(0,o.useState)(t||s[0]);return(0,o.useEffect)((()=>{t&&p(t)}),[t]),o.default.createElement(o.default.Fragment,null,o.default.createElement("input",{name:r,type:"hidden",value:d}),o.default.createElement(a.default,{colors:s,disabled:i,label:Liferay.Language.get("color-field-type-label"),onBlur:n,onColorsChange:f,onFocus:l,onValueChange:e=>{e!==d&&(p(e),u(e))},spritemap:c,value:d}))};var s=e=>{let t,{name:r,onBlur:n,onChange:a,onFocus:u,predefinedValue:s="000000",readOnly:d,spritemap:p,value:y}=e,F=c(e,["name","onBlur","onChange","onFocus","predefinedValue","readOnly","spritemap","value"]),b=!1;const m=new MutationObserver(((e,r)=>{for(const a of e)if("attributes"===a.type&&"class"===a.attributeName){const e=a.target.classList.contains("show");if(e===b)return;e?u(t):(n(t),r.disconnect()),b=e}}));return o.default.createElement(l.FieldBase,i({name:r,onClick:e=>{if(!e.target.classList.contains("dropdown-toggle"))return;const r=document.querySelector(".clay-color-dropdown-menu");r&&(t=e,m.observe(r,{attributes:!0}))},readOnly:d,spritemap:p},F),o.default.createElement(f,{inputValue:y||s,name:r,onBlur:n,onFocus:u,onValueChange:e=>a({},e),readOnly:d,spritemap:p}))};t.default=s}}));
//# sourceMappingURL=ColorPicker.es.js.map