@lobehub/ui 1.52.0 → 1.54.0
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/Avatar/index.js
CHANGED
|
@@ -17,7 +17,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
17
17
|
size = _ref$size === void 0 ? 40 : _ref$size,
|
|
18
18
|
_ref$shape = _ref.shape,
|
|
19
19
|
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
20
|
-
background = _ref.background,
|
|
20
|
+
_ref$background = _ref.background,
|
|
21
|
+
background = _ref$background === void 0 ? 'rgba(0,0,0,0)' : _ref$background,
|
|
21
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
23
|
var isImage = Boolean(avatar && ['/', 'http', 'data:'].some(function (index) {
|
|
23
24
|
return avatar.startsWith(index);
|
|
@@ -43,7 +44,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
44
|
}, props), {}, {
|
|
44
45
|
children: emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
|
|
45
46
|
emoji: emoji,
|
|
46
|
-
size: size
|
|
47
|
+
size: size * 0.8
|
|
47
48
|
}) : text === null || text === void 0 ? void 0 : text.toUpperCase().slice(0, 2)
|
|
48
49
|
}));
|
|
49
50
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormItemProps as AntdFormItemProps } from 'antd';
|
|
3
|
+
import { type FormTitleProps } from './FormTitle';
|
|
3
4
|
export interface FormItemProps extends AntdFormItemProps {
|
|
4
|
-
|
|
5
|
+
avatar?: FormTitleProps['avatar'];
|
|
6
|
+
desc?: FormTitleProps['desc'];
|
|
5
7
|
divider?: boolean;
|
|
6
8
|
hidden?: boolean;
|
|
7
9
|
minWidth?: string | number;
|
|
8
|
-
tag?:
|
|
10
|
+
tag?: FormTitleProps['tag'];
|
|
9
11
|
}
|
|
10
12
|
declare const FormItem: import("react").NamedExoticComponent<FormItemProps>;
|
|
11
13
|
export default FormItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["desc", "tag", "minWidth", "className", "label", "children", "divider"];
|
|
3
|
+
var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider"];
|
|
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 { Form } from 'antd';
|
|
@@ -16,6 +16,7 @@ var FormItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
16
16
|
var desc = _ref.desc,
|
|
17
17
|
tag = _ref.tag,
|
|
18
18
|
minWidth = _ref.minWidth,
|
|
19
|
+
avatar = _ref.avatar,
|
|
19
20
|
className = _ref.className,
|
|
20
21
|
label = _ref.label,
|
|
21
22
|
children = _ref.children,
|
|
@@ -28,6 +29,7 @@ var FormItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
29
|
children: [divider && /*#__PURE__*/_jsx(FormDivider, {}), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({
|
|
29
30
|
className: cx(styles.item, className),
|
|
30
31
|
label: /*#__PURE__*/_jsx(FormTitle, {
|
|
32
|
+
avatar: avatar,
|
|
31
33
|
desc: desc,
|
|
32
34
|
tag: tag,
|
|
33
35
|
title: String(label)
|
|
@@ -8,11 +8,12 @@ var FormTitle = /*#__PURE__*/memo(function (_ref) {
|
|
|
8
8
|
var className = _ref.className,
|
|
9
9
|
tag = _ref.tag,
|
|
10
10
|
title = _ref.title,
|
|
11
|
-
desc = _ref.desc
|
|
11
|
+
desc = _ref.desc,
|
|
12
|
+
avatar = _ref.avatar;
|
|
12
13
|
var _useStyles = useStyles(),
|
|
13
14
|
cx = _useStyles.cx,
|
|
14
15
|
styles = _useStyles.styles;
|
|
15
|
-
|
|
16
|
+
var titleNode = /*#__PURE__*/_jsxs("div", {
|
|
16
17
|
className: cx(styles.formTitle, className),
|
|
17
18
|
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
18
19
|
align: 'center',
|
|
@@ -25,5 +26,14 @@ var FormTitle = /*#__PURE__*/memo(function (_ref) {
|
|
|
25
26
|
children: desc
|
|
26
27
|
})]
|
|
27
28
|
});
|
|
29
|
+
if (avatar) {
|
|
30
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
31
|
+
align: "center",
|
|
32
|
+
gap: 8,
|
|
33
|
+
horizontal: true,
|
|
34
|
+
children: [avatar, titleNode]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return titleNode;
|
|
28
38
|
});
|
|
29
39
|
export default FormTitle;
|
package/es/Form/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FormProps as AntFormProps, type FormInstance } from 'antd';
|
|
2
|
-
import { LucideIcon } from 'lucide-react';
|
|
3
2
|
import { type ReactNode } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { type FormGroupProps } from './components/FormGroup';
|
|
4
|
+
import { type FormItemProps } from './components/FormItem';
|
|
5
5
|
export interface ItemGroup {
|
|
6
6
|
children: FormItemProps[];
|
|
7
|
-
extra?:
|
|
8
|
-
icon?:
|
|
9
|
-
title:
|
|
7
|
+
extra?: FormGroupProps['extra'];
|
|
8
|
+
icon?: FormGroupProps['icon'];
|
|
9
|
+
title: FormGroupProps['title'];
|
|
10
10
|
}
|
|
11
11
|
export interface FormProps extends AntFormProps {
|
|
12
12
|
children?: ReactNode;
|