44 lines
1.8 KiB
JavaScript
44 lines
1.8 KiB
JavaScript
"use strict";
|
|
"use client";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
var React = _interopRequireWildcard(require("react"));
|
|
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
|
var _warning = require("../_util/warning");
|
|
var _Base = _interopRequireDefault(require("./Base"));
|
|
var __rest = void 0 && (void 0).__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;
|
|
};
|
|
const Text = (_a, ref) => {
|
|
var {
|
|
ellipsis
|
|
} = _a,
|
|
restProps = __rest(_a, ["ellipsis"]);
|
|
const mergedEllipsis = React.useMemo(() => {
|
|
if (ellipsis && typeof ellipsis === 'object') {
|
|
return (0, _omit.default)(ellipsis, ['expandable', 'rows']);
|
|
}
|
|
return ellipsis;
|
|
}, [ellipsis]);
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
const warning = (0, _warning.devUseWarning)('Typography.Text');
|
|
process.env.NODE_ENV !== "production" ? warning(typeof ellipsis !== 'object' || !ellipsis || !('expandable' in ellipsis) && !('rows' in ellipsis), 'usage', '`ellipsis` do not support `expandable` or `rows` props.') : void 0;
|
|
}
|
|
return /*#__PURE__*/React.createElement(_Base.default, Object.assign({
|
|
ref: ref
|
|
}, restProps, {
|
|
ellipsis: mergedEllipsis,
|
|
component: "span"
|
|
}));
|
|
};
|
|
var _default = exports.default = /*#__PURE__*/React.forwardRef(Text); |