@lobehub/ui 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Text/Text.js +12 -8
- package/es/Text/styles.d.ts +1 -0
- package/es/Text/styles.js +8 -7
- package/package.json +1 -1
package/es/Text/Text.js
CHANGED
|
@@ -9,9 +9,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
-
import { Tooltip } from 'antd';
|
|
13
12
|
import { cva } from 'class-variance-authority';
|
|
14
13
|
import { memo, useMemo } from 'react';
|
|
14
|
+
import Tooltip from "../Tooltip";
|
|
15
15
|
import { useStyles } from "./styles";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
var Text = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -45,7 +45,8 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
45
|
h2: styles.h2,
|
|
46
46
|
h3: styles.h3,
|
|
47
47
|
h4: styles.h4,
|
|
48
|
-
h5: styles.h5
|
|
48
|
+
h5: styles.h5,
|
|
49
|
+
p: styles.p
|
|
49
50
|
},
|
|
50
51
|
code: {
|
|
51
52
|
true: styles.code
|
|
@@ -93,7 +94,7 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
93
94
|
});
|
|
94
95
|
var content = /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
|
|
95
96
|
className: cx(variants({
|
|
96
|
-
as: ['h1', 'h2', 'h3', 'h4', 'h5'].includes(Container) ? Container : undefined,
|
|
97
|
+
as: ['h1', 'h2', 'h3', 'h4', 'h5', 'p'].includes(Container) ? Container : undefined,
|
|
97
98
|
code: code,
|
|
98
99
|
delete: deleteStyle,
|
|
99
100
|
disabled: disabled,
|
|
@@ -110,13 +111,16 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
110
111
|
}));
|
|
111
112
|
|
|
112
113
|
// 处理带有 tooltip 的省略
|
|
113
|
-
if (ellipsis
|
|
114
|
-
|
|
115
|
-
title:
|
|
116
|
-
}
|
|
117
|
-
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
114
|
+
if (ellipsis) {
|
|
115
|
+
if (_typeof(ellipsis) === 'object') return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
|
|
116
|
+
title: content
|
|
117
|
+
}, ellipsis), {}, {
|
|
118
118
|
children: content
|
|
119
119
|
}));
|
|
120
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
121
|
+
title: content,
|
|
122
|
+
children: content
|
|
123
|
+
});
|
|
120
124
|
}
|
|
121
125
|
return content;
|
|
122
126
|
});
|
package/es/Text/styles.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
13
13
|
info: import("antd-style").SerializedStyles;
|
|
14
14
|
italic: import("antd-style").SerializedStyles;
|
|
15
15
|
mark: import("antd-style").SerializedStyles;
|
|
16
|
+
p: import("antd-style").SerializedStyles;
|
|
16
17
|
secondary: import("antd-style").SerializedStyles;
|
|
17
18
|
strong: import("antd-style").SerializedStyles;
|
|
18
19
|
success: import("antd-style").SerializedStyles;
|
package/es/Text/styles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
@@ -20,11 +20,12 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
20
20
|
info: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorInfo),
|
|
21
21
|
italic: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n font-style: italic;\n "]))),
|
|
22
22
|
mark: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n color: #000;\n background-color: ", ";\n "])), token.yellow),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
p: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n margin-block: 0;\n "]))),
|
|
24
|
+
secondary: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextSecondary),
|
|
25
|
+
strong: css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n font-weight: bold;\n "]))),
|
|
26
|
+
success: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorSuccess),
|
|
27
|
+
text: css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: ", ";\n "])), token.fontSize, token.lineHeight),
|
|
28
|
+
underline: css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n text-decoration: underline;\n "]))),
|
|
29
|
+
warning: css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorWarning)
|
|
29
30
|
};
|
|
30
31
|
});
|