UNPKG

@gechiui/components

Version:
67 lines (62 loc) 1.68 kB
import { createElement } from "@gechiui/element"; /** * External dependencies */ import classnames from 'classnames'; /** * GeChiUI dependencies */ import { __ } from '@gechiui/i18n'; /** * Internal dependencies */ import { FlexBlock, FlexItem } from '../flex'; import NumberControl from '../input-control'; import AngleCircle from './angle-circle'; import { Root } from './styles/angle-picker-control-styles'; import { space } from '../ui/utils/space'; import { Text } from '../text'; import { Spacer } from '../spacer'; export default function AnglePickerControl(_ref) { let { className, label = __('角度'), onChange, value } = _ref; const handleOnNumberChange = unprocessedValue => { const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0; onChange(inputValue); }; const classes = classnames('components-angle-picker-control', className); return createElement(Root, { className: classes }, createElement(FlexBlock, null, createElement(NumberControl, { label: label, className: "components-angle-picker-control__input-field", max: 360, min: 0, onChange: handleOnNumberChange, step: "1", value: value, hideHTMLArrows: true, suffix: createElement(Spacer, { as: Text, marginRight: space(3), style: { color: 'var( --gc-admin-theme-color )' } }, "\xB0") })), createElement(FlexItem, { style: { marginLeft: space(4), marginBottom: space(1), marginTop: 'auto' } }, createElement(AngleCircle, { "aria-hidden": "true", value: value, onChange: onChange }))); } //# sourceMappingURL=index.js.map