import reactCSS from './helpers/reactcss'; import { ColorWrap, Saturation, Hue, Alpha, Checkboard } from './common'; import SketchFields from './SketchFields'; import SketchPresetColors from './SketchPresetColors'; const Sketch = ({ width, rgb, hex, hsv, hsl, onChange, showAlpha, presetColors, renderers, className, type, }) => { const styles: any = reactCSS( { default: { picker: { width, padding: '10px 10px 0', boxSizing: 'initial', background: '#fff', borderRadius: '4px', boxShadow: '0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)', }, saturation: { width: '100%', paddingBottom: '75%', position: 'relative', overflow: 'hidden', }, Saturation: { radius: '3px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)', }, controls: { display: 'flex', }, sliders: { padding: '4px 0', flex: '1', }, color: { width: '24px', height: '24px', position: 'relative', marginTop: '4px', marginLeft: '4px', borderRadius: '3px', }, activeColor: { absolute: '0px 0px 0px 0px', borderRadius: '2px', background: `rgba(${rgb.r},${rgb.g},${rgb.b},${rgb.a})`, boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)', }, hue: { position: 'relative', height: '10px', overflow: 'hidden', }, Hue: { radius: '2px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)', }, alpha: { position: 'relative', height: '10px', marginTop: '4px', overflow: 'hidden', }, Alpha: { radius: '2px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)', }, }, showAlpha: { color: { height: '10px', }, hue: { height: '10px', }, alpha: { display: 'none', }, }, }, { showAlpha: !showAlpha } ); return (