import e from"prop-types";import a from"classnames";import{toNumber as r}from"lodash";import{withStyles as n,MenuItem as i,FormControl as l,InputLabel as t,Select as s,TextField as c,FormControlLabel as o,Checkbox as u}from"@material-ui/core";import d from"./TraceSelect.js";import h from"./TraceSettings.css.js";import m from"../../ColorPicker/ColorPicker.js";import{jsxs as p,jsx as g,Fragment as v}from"react/jsx-runtime";var y=n({root:{minHeight:35}})(i),f=function(e){var n=e.traceSettings,f=e.onChange,S=e.mapping,b=e.classes;return p("div",{className:h.container,children:[g("div",{className:h.item,children:g(d,{value:n.key,onChange:function(e){return f("key",e)},mapping:S,showLabel:!0})}),n.key&&p(v,{children:[p("div",{className:h.item,children:[p(l,{children:[g(t,{htmlFor:"traceType",children:"Trace Type"}),p(s,{displayEmpty:!0,value:n.traceType,className:b.select,onChange:function(e){return f("traceType",e.target.value)},inputProps:{name:"traceType"},children:[g(i,{value:"line",children:"Line"}),g(i,{value:"numeric",disabled:!0,children:"Numeric"})]})]}),g(c,{label:"Width",type:"number",name:"lineWidth",InputLabelProps:{shrink:!0},InputProps:{inputProps:{min:1,max:5}},className:b.lineWidth,value:n.lineWidth,onChange:function(e){return f("lineWidth",r(e.target.value))}}),g(m,{buttonClassName:b.colorPickerBtn,className:b.colorPicker,value:n.color,onChange:function(e){return f("color",e)},label:"Fill color"})]}),g("div",{className:h.item,children:p(l,{className:b.formControl,children:[g(t,{htmlFor:"dashStyle",children:"Line Style"}),p(s,{value:n.dashStyle,onChange:function(e){return f("dashStyle",e.target.value)},inputProps:{name:"dashStyle"},classes:{select:b.lineSelect},children:[g(y,{value:"Solid",children:g("span",{className:a(h.line)})},"Line"),g(y,{value:"Dot",children:g("span",{className:a(h.line,h.dotted)})},"Dotted"),g(y,{value:"Dash",children:g("span",{className:a(h.line,h.dashed)})},"Dashed")]})]})}),g("div",{className:h.item,children:g(l,{children:g(o,{control:g(u,{checked:n.autoScale,color:"primary",onChange:function(e){return f("autoScale",e.target.checked)},value:"autoScale"}),label:"Auto Scale"})})}),!n.autoScale&&p("div",{className:h.scales,children:[g(c,{label:"Min Value",type:"number",value:n.scaleMin,onChange:function(e){return f("scaleMin",e.target.value)},InputLabelProps:{shrink:!0},defaultValue:""}),g(c,{label:"Max Value",type:"number",value:n.scaleMax,onChange:function(e){return f("scaleMax",e.target.value)},InputLabelProps:{shrink:!0},defaultValue:""})]})]})]})};f.propTypes={traceSettings:e.shape({lineWidth:e.number,scaleMin:e.number,scaleMax:e.number,key:e.string,color:e.string,autoScale:e.bool,dashStyle:e.string,traceType:e.string.isRequired}).isRequired,onChange:e.func.isRequired,classes:e.shape({}).isRequired,mapping:e.arrayOf(e.shape({name:e.string.isRequired,key:e.string.isRequired}).isRequired).isRequired};var S=n({select:{minWidth:200},lineSelect:{minWidth:175,display:"flex",alignItems:"center"},lineWidth:{width:64,margin:"0 30px"},colorPicker:{whiteSpace:"nowrap"},colorPickerBtn:{width:36,minWidth:36,height:24}})(f);export{S as default};
//# sourceMappingURL=TraceSettings.js.map
