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