1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2 |
|
3 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4 |
|
5 | var __rest = this && this.__rest || function (s, e) {
|
6 | var t = {};
|
7 |
|
8 | for (var p in s) {
|
9 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
10 | }
|
11 |
|
12 | if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
13 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
14 | }
|
15 | return t;
|
16 | };
|
17 |
|
18 | import * as React from 'react';
|
19 | import classNames from 'classnames';
|
20 | import { ConfigConsumer } from '../config-provider';
|
21 | import devWarning from '../_util/devWarning';
|
22 | import { composeRef } from '../_util/ref';
|
23 |
|
24 | var Typography = function Typography(_a, ref) {
|
25 | var customizePrefixCls = _a.prefixCls,
|
26 | _a$component = _a.component,
|
27 | component = _a$component === void 0 ? 'article' : _a$component,
|
28 | className = _a.className,
|
29 | ariaLabel = _a['aria-label'],
|
30 | setContentRef = _a.setContentRef,
|
31 | children = _a.children,
|
32 | restProps = __rest(_a, ["prefixCls", "component", "className", 'aria-label', "setContentRef", "children"]);
|
33 |
|
34 | var mergedRef = ref;
|
35 |
|
36 | if (setContentRef) {
|
37 | devWarning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.');
|
38 | mergedRef = composeRef(ref, setContentRef);
|
39 | }
|
40 |
|
41 | return React.createElement(ConfigConsumer, null, function (_ref) {
|
42 | var getPrefixCls = _ref.getPrefixCls,
|
43 | direction = _ref.direction;
|
44 | var Component = component;
|
45 | var prefixCls = getPrefixCls('typography', customizePrefixCls);
|
46 | var componentClassName = classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'));
|
47 | return React.createElement(Component, _extends({
|
48 | className: componentClassName,
|
49 | "aria-label": ariaLabel,
|
50 | ref: mergedRef
|
51 | }, restProps), children);
|
52 | });
|
53 | };
|
54 |
|
55 | var RefTypography = React.forwardRef(Typography);
|
56 | RefTypography.displayName = 'Typography';
|
57 |
|
58 | var ExportTypography = RefTypography;
|
59 | export default ExportTypography; |
\ | No newline at end of file |