@ray-js/components
Version:
Ray basic components
55 lines • 1.75 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
const _excluded = ["className", "style", "id", "onChange", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "onCancel"];
import clsx from 'clsx';
import * as React from 'react';
import { inlineStyle, useTouch } from '@ray-js/framework-shared';
import { Picker as RemaxPicker } from '@ray-js/adapter';
const Picker = props => {
const {
className,
style,
id,
onChange,
onTouchStart,
onTouchMove,
onTouchEnd,
onTouchCancel,
onClick,
onCancel
} = props,
restProps = _objectWithoutProperties(props, _excluded);
const [touching, handlers] = useTouch({
onTouchStart,
onTouchMove,
onTouchEnd,
onTouchCancel,
onClick
});
return /*#__PURE__*/React.createElement(RemaxPicker, _extends({
onChange: e => {
onChange === null || onChange === void 0 || onChange(_objectSpread(_objectSpread({}, e), {}, {
type: e.type,
value: e.detail.value,
origin: e
}));
},
onCancel: e => {
onCancel === null || onCancel === void 0 || onCancel(_objectSpread(_objectSpread({}, e), {}, {
type: e.type,
origin: e
}));
},
onColumnChange: e => {
onCancel === null || onCancel === void 0 || onCancel(_objectSpread(_objectSpread({}, e), {}, {
type: e.type,
value: e.detail.value,
origin: e
}));
},
style: inlineStyle(style),
className: clsx(className)
}, restProps, handlers), props.children);
};
export default Picker;