@lobehub/ui 2.5.0 → 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 +23 -8
- package/es/Text/styles.d.ts +6 -0
- package/es/Text/styles.js +17 -10
- package/es/Text/type.d.ts +1 -0
- package/package.json +1 -1
package/es/Text/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
var _excluded = ["as", "className", "children", "style", "type", "disabled", "strong", "italic", "underline", "delete", "mark", "code", "color", "weight", "ellipsis"];
|
|
3
|
+
var _excluded = ["as", "className", "children", "style", "type", "disabled", "strong", "italic", "underline", "delete", "fontSize", "mark", "code", "color", "weight", "ellipsis"];
|
|
4
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -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) {
|
|
@@ -26,6 +26,7 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
26
|
italic = _ref.italic,
|
|
27
27
|
underline = _ref.underline,
|
|
28
28
|
deleteStyle = _ref.delete,
|
|
29
|
+
fontSize = _ref.fontSize,
|
|
29
30
|
mark = _ref.mark,
|
|
30
31
|
code = _ref.code,
|
|
31
32
|
color = _ref.color,
|
|
@@ -39,6 +40,14 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
40
|
return cva(styles.text, {
|
|
40
41
|
defaultVariants: {},
|
|
41
42
|
variants: {
|
|
43
|
+
as: {
|
|
44
|
+
h1: styles.h1,
|
|
45
|
+
h2: styles.h2,
|
|
46
|
+
h3: styles.h3,
|
|
47
|
+
h4: styles.h4,
|
|
48
|
+
h5: styles.h5,
|
|
49
|
+
p: styles.p
|
|
50
|
+
},
|
|
42
51
|
code: {
|
|
43
52
|
true: styles.code
|
|
44
53
|
},
|
|
@@ -74,15 +83,18 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
74
83
|
}
|
|
75
84
|
});
|
|
76
85
|
}, [styles]);
|
|
77
|
-
var textStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, style), color && {
|
|
86
|
+
var textStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, style), color && {
|
|
78
87
|
color: color
|
|
79
88
|
}), weight && {
|
|
80
89
|
fontWeight: weight
|
|
81
90
|
}), _typeof(ellipsis) === 'object' && ellipsis.rows && {
|
|
82
91
|
WebkitLineClamp: ellipsis.rows
|
|
92
|
+
}), {}, {
|
|
93
|
+
fontSize: fontSize
|
|
83
94
|
});
|
|
84
95
|
var content = /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
|
|
85
96
|
className: cx(variants({
|
|
97
|
+
as: ['h1', 'h2', 'h3', 'h4', 'h5', 'p'].includes(Container) ? Container : undefined,
|
|
86
98
|
code: code,
|
|
87
99
|
delete: deleteStyle,
|
|
88
100
|
disabled: disabled,
|
|
@@ -99,13 +111,16 @@ var Text = /*#__PURE__*/memo(function (_ref) {
|
|
|
99
111
|
}));
|
|
100
112
|
|
|
101
113
|
// 处理带有 tooltip 的省略
|
|
102
|
-
if (ellipsis
|
|
103
|
-
|
|
104
|
-
title:
|
|
105
|
-
}
|
|
106
|
-
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), {}, {
|
|
107
118
|
children: content
|
|
108
119
|
}));
|
|
120
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
121
|
+
title: content,
|
|
122
|
+
children: content
|
|
123
|
+
});
|
|
109
124
|
}
|
|
110
125
|
return content;
|
|
111
126
|
});
|
package/es/Text/styles.d.ts
CHANGED
|
@@ -5,9 +5,15 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
5
5
|
disabled: import("antd-style").SerializedStyles;
|
|
6
6
|
ellipsis: import("antd-style").SerializedStyles;
|
|
7
7
|
ellipsisMulti: import("antd-style").SerializedStyles;
|
|
8
|
+
h1: import("antd-style").SerializedStyles;
|
|
9
|
+
h2: import("antd-style").SerializedStyles;
|
|
10
|
+
h3: import("antd-style").SerializedStyles;
|
|
11
|
+
h4: import("antd-style").SerializedStyles;
|
|
12
|
+
h5: import("antd-style").SerializedStyles;
|
|
8
13
|
info: import("antd-style").SerializedStyles;
|
|
9
14
|
italic: import("antd-style").SerializedStyles;
|
|
10
15
|
mark: import("antd-style").SerializedStyles;
|
|
16
|
+
p: import("antd-style").SerializedStyles;
|
|
11
17
|
secondary: import("antd-style").SerializedStyles;
|
|
12
18
|
strong: import("antd-style").SerializedStyles;
|
|
13
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;
|
|
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) {
|
|
@@ -11,14 +11,21 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
11
11
|
disabled: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n color: ", ";\n "])), token.colorTextDisabled),
|
|
12
12
|
ellipsis: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
13
13
|
ellipsisMulti: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n text-overflow: ellipsis;\n "]))),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
// Heading styles
|
|
15
|
+
h1: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: calc(", "px * 2.5);\n font-weight: bold;\n line-height: 1.25;\n "])), token.fontSize),
|
|
16
|
+
h2: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: calc(", "px * 2);\n font-weight: bold;\n line-height: 1.25;\n "])), token.fontSize),
|
|
17
|
+
h3: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: calc(", "px * 1.5);\n font-weight: bold;\n line-height: 1.25;\n "])), token.fontSize),
|
|
18
|
+
h4: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n font-size: calc(", "px * 1.25);\n font-weight: bold;\n line-height: 1.25;\n "])), token.fontSize),
|
|
19
|
+
h5: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-size: ", "px;\n font-weight: bold;\n line-height: 1.25;\n "])), token.fontSize),
|
|
20
|
+
info: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorInfo),
|
|
21
|
+
italic: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n font-style: italic;\n "]))),
|
|
22
|
+
mark: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n color: #000;\n background-color: ", ";\n "])), token.yellow),
|
|
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)
|
|
23
30
|
};
|
|
24
31
|
});
|
package/es/Text/type.d.ts
CHANGED