UNPKG

@jdcfe/yep-react

Version:

一套移动端的React组件库

68 lines (54 loc) 2.85 kB
import _extends from "@babel/runtime/helpers/extends"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; } if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import * as React from 'react'; import BaseCheckbox from './BaseCheckbox'; import classNames from 'classnames'; import CheckBoxGroup from './CheckBoxGroup'; var Checkbox = /*#__PURE__*/function (_React$PureComponent) { _inherits(Checkbox, _React$PureComponent); var _super = _createSuper(Checkbox); function Checkbox() { _classCallCheck(this, Checkbox); return _super.apply(this, arguments); } _createClass(Checkbox, [{ key: "render", value: function render() { var _a = this.props, className = _a.className, style = _a.style, children = _a.children, restProps = __rest(_a, ["className", "style", "children"]); var prefixCls = restProps.prefixCls; var wrapCls = classNames("".concat(prefixCls, "-wrapper"), className); return /*#__PURE__*/React.createElement("label", { className: wrapCls, style: style }, /*#__PURE__*/React.createElement(BaseCheckbox, _extends({}, restProps, children ? { label: children } : {}))); } }]); return Checkbox; }(React.PureComponent); export { Checkbox as default }; Checkbox.CheckBoxGroup = CheckBoxGroup; Checkbox.defaultProps = { prefixCls: 'Yep-checkbox' };