@gechiui/block-editor
Version:
30 lines (26 loc) • 744 B
JavaScript
/**
* GeChiUI dependencies
*/
import { __experimentalUnitControl as UnitControl } from '@gechiui/components';
import { __ } from '@gechiui/i18n';
/**
* Internal dependencies
*/
import { getAllValue, hasMixedValues, hasDefinedValues } from './utils';
export default function AllInputControl( { onChange, values, ...props } ) {
const allValue = getAllValue( values );
const hasValues = hasDefinedValues( values );
const isMixed = hasValues && hasMixedValues( values );
const allPlaceholder = isMixed ? __( '混合' ) : null;
return (
<UnitControl
{ ...props }
aria-label={ __( '边框半径' ) }
disableUnits={ isMixed }
isOnly
value={ allValue }
onChange={ onChange }
placeholder={ allPlaceholder }
/>
);
}