UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

85 lines (69 loc) 2.96 kB
import _objectSpread from "@babel/runtime/helpers/objectSpread2"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; 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) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import * as React from 'react'; import classNames from 'classnames'; // eslint-disable-next-line react/prefer-stateless-function var Element = /*#__PURE__*/ function (_React$Component) { _inherits(Element, _React$Component); var _super = _createSuper(Element); function Element() { _classCallCheck(this, Element); return _super.apply(this, arguments); } _createClass(Element, [{ key: "render", value: function render() { var _classNames, _classNames2; var _this$props = this.props, prefixCls = _this$props.prefixCls, className = _this$props.className, style = _this$props.style, size = _this$props.size, shape = _this$props.shape; var sizeCls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _classNames)); var shapeCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-circle"), shape === 'circle'), _defineProperty(_classNames2, "".concat(prefixCls, "-square"), shape === 'square'), _defineProperty(_classNames2, "".concat(prefixCls, "-round"), shape === 'round'), _classNames2)); var sizeStyle = typeof size === 'number' ? { width: size, height: size, lineHeight: "".concat(size, "px") } : {}; return React.createElement("span", { className: classNames(prefixCls, className, sizeCls, shapeCls), style: _objectSpread({}, sizeStyle, {}, style) }); } }]); return Element; }(React.Component); export default Element; //# sourceMappingURL=Element.js.map