"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),o=require("react"),r=require("prop-types"),n=require("react-color"),c=require("@material-ui/core"),i=require("../../../icons/iconParkIcons.js");require("../../../icons/customIcons/icons/AddMessage.js"),require("../../../icons/customIcons/icons/Attention.js"),require("../../../icons/customIcons/icons/Collapse.js"),require("../../../icons/customIcons/icons/Dashboard.js"),require("../../../icons/customIcons/icons/Expand.js"),require("../../../icons/customIcons/icons/FolderClosed.js"),require("../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../icons/customIcons/icons/FolderOpened.js"),require("../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../icons/customIcons/icons/Search.js"),require("../../../icons/customIcons/icons/Wellhub.js"),require("../../../icons/customIcons/icons/MultiRuler.js"),require("../../../icons/customIcons/icons/Checkbox.js"),require("../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../icons/customIcons/icons/Radio.js"),require("../../../icons/customIcons/icons/RadioChecked.js"),require("../../../icons/customIcons/icons/SimulFrac.js"),require("../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../icons/customIcons/icons/CautionFilled.js"),require("../../../icons/customIcons/icons/MoreApp.js");var t=require("./style.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(r),a=function(r){var u=r.onChange,l=r.currentValue,a=r.defaultValue,d=r.classes,m=r.condensed,j=r.colors,q=r.lensColor,f=o.useState(!1),h=f[0],I=f[1],C=o.useState(l||a),p=C[0],g=C[1],x=function(){return u(p)};return s.jsxs("div",e.__assign({className:t.colorEditor},{children:[s.jsx(c.Button,e.__assign({variant:"contained",color:"primary",onClick:function(){return I(!0)},className:d.button,style:{backgroundColor:p,color:q},size:"small"},{children:s.jsx(i.PaletteIcon,{size:16})})),h&&s.jsx(c.ClickAwayListener,e.__assign({mouseEvent:"onMouseDown",touchEvent:"onTouchStart",onClickAway:function(){I(!1),x()}},{children:s.jsx("div",e.__assign({className:t.colorEditorPickerContainer},{children:m?s.jsx(n.GithubPicker,{color:p,onChange:function(e){g(e.hex),I(!1),x()},colors:j,triangle:"hide"}):s.jsx(n.ChromePicker,{color:p,onChange:function(e){g(e.hex),x()}})}))}))]}))},d={currentValue:l.default.string.isRequired,defaultValue:l.default.string,condensed:l.default.bool,onChange:l.default.func.isRequired,colors:l.default.arrayOf(l.default.string),classes:l.default.shape({button:l.default.string}).isRequired,lensColor:l.default.string};a.propTypes=d,a.defaultProps={condensed:!1,colors:["#FF0000","#00FF00","#0000FF"],defaultValue:"#FF0000",lensColor:"#fff"};var m=c.withStyles({button:{marginBottom:16}})(a);exports.ColorEditor=a,exports.default=m;
