UNPKG

@ray-js/components

Version:

Ray basic components

35 lines 1.16 kB
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", "type", "color"]; import clsx from 'clsx'; import * as React from 'react'; import { inlineStyle } from '@ray-js/framework-shared'; import { Switch as RemaxSwitch } from '@ray-core/wechat'; import './index.module.less'; const Switch = props => { const { className, style, id, onChange, type = 'switch', color } = props, restProps = _objectWithoutProperties(props, _excluded); return /*#__PURE__*/React.createElement(RemaxSwitch, _extends({ id: id, onChange: e => { onChange === null || onChange === void 0 || onChange(_objectSpread(_objectSpread({}, e), {}, { type: 'change', value: e.detail.value, origin: e })); }, style: inlineStyle(style), className: clsx('raySwitch', className), type: type, color: color || '#007AFF' }, restProps)); }; export default Switch;