@lobehub/ui 1.20.0 → 1.20.1
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/ActionIcon/index.js +35 -24
- package/es/Avatar/index.d.ts +4 -3
- package/es/Avatar/index.js +31 -39
- package/es/Avatar/style.d.ts +5 -3
- package/es/Avatar/style.js +8 -4
- package/es/Icon/index.js +24 -13
- package/es/Icon/style.d.ts +1 -0
- package/es/Icon/style.js +3 -2
- package/es/Input/style.js +1 -1
- package/es/SearchBar/style.js +1 -1
- package/package.json +1 -2
package/es/ActionIcon/index.js
CHANGED
|
@@ -4,35 +4,13 @@ var _excluded = ["className", "active", "icon", "size", "style", "glass", "title
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { Loader2 } from 'lucide-react';
|
|
7
|
-
import { memo } from 'react';
|
|
7
|
+
import { memo, useMemo } from 'react';
|
|
8
8
|
import { Icon, Spotlight, Tooltip } from "./..";
|
|
9
9
|
import { useStyles } from "./style";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
var
|
|
14
|
-
var className = _ref.className,
|
|
15
|
-
active = _ref.active,
|
|
16
|
-
icon = _ref.icon,
|
|
17
|
-
_ref$size = _ref.size,
|
|
18
|
-
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
19
|
-
style = _ref.style,
|
|
20
|
-
glass = _ref.glass,
|
|
21
|
-
title = _ref.title,
|
|
22
|
-
placement = _ref.placement,
|
|
23
|
-
_ref$arrow = _ref.arrow,
|
|
24
|
-
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
25
|
-
spotlight = _ref.spotlight,
|
|
26
|
-
onClick = _ref.onClick,
|
|
27
|
-
children = _ref.children,
|
|
28
|
-
loading = _ref.loading,
|
|
29
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
var _useStyles = useStyles({
|
|
31
|
-
active: Boolean(active),
|
|
32
|
-
glass: Boolean(glass)
|
|
33
|
-
}),
|
|
34
|
-
styles = _useStyles.styles,
|
|
35
|
-
cx = _useStyles.cx;
|
|
13
|
+
var calcSize = function calcSize(size) {
|
|
36
14
|
var blockSize;
|
|
37
15
|
var borderRadius;
|
|
38
16
|
switch (size) {
|
|
@@ -57,6 +35,39 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
35
|
borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
|
|
58
36
|
break;
|
|
59
37
|
}
|
|
38
|
+
return {
|
|
39
|
+
blockSize: blockSize,
|
|
40
|
+
borderRadius: borderRadius
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
44
|
+
var className = _ref.className,
|
|
45
|
+
active = _ref.active,
|
|
46
|
+
icon = _ref.icon,
|
|
47
|
+
_ref$size = _ref.size,
|
|
48
|
+
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
49
|
+
style = _ref.style,
|
|
50
|
+
glass = _ref.glass,
|
|
51
|
+
title = _ref.title,
|
|
52
|
+
placement = _ref.placement,
|
|
53
|
+
_ref$arrow = _ref.arrow,
|
|
54
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
55
|
+
spotlight = _ref.spotlight,
|
|
56
|
+
onClick = _ref.onClick,
|
|
57
|
+
children = _ref.children,
|
|
58
|
+
loading = _ref.loading,
|
|
59
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
var _useStyles = useStyles({
|
|
61
|
+
active: Boolean(active),
|
|
62
|
+
glass: Boolean(glass)
|
|
63
|
+
}),
|
|
64
|
+
styles = _useStyles.styles,
|
|
65
|
+
cx = _useStyles.cx;
|
|
66
|
+
var _useMemo = useMemo(function () {
|
|
67
|
+
return calcSize(size);
|
|
68
|
+
}, [size]),
|
|
69
|
+
blockSize = _useMemo.blockSize,
|
|
70
|
+
borderRadius = _useMemo.borderRadius;
|
|
60
71
|
var content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
61
72
|
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
62
73
|
icon: icon,
|
package/es/Avatar/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type AvatarProps as AntAvatarProps } from 'antd';
|
|
3
|
+
export interface AvatarProps extends AntAvatarProps {
|
|
3
4
|
/**
|
|
4
5
|
* @description The URL or base64 data of the avatar image
|
|
5
6
|
*/
|
|
@@ -23,5 +24,5 @@ export interface AvatarProps {
|
|
|
23
24
|
*/
|
|
24
25
|
title?: string;
|
|
25
26
|
}
|
|
26
|
-
declare const Avatar:
|
|
27
|
+
declare const Avatar: import("react").NamedExoticComponent<AvatarProps>;
|
|
27
28
|
export default Avatar;
|
package/es/Avatar/index.js
CHANGED
|
@@ -1,51 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "avatar", "title", "size", "shape", "background"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
import { Avatar as AntAvatar } from 'antd';
|
|
7
|
+
import { memo } from 'react';
|
|
3
8
|
import { useStyles } from "./style";
|
|
4
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
var Avatar = function
|
|
6
|
-
var
|
|
10
|
+
var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
+
var className = _ref.className,
|
|
12
|
+
avatar = _ref.avatar,
|
|
7
13
|
title = _ref.title,
|
|
8
14
|
_ref$size = _ref.size,
|
|
9
15
|
size = _ref$size === void 0 ? 40 : _ref$size,
|
|
10
16
|
_ref$shape = _ref.shape,
|
|
11
17
|
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
12
|
-
background = _ref.background
|
|
13
|
-
|
|
18
|
+
background = _ref.background,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var _useStyles = useStyles({
|
|
21
|
+
background: background,
|
|
22
|
+
size: size
|
|
23
|
+
}),
|
|
14
24
|
styles = _useStyles.styles,
|
|
15
|
-
|
|
16
|
-
var backgroundColor = background !== null && background !== void 0 ? background : theme.colorBgContainer;
|
|
25
|
+
cx = _useStyles.cx;
|
|
17
26
|
var isImage = avatar && ['/', 'http', 'data:'].some(function (i) {
|
|
18
27
|
return avatar.startsWith(i);
|
|
19
28
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
className: styles.border,
|
|
35
|
-
shape: shape,
|
|
36
|
-
size: size,
|
|
37
|
-
src: avatar
|
|
38
|
-
}) : /*#__PURE__*/_jsx(Center, {
|
|
39
|
-
className: styles.border,
|
|
40
|
-
style: {
|
|
41
|
-
width: size,
|
|
42
|
-
height: size,
|
|
43
|
-
fontSize: size / 2,
|
|
44
|
-
borderRadius: shape === 'circle' ? '50%' : 6,
|
|
45
|
-
backgroundColor: backgroundColor
|
|
46
|
-
},
|
|
47
|
-
children: avatar
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
};
|
|
29
|
+
var text = isImage ? title : avatar;
|
|
30
|
+
return !isImage ? /*#__PURE__*/_jsx(AntAvatar, _objectSpread(_objectSpread({
|
|
31
|
+
className: cx(styles.avatar, className),
|
|
32
|
+
shape: shape,
|
|
33
|
+
size: size
|
|
34
|
+
}, props), {}, {
|
|
35
|
+
children: text === null || text === void 0 ? void 0 : text.toUpperCase().slice(0, 2)
|
|
36
|
+
})) : /*#__PURE__*/_jsx(AntAvatar, _objectSpread({
|
|
37
|
+
className: cx(styles.avatar, className),
|
|
38
|
+
shape: shape,
|
|
39
|
+
size: size,
|
|
40
|
+
src: avatar
|
|
41
|
+
}, props));
|
|
42
|
+
});
|
|
51
43
|
export default Avatar;
|
package/es/Avatar/style.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare const useStyles: (props?:
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
background?: string | undefined;
|
|
3
|
+
size: number;
|
|
4
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
|
+
avatar: import("antd-style").SerializedStyles;
|
|
4
6
|
}>;
|
package/es/Avatar/style.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject
|
|
2
|
+
var _templateObject;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
|
|
4
|
+
import { readableColor } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
6
|
var css = _ref.css,
|
|
6
7
|
token = _ref.token;
|
|
8
|
+
var background = _ref2.background,
|
|
9
|
+
size = _ref2.size;
|
|
10
|
+
var backgroundColor = background !== null && background !== void 0 ? background : token.colorBgContainer;
|
|
11
|
+
var color = readableColor(backgroundColor);
|
|
7
12
|
return {
|
|
8
|
-
|
|
9
|
-
border: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorSplit)
|
|
13
|
+
avatar: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n font-size: ", "px;\n font-weight: 700;\n line-height: 1;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n\n > * {\n cursor: pointer;\n }\n "])), size * 0.5, color, backgroundColor, background ? 'transparent' : token.colorSplit)
|
|
10
14
|
};
|
|
11
15
|
});
|
package/es/Icon/index.js
CHANGED
|
@@ -3,20 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["icon", "size", "style", "className", "spin"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
import { memo } from 'react';
|
|
6
|
+
import { memo, useMemo } from 'react';
|
|
7
7
|
import { useStyles } from "./style";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
var
|
|
10
|
-
var icon = _ref.icon,
|
|
11
|
-
size = _ref.size,
|
|
12
|
-
style = _ref.style,
|
|
13
|
-
className = _ref.className,
|
|
14
|
-
spin = _ref.spin,
|
|
15
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
var _useStyles = useStyles(),
|
|
17
|
-
styles = _useStyles.styles,
|
|
18
|
-
cx = _useStyles.cx;
|
|
19
|
-
var SvgIcon = icon;
|
|
9
|
+
var calcSize = function calcSize(size) {
|
|
20
10
|
var fontSize;
|
|
21
11
|
var strokeWidth;
|
|
22
12
|
switch (size) {
|
|
@@ -42,8 +32,29 @@ var Icon = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
32
|
}
|
|
43
33
|
break;
|
|
44
34
|
}
|
|
35
|
+
return {
|
|
36
|
+
fontSize: fontSize,
|
|
37
|
+
strokeWidth: strokeWidth
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
var Icon = /*#__PURE__*/memo(function (_ref) {
|
|
41
|
+
var icon = _ref.icon,
|
|
42
|
+
size = _ref.size,
|
|
43
|
+
style = _ref.style,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
spin = _ref.spin,
|
|
46
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var _useStyles = useStyles(),
|
|
48
|
+
styles = _useStyles.styles,
|
|
49
|
+
cx = _useStyles.cx;
|
|
50
|
+
var SvgIcon = icon;
|
|
51
|
+
var _useMemo = useMemo(function () {
|
|
52
|
+
return calcSize(size);
|
|
53
|
+
}, [size]),
|
|
54
|
+
fontSize = _useMemo.fontSize,
|
|
55
|
+
strokeWidth = _useMemo.strokeWidth;
|
|
45
56
|
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
46
|
-
className: cx(spin && styles.spin, className),
|
|
57
|
+
className: cx(styles.icon, spin && styles.spin, className),
|
|
47
58
|
style: _objectSpread({
|
|
48
59
|
width: fontSize,
|
|
49
60
|
height: fontSize
|
package/es/Icon/style.d.ts
CHANGED
package/es/Icon/style.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { createStyles, keyframes } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css;
|
|
6
6
|
var spin = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n "])));
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
icon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n "]))),
|
|
9
|
+
spin: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " 1s linear infinite;\n "])), spin)
|
|
9
10
|
};
|
|
10
11
|
});
|
package/es/Input/style.js
CHANGED
|
@@ -8,7 +8,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
8
8
|
var type = _ref2.type;
|
|
9
9
|
var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder);
|
|
10
10
|
return {
|
|
11
|
-
input: cx(typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n height: 36px;\n padding: 0 12px;\n\n transition: background-color 100ms ", ";\n\n input {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n\n
|
|
11
|
+
input: cx(typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n height: 36px;\n padding: 0 12px;\n\n transition: background-color 100ms ", ",\n border-color 200ms ", ";\n\n input {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:focus {\n border-color: ", ";\n }\n\n &.ant-input-affix-wrapper-focused {\n border-color: ", ";\n }\n "])), token.motionEaseOut, token.motionEaseOut, token.colorFillTertiary, token.colorTextQuaternary, token.colorTextQuaternary)),
|
|
12
12
|
textarea: cx(typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n padding: 8px 12px;\n transition: background-color 100ms ", ";\n\n textarea {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n\n &:focus {\n border-color: ", ";\n }\n "])), token.motionEaseOut, token.colorFillTertiary, token.colorBorder, token.colorTextQuaternary))
|
|
13
13
|
};
|
|
14
14
|
});
|
package/es/SearchBar/style.js
CHANGED
|
@@ -5,7 +5,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
|
-
search: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n
|
|
8
|
+
search: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n "]))),
|
|
9
9
|
input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 8px 0 12px;\n "]))),
|
|
10
10
|
tag: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n "]))),
|
|
11
11
|
icon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextPlaceholder)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building chatbot web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -114,7 +114,6 @@
|
|
|
114
114
|
"antd": "^5",
|
|
115
115
|
"antd-style": "^3",
|
|
116
116
|
"commitlint": "^17",
|
|
117
|
-
"commitlint-config-gitmoji": "^2",
|
|
118
117
|
"concurrently": "^8",
|
|
119
118
|
"cross-env": "^7",
|
|
120
119
|
"dumi": "^2",
|