UNPKG

@gechiui/components

Version:
66 lines (62 loc) 1.56 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * GeChiUI dependencies */ import { memo } from '@gechiui/element'; /** * Internal dependencies */ import RangeCell from '../mobile/bottom-sheet/range-cell'; import StepperCell from '../mobile/bottom-sheet/stepper-cell'; const RangeControl = memo(_ref => { let { className, currentInput, label, value, instanceId, onChange, beforeIcon, afterIcon, help, allowReset, initialPosition, min, max, type, separatorType, ...props } = _ref; if (type === 'stepper') { return createElement(StepperCell, { label: label, max: max, min: min, onChange: onChange, separatorType: separatorType, value: value }); } const id = `inspector-range-control-${instanceId}`; const currentInputValue = currentInput === null ? value : currentInput; const initialSliderValue = isFinite(currentInputValue) ? currentInputValue : initialPosition; return createElement(RangeCell, _extends({ label: label, id: id, help: help, className: className, onChange: onChange, "aria-describedby": !!help ? `${id}__help` : undefined, minimumValue: min, maximumValue: max, value: value, beforeIcon: beforeIcon, afterIcon: afterIcon, allowReset: allowReset, defaultValue: initialSliderValue, separatorType: separatorType }, props)); }); export default RangeControl; //# sourceMappingURL=index.native.js.map