Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.152/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){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("@frontend-taglib-clay$clayui/color-picker")),a=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={},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")),o=r("../FieldBase/ReactFieldBase.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 n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,a=function _objectWithoutPropertiesLoose(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"],ClayColorPickerWithState=({inputValue:t,name:r,onBlur:o,onFocus:l,onValueChange:u,readOnly:i,spritemap:c})=>{const[s,d]=(0,a.useState)(e),[f,p]=(0,a.useState)(t||s[0]);return(0,a.useEffect)((()=>{t&&p(t)}),[t]),a.default.createElement(a.default.Fragment,null,a.default.createElement("input",{name:r,type:"hidden",value:f}),a.default.createElement(n.default,{colors:s,disabled:i,label:Liferay.Language.get("color-field-type-label"),onBlur:o,onColorsChange:d,onFocus:l,onValueChange:e=>{e!==f&&(p(e),u(e))},spritemap:c,value:f}))};var _default=e=>{let t,{name:r,onBlur:n,onChange:l,onFocus:u,predefinedValue:i="000000",readOnly:c,spritemap:s,value:d}=e,f=_objectWithoutProperties(e,["name","onBlur","onChange","onFocus","predefinedValue","readOnly","spritemap","value"]),p=!1;const y=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===p)return;e?u(t):(n(t),r.disconnect()),p=e}}));return a.default.createElement(o.FieldBase,_extends({name:r,onClick:e=>{if(!e.target.classList.contains("dropdown-toggle"))return;const r=document.querySelector(".clay-color-dropdown-menu");r&&(t=e,y.observe(r,{attributes:!0}))},readOnly:c,spritemap:s},f),a.default.createElement(ClayColorPickerWithState,{inputValue:d||i,name:r,onBlur:n,onFocus:u,onValueChange:e=>l({},e),readOnly:c,spritemap:s}))};t.default=_default}}));
//# sourceMappingURL=ColorPicker.es.js.map