UNPKG

linkmore-design

Version:

🌈 πŸš€lmη»„δ»ΆεΊ“γ€‚πŸš€

44 lines (43 loc) β€’ 2.06 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["prefixCls", "component", "className", "setContentRef", "children", "direction"]; import classNames from 'classnames'; import { composeRef } from 'rc-util/lib/ref'; import * as React from 'react'; import { ConfigContext } from "../config-provider"; import warning from "../_util/warning"; var Typography = /*#__PURE__*/React.forwardRef(function (_ref, ref) { var customizePrefixCls = _ref.prefixCls, _ref$component = _ref.component, Component = _ref$component === void 0 ? 'article' : _ref$component, className = _ref.className, setContentRef = _ref.setContentRef, children = _ref.children, typographyDirection = _ref.direction, restProps = _objectWithoutProperties(_ref, _excluded); var _React$useContext = React.useContext(ConfigContext), getPrefixCls = _React$useContext.getPrefixCls, contextDirection = _React$useContext.direction; var direction = typographyDirection !== null && typographyDirection !== void 0 ? typographyDirection : contextDirection; var mergedRef = ref; if (setContentRef) { warning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.'); mergedRef = composeRef(ref, setContentRef); } var prefixCls = getPrefixCls('typography', customizePrefixCls); var componentClassName = classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className); return ( /*#__PURE__*/ // @ts-expect-error: Expression produces a union type that is too complex to represent. React.createElement(Component, _extends({ className: componentClassName, ref: mergedRef }, restProps), children) ); }); if (process.env.NODE_ENV !== 'production') { Typography.displayName = 'Typography'; } // es default export should use const instead of let export default Typography;