Typography.js
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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 classNames from 'classnames';
import { composeRef } from "rc-util/es/ref";
import { ConfigConsumer } from '../config-provider';
import devWarning from '../_util/devWarning';
var Typography = function Typography(_a, ref) {
var customizePrefixCls = _a.prefixCls,
_a$component = _a.component,
component = _a$component === void 0 ? 'article' : _a$component,
className = _a.className,
ariaLabel = _a['aria-label'],
setContentRef = _a.setContentRef,
children = _a.children,
restProps = __rest(_a, ["prefixCls", "component", "className", 'aria-label', "setContentRef", "children"]);
var mergedRef = ref;
if (setContentRef) {
devWarning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.');
mergedRef = composeRef(ref, setContentRef);
}
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref) {
var getPrefixCls = _ref.getPrefixCls,
direction = _ref.direction;
var Component = component;
var prefixCls = getPrefixCls('typography', customizePrefixCls);
var componentClassName = classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className);
return /*#__PURE__*/React.createElement(Component, _extends({
className: componentClassName,
"aria-label": ariaLabel,
ref: mergedRef
}, restProps), children);
});
};
var RefTypography = /*#__PURE__*/React.forwardRef(Typography);
RefTypography.displayName = 'Typography'; // es default export should use const instead of let
var ExportTypography = RefTypography;
export default ExportTypography;