import { createElement, Component, Fragment } from '@wordpress/element' import classnames from 'classnames' import SinglePicker from './color-picker/single-picker.js' import Slider from './slider.js' import deepEqual from 'deep-equal' import Radio from './radio' const getDefaultsFor = value => ({ color: { color: '#000' }, // dotted | solid | dashed type: 'solid', // 1 | [1, 2, 3, 4] width: 1, ...value }) const Border = ({ value, onChange, option }) => { value = getDefaultsFor(value) return (
{[].concat(value.width).map((singleWidth, i) => ( typeof value.width !== 'number' && ( ) } onChange={width => onChange({ ...value, width: typeof value.width === 'number' ? width : value.width.map( (val, index) => index === i ? width : val ) }) } value={singleWidth} option={{ min: 0, max: 10 }} /> ))}
({ 'data-type': choice })} option={{ attr: { ['data-type']: 'compact' }, view: 'text', choices: { solid: , dashed: , dotted: } }} onChange={type => onChange({ ...value, type })} /> onChange({ ...value, color }) } value={value.color} />
) } Border.LabelToolbar = ({ value, onChange, option }) => { value = getDefaultsFor(value) return (
) } export default Border