@lobehub/ui 1.91.0 → 1.93.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/ActionIcon/index.js +1 -0
- package/es/ActionIcon/style.d.ts +1 -0
- package/es/ActionIcon/style.js +3 -2
- package/es/Avatar/index.js +4 -2
- package/es/ChatInputArea/Action.js +4 -2
- package/es/ChatInputArea/Desktop.d.ts +17 -0
- package/es/ChatInputArea/Desktop.js +131 -0
- package/es/ChatInputArea/Mobile.d.ts +17 -0
- package/es/ChatInputArea/Mobile.js +132 -0
- package/es/ChatInputArea/index.d.ts +15 -67
- package/es/ChatInputArea/index.js +11 -125
- package/es/ChatInputArea/style.mobile.d.ts +5 -0
- package/es/ChatInputArea/style.mobile.js +12 -0
- package/es/ChatInputArea/type.d.ts +33 -0
- package/es/ChatInputArea/type.js +1 -0
- package/es/ChatItem/components/Actions.d.ts +1 -0
- package/es/ChatItem/components/Actions.js +3 -1
- package/es/ChatItem/components/BorderSpacing.d.ts +1 -2
- package/es/ChatItem/components/MessageContent.js +2 -1
- package/es/ChatItem/components/Title.js +4 -1
- package/es/ChatItem/index.js +20 -10
- package/es/ChatItem/style.d.ts +4 -3
- package/es/ChatItem/style.js +18 -15
- package/es/ChatItem/type.d.ts +0 -4
- package/es/EmptyCard/index.d.ts +15 -0
- package/es/EmptyCard/index.js +67 -0
- package/es/EmptyCard/style.d.ts +7 -0
- package/es/EmptyCard/style.js +15 -0
- package/es/FluentEmoji/index.js +1 -4
- package/es/SearchBar/index.d.ts +3 -0
- package/es/SearchBar/index.js +13 -8
- package/es/SelectWithImg/index.d.ts +27 -0
- package/es/SelectWithImg/index.js +78 -0
- package/es/SelectWithImg/styles.d.ts +7 -0
- package/es/SelectWithImg/styles.js +17 -0
- package/es/SpotlightCard/SpotlightCardItem.js +1 -1
- package/es/SpotlightCard/index.d.ts +2 -1
- package/es/SpotlightCard/index.js +13 -4
- package/es/SpotlightCard/style.js +1 -1
- package/es/TokenTag/index.js +4 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ActionProps } from "./Action";
|
|
3
|
+
export interface ChatInputBase extends ActionProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description Default value for the input area
|
|
6
|
+
*/
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description Footer content to be displayed below the input area
|
|
10
|
+
*/
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @description Whether the input area is in loading state
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @description Callback function when the input value changes
|
|
19
|
+
* @param value - The current value of the input area
|
|
20
|
+
*/
|
|
21
|
+
onInputChange?: (value: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* @description Callback function when the send button is clicked
|
|
24
|
+
* @param value - The current value of the input area
|
|
25
|
+
*/
|
|
26
|
+
onSend?: (value: string) => void;
|
|
27
|
+
onStop?: () => void;
|
|
28
|
+
text?: {
|
|
29
|
+
send?: string;
|
|
30
|
+
stop?: string;
|
|
31
|
+
};
|
|
32
|
+
value?: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,8 +4,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
var Actions = /*#__PURE__*/memo(function (_ref) {
|
|
5
5
|
var actions = _ref.actions,
|
|
6
6
|
placement = _ref.placement,
|
|
7
|
-
type = _ref.type
|
|
7
|
+
type = _ref.type,
|
|
8
|
+
editing = _ref.editing;
|
|
8
9
|
var _useStyles = useStyles({
|
|
10
|
+
editing: editing,
|
|
9
11
|
placement: placement,
|
|
10
12
|
type: type
|
|
11
13
|
}),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ChatItemProps } from "..";
|
|
3
2
|
export interface BorderSpacingProps {
|
|
4
|
-
borderSpacing?:
|
|
3
|
+
borderSpacing?: number;
|
|
5
4
|
}
|
|
6
5
|
declare const BorderSpacing: import("react").NamedExoticComponent<BorderSpacingProps>;
|
|
7
6
|
export default BorderSpacing;
|
|
@@ -16,6 +16,7 @@ var Loading = /*#__PURE__*/memo(function (_ref) {
|
|
|
16
16
|
type = _ref.type,
|
|
17
17
|
primary = _ref.primary;
|
|
18
18
|
var _useStyles = useStyles({
|
|
19
|
+
editing: editing,
|
|
19
20
|
placement: placement,
|
|
20
21
|
primary: primary,
|
|
21
22
|
type: type
|
|
@@ -24,7 +25,7 @@ var Loading = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
25
|
styles = _useStyles.styles;
|
|
25
26
|
var content = /*#__PURE__*/_jsx(EditableMessage, {
|
|
26
27
|
classNames: {
|
|
27
|
-
|
|
28
|
+
input: styles.editingInput
|
|
28
29
|
},
|
|
29
30
|
editButtonSize: 'small',
|
|
30
31
|
editing: editing,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
|
+
import { Flexbox } from 'react-layout-kit';
|
|
2
3
|
import { formatTime } from "../../utils/formatTime";
|
|
3
4
|
import { useStyles } from "../style";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -13,8 +14,10 @@ var Title = /*#__PURE__*/memo(function (_ref) {
|
|
|
13
14
|
showTitle: showTitle
|
|
14
15
|
}),
|
|
15
16
|
styles = _useStyles.styles;
|
|
16
|
-
return /*#__PURE__*/_jsxs(
|
|
17
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
17
18
|
className: styles.name,
|
|
19
|
+
gap: 4,
|
|
20
|
+
horizontal: true,
|
|
18
21
|
children: [showTitle ? avatar.title || 'untitled' : undefined, time && /*#__PURE__*/_jsx("time", {
|
|
19
22
|
children: formatTime(time)
|
|
20
23
|
})]
|
package/es/ChatItem/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["avatarAddon", "onAvatarClick", "actions", "className", "primary", "
|
|
3
|
+
var _excluded = ["avatarAddon", "onAvatarClick", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "ErrorMessage"];
|
|
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 { useResponsive } from 'antd-style';
|
|
6
7
|
import { memo } from 'react';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
9
|
import Actions from "./components/Actions";
|
|
8
10
|
import Avatar from "./components/Avatar";
|
|
9
11
|
import BorderSpacing from "./components/BorderSpacing";
|
|
@@ -13,13 +15,13 @@ import Title from "./components/Title";
|
|
|
13
15
|
import { useStyles } from "./style";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var MOBILE_AVATAR_SIZE = 32;
|
|
16
19
|
var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
17
20
|
var avatarAddon = _ref.avatarAddon,
|
|
18
21
|
onAvatarClick = _ref.onAvatarClick,
|
|
19
22
|
actions = _ref.actions,
|
|
20
23
|
className = _ref.className,
|
|
21
24
|
primary = _ref.primary,
|
|
22
|
-
borderSpacing = _ref.borderSpacing,
|
|
23
25
|
loading = _ref.loading,
|
|
24
26
|
message = _ref.message,
|
|
25
27
|
_ref$placement = _ref.placement,
|
|
@@ -38,7 +40,10 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
38
40
|
text = _ref.text,
|
|
39
41
|
ErrorMessage = _ref.ErrorMessage,
|
|
40
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
var _useResponsive = useResponsive(),
|
|
44
|
+
mobile = _useResponsive.mobile;
|
|
41
45
|
var _useStyles = useStyles({
|
|
46
|
+
editing: editing,
|
|
42
47
|
placement: placement,
|
|
43
48
|
primary: primary,
|
|
44
49
|
showTitle: showTitle,
|
|
@@ -47,24 +52,28 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
52
|
}),
|
|
48
53
|
cx = _useStyles.cx,
|
|
49
54
|
styles = _useStyles.styles;
|
|
50
|
-
return /*#__PURE__*/_jsxs(
|
|
51
|
-
className: cx(styles.container, className)
|
|
55
|
+
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
56
|
+
className: cx(styles.container, className),
|
|
57
|
+
gap: mobile ? 6 : 12,
|
|
58
|
+
horizontal: true
|
|
52
59
|
}, props), {}, {
|
|
53
60
|
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
54
61
|
addon: avatarAddon,
|
|
55
62
|
avatar: avatar,
|
|
56
63
|
loading: loading,
|
|
57
64
|
onClick: onAvatarClick,
|
|
58
|
-
placement: placement
|
|
59
|
-
|
|
65
|
+
placement: placement,
|
|
66
|
+
size: mobile ? MOBILE_AVATAR_SIZE : undefined
|
|
67
|
+
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
60
68
|
className: styles.messageContainer,
|
|
61
69
|
children: [/*#__PURE__*/_jsx(Title, {
|
|
62
70
|
avatar: avatar,
|
|
63
71
|
placement: placement,
|
|
64
72
|
showTitle: showTitle,
|
|
65
73
|
time: time
|
|
66
|
-
}), /*#__PURE__*/_jsxs(
|
|
74
|
+
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
67
75
|
className: styles.messageContent,
|
|
76
|
+
gap: 8,
|
|
68
77
|
children: [error ? /*#__PURE__*/_jsx(ErrorContent, {
|
|
69
78
|
ErrorMessage: ErrorMessage,
|
|
70
79
|
error: error,
|
|
@@ -80,14 +89,15 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
80
89
|
renderMessage: renderMessage,
|
|
81
90
|
text: text,
|
|
82
91
|
type: type
|
|
83
|
-
}),
|
|
92
|
+
}), /*#__PURE__*/_jsx(Actions, {
|
|
84
93
|
actions: actions,
|
|
94
|
+
editing: editing,
|
|
85
95
|
placement: placement,
|
|
86
96
|
type: type
|
|
87
97
|
})]
|
|
88
98
|
})]
|
|
89
|
-
}), /*#__PURE__*/_jsx(BorderSpacing, {
|
|
90
|
-
borderSpacing:
|
|
99
|
+
}), mobile && type === 'block' && /*#__PURE__*/_jsx(BorderSpacing, {
|
|
100
|
+
borderSpacing: MOBILE_AVATAR_SIZE
|
|
91
101
|
})]
|
|
92
102
|
}));
|
|
93
103
|
});
|
package/es/ChatItem/style.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export declare const useStyles: (props?: {
|
|
2
2
|
avatarSize?: number | undefined;
|
|
3
|
+
editing?: boolean | undefined;
|
|
3
4
|
placement?: "left" | "right" | undefined;
|
|
4
5
|
primary?: boolean | undefined;
|
|
5
6
|
showTitle?: boolean | undefined;
|
|
6
7
|
title?: string | undefined;
|
|
7
8
|
type?: "block" | "pure" | undefined;
|
|
8
9
|
} | undefined) => import("antd-style").ReturnStyles<{
|
|
9
|
-
actions:
|
|
10
|
+
actions: string;
|
|
10
11
|
alert: import("antd-style").SerializedStyles;
|
|
11
12
|
avatarContainer: import("antd-style").SerializedStyles;
|
|
12
13
|
avatarGroupContainer: import("antd-style").SerializedStyles;
|
|
@@ -15,8 +16,8 @@ export declare const useStyles: (props?: {
|
|
|
15
16
|
editingInput: import("antd-style").SerializedStyles;
|
|
16
17
|
loading: import("antd-style").SerializedStyles;
|
|
17
18
|
message: string;
|
|
18
|
-
messageContainer:
|
|
19
|
-
messageContent:
|
|
19
|
+
messageContainer: string;
|
|
20
|
+
messageContent: string;
|
|
20
21
|
messageExtra: string;
|
|
21
22
|
name: import("antd-style").SerializedStyles;
|
|
22
23
|
}>;
|
package/es/ChatItem/style.js
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var cx = _ref.cx,
|
|
6
6
|
css = _ref.css,
|
|
7
7
|
token = _ref.token,
|
|
8
|
-
isDarkMode = _ref.isDarkMode
|
|
8
|
+
isDarkMode = _ref.isDarkMode,
|
|
9
|
+
responsive = _ref.responsive;
|
|
9
10
|
var placement = _ref2.placement,
|
|
10
11
|
type = _ref2.type,
|
|
11
12
|
title = _ref2.title,
|
|
12
13
|
primary = _ref2.primary,
|
|
13
14
|
avatarSize = _ref2.avatarSize,
|
|
14
|
-
showTitle = _ref2.showTitle
|
|
15
|
+
showTitle = _ref2.showTitle,
|
|
16
|
+
editing = _ref2.editing;
|
|
15
17
|
var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 12px;\n background-color: ", ";\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFill : token.colorBgElevated : isDarkMode ? token.colorFillSecondary : token.colorBgContainer, token.borderRadiusLG, token.motionEaseOut);
|
|
16
18
|
var pureStylish = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-top: ", ";\n "])), title ? 0 : '6px');
|
|
17
19
|
var pureContainerStylish = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: -16px;\n transition: background-color 100ms ", ";\n "])), token.motionEaseOut);
|
|
18
20
|
var typeStylish = type === 'block' ? blockStylish : pureStylish;
|
|
21
|
+
var editingStylish = editing && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
19
22
|
return {
|
|
20
|
-
actions: css(
|
|
21
|
-
alert: css(
|
|
22
|
-
avatarContainer: css(
|
|
23
|
-
avatarGroupContainer: css(
|
|
24
|
-
container: cx(type === 'pure' && pureContainerStylish, css(
|
|
25
|
-
editingContainer: cx(css(
|
|
26
|
-
editingInput: css(
|
|
27
|
-
loading: css(
|
|
28
|
-
message: cx(typeStylish, css(
|
|
29
|
-
messageContainer: css(
|
|
30
|
-
messageContent: css(
|
|
23
|
+
actions: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n align-self: ", ";\n justify-content: ", ";\n "])), type === 'block' ? 'flex-end' : placement === 'left' ? 'flex-start' : 'flex-end', placement === 'left' ? 'flex-end' : 'flex-start'), editing && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none !important;\n opacity: 0 !important;\n "])))),
|
|
24
|
+
alert: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n span[role='img'] {\n align-self: flex-start;\n width: 16px;\n height: 16px;\n margin-top: 3px;\n }\n\n .ant-alert-description {\n text-align: justify;\n word-break: break-all;\n word-wrap: break-word;\n }\n\n &.ant-alert-with-description {\n padding-block: 12px;\n padding-inline: 12px;\n\n .ant-alert-message {\n font-size: 14px;\n font-weight: 600;\n text-align: justify;\n word-break: break-all;\n word-wrap: break-word;\n }\n }\n "]))),
|
|
25
|
+
avatarContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n flex: none;\n width: ", "px;\n height: ", "px;\n "])), avatarSize, avatarSize),
|
|
26
|
+
avatarGroupContainer: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), avatarSize),
|
|
27
|
+
container: cx(type === 'pure' && pureContainerStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: ", ";\n justify-content: revert;\n\n width: 100%;\n max-width: 100vw;\n padding: 12px 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='chat-item-actions'] {\n display: flex;\n }\n\n time,\n div[role='chat-item-actions'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='chat-item-actions'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 16px;\n }\n "])), placement === 'left' ? 'row' : 'row-reverse', token.motionEaseOut, responsive.mobile)),
|
|
28
|
+
editingContainer: cx(editingStylish, css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 8px 12px 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
|
|
29
|
+
editingInput: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n width: 100%;\n "]))),
|
|
30
|
+
loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", ";\n bottom: 0;\n left: ", ";\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), placement === 'left' ? '-4px' : 'unset', placement === 'right' ? '-4px' : 'unset', token.colorBgLayout, token.colorPrimary),
|
|
31
|
+
message: cx(typeStylish, css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n position: relative;\n "])))),
|
|
32
|
+
messageContainer: cx(editingStylish, css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n align-items: ", ";\n "])), placement === 'left' ? 'flex-start' : 'flex-end')),
|
|
33
|
+
messageContent: cx(editingStylish, css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n position: relative;\n overflow-x: hidden;\n flex-direction: ", ";\n align-items: ", ";\n\n ", " {\n flex-direction: column;\n }\n "])), type === 'block' ? placement === 'left' ? 'row' : 'row-reverse' : 'column', placement === 'left' ? 'flex-start' : 'flex-end', responsive.mobile)),
|
|
31
34
|
messageExtra: cx('message-extra'),
|
|
32
|
-
name: css(
|
|
35
|
+
name: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n position: ", ";\n top: ", ";\n right: ", ";\n left: ", ";\n\n flex-direction: ", ";\n\n margin-bottom: 6px;\n\n font-size: 12px;\n line-height: 1;\n color: ", ";\n text-align: ", ";\n "])), showTitle ? 'relative' : 'absolute', showTitle ? 'unset' : '-16px', placement === 'right' ? '0' : 'unset', placement === 'left' ? '0' : 'unset', placement === 'left' ? 'row' : 'row-reverse', token.colorTextDescription, placement === 'left' ? 'left' : 'right')
|
|
33
36
|
};
|
|
34
37
|
});
|
package/es/ChatItem/type.d.ts
CHANGED
|
@@ -13,10 +13,6 @@ export interface ChatItemProps {
|
|
|
13
13
|
*/
|
|
14
14
|
avatar: MetaData;
|
|
15
15
|
avatarAddon?: ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* @description Whether to add border spacing
|
|
18
|
-
*/
|
|
19
|
-
borderSpacing?: number | string;
|
|
20
16
|
/**
|
|
21
17
|
* @description Custom CSS class name for the chat item
|
|
22
18
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DivProps } from "..";
|
|
3
|
+
export interface EmptyCardProps extends DivProps {
|
|
4
|
+
alt?: string;
|
|
5
|
+
cover?: string;
|
|
6
|
+
defaultVisible?: boolean;
|
|
7
|
+
desc: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
10
|
+
title: string;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
width?: number;
|
|
13
|
+
}
|
|
14
|
+
declare const EmptyCard: import("react").NamedExoticComponent<EmptyCardProps>;
|
|
15
|
+
export default EmptyCard;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["cover", "visible", "defaultVisible", "onVisibleChange", "alt", "title", "desc", "width", "height"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { ActionIcon } from "./..";
|
|
8
|
+
import { X } from 'lucide-react';
|
|
9
|
+
import { memo } from 'react';
|
|
10
|
+
import { Flexbox } from 'react-layout-kit';
|
|
11
|
+
import useMergeState from 'use-merge-value';
|
|
12
|
+
import { useStyles } from "./style";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var EmptyCard = /*#__PURE__*/memo(function (_ref) {
|
|
16
|
+
var cover = _ref.cover,
|
|
17
|
+
visible = _ref.visible,
|
|
18
|
+
defaultVisible = _ref.defaultVisible,
|
|
19
|
+
onVisibleChange = _ref.onVisibleChange,
|
|
20
|
+
alt = _ref.alt,
|
|
21
|
+
title = _ref.title,
|
|
22
|
+
desc = _ref.desc,
|
|
23
|
+
width = _ref.width,
|
|
24
|
+
height = _ref.height,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _useMergeState = useMergeState(true, {
|
|
27
|
+
defaultValue: defaultVisible,
|
|
28
|
+
onChange: onVisibleChange,
|
|
29
|
+
value: visible
|
|
30
|
+
}),
|
|
31
|
+
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
32
|
+
value = _useMergeState2[0],
|
|
33
|
+
setValue = _useMergeState2[1];
|
|
34
|
+
var _useStyles = useStyles(),
|
|
35
|
+
styles = _useStyles.styles;
|
|
36
|
+
if (!value) return null;
|
|
37
|
+
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
38
|
+
className: styles.container
|
|
39
|
+
}, props), {}, {
|
|
40
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
41
|
+
className: styles.close,
|
|
42
|
+
icon: X,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return setValue(false);
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
blockSize: 24,
|
|
48
|
+
fontSize: 16
|
|
49
|
+
}
|
|
50
|
+
}), cover && /*#__PURE__*/_jsx("img", {
|
|
51
|
+
alt: alt,
|
|
52
|
+
className: styles.image,
|
|
53
|
+
height: height,
|
|
54
|
+
src: cover,
|
|
55
|
+
width: width
|
|
56
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
57
|
+
className: styles.content,
|
|
58
|
+
children: [title && /*#__PURE__*/_jsx("h3", {
|
|
59
|
+
children: title
|
|
60
|
+
}), desc && /*#__PURE__*/_jsx("p", {
|
|
61
|
+
className: styles.desc,
|
|
62
|
+
children: desc
|
|
63
|
+
})]
|
|
64
|
+
})]
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
export default EmptyCard;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
close: import("antd-style").SerializedStyles;
|
|
3
|
+
container: import("antd-style").SerializedStyles;
|
|
4
|
+
content: import("antd-style").SerializedStyles;
|
|
5
|
+
desc: import("antd-style").SerializedStyles;
|
|
6
|
+
image: import("antd-style").SerializedStyles;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
isDarkMode = _ref.isDarkMode;
|
|
8
|
+
return {
|
|
9
|
+
close: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 8px;\n right: 8px;\n "]))),
|
|
10
|
+
container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n background: linear-gradient(\n to bottom,\n ", ",\n ", "\n );\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), isDarkMode ? token.colorBgElevated : token.colorBgLayout, token.colorBgContainer, token.colorBorderSecondary, token.borderRadius),
|
|
11
|
+
content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0 16px 16px;\n "]))),
|
|
12
|
+
desc: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextDescription),
|
|
13
|
+
image: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n align-self: center;\n "])))
|
|
14
|
+
};
|
|
15
|
+
});
|
package/es/FluentEmoji/index.js
CHANGED
|
@@ -56,10 +56,7 @@ var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}, [type, emoji]);
|
|
59
|
-
|
|
60
|
-
return type === 'pure' || !emojiUrl || loadingFail;
|
|
61
|
-
}, []);
|
|
62
|
-
if (isFallback) return /*#__PURE__*/_jsx("div", {
|
|
59
|
+
if (type === 'pure' || !emojiUrl || loadingFail) return /*#__PURE__*/_jsx("div", {
|
|
63
60
|
className: cx(styles.container, className),
|
|
64
61
|
style: _objectSpread({
|
|
65
62
|
fontSize: size * 0.9,
|
package/es/SearchBar/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type InputProps } from "../Input";
|
|
3
3
|
export interface SearchBarProps extends InputProps {
|
|
4
|
+
defaultValue?: string;
|
|
4
5
|
/**
|
|
5
6
|
* @description Whether to enable the shortcut key to focus on the input
|
|
6
7
|
* @default false
|
|
7
8
|
*/
|
|
8
9
|
enableShortKey?: boolean;
|
|
10
|
+
onInputChange?: (value: string) => void;
|
|
9
11
|
/**
|
|
10
12
|
* @description The shortcut key to focus on the input. Only works if `enableShortKey` is true
|
|
11
13
|
* @default 'f'
|
|
@@ -16,6 +18,7 @@ export interface SearchBarProps extends InputProps {
|
|
|
16
18
|
* @default false
|
|
17
19
|
*/
|
|
18
20
|
spotlight?: boolean;
|
|
21
|
+
value?: string;
|
|
19
22
|
}
|
|
20
23
|
declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
|
|
21
24
|
export default SearchBar;
|
package/es/SearchBar/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["spotlight", "className", "value", "
|
|
4
|
+
var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChange", "placeholder", "enableShortKey", "shortKey"];
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
7
7
|
import { Search } from 'lucide-react';
|
|
8
8
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
9
|
+
import useControlledState from 'use-merge-value';
|
|
9
10
|
import Icon from "../Icon";
|
|
10
11
|
import { Input } from "../Input";
|
|
11
12
|
import Spotlight from "../Spotlight";
|
|
@@ -14,15 +15,24 @@ import { useStyles } from "./style";
|
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
17
|
-
var
|
|
18
|
+
var defaultValue = _ref.defaultValue,
|
|
19
|
+
spotlight = _ref.spotlight,
|
|
18
20
|
className = _ref.className,
|
|
19
21
|
value = _ref.value,
|
|
20
|
-
|
|
22
|
+
onInputChange = _ref.onInputChange,
|
|
21
23
|
placeholder = _ref.placeholder,
|
|
22
24
|
enableShortKey = _ref.enableShortKey,
|
|
23
25
|
_ref$shortKey = _ref.shortKey,
|
|
24
26
|
shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
|
|
25
27
|
properties = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var _useControlledState = useControlledState(defaultValue, {
|
|
29
|
+
defaultValue: defaultValue,
|
|
30
|
+
onChange: onInputChange,
|
|
31
|
+
value: value
|
|
32
|
+
}),
|
|
33
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
34
|
+
inputValue = _useControlledState2[0],
|
|
35
|
+
setInputValue = _useControlledState2[1];
|
|
26
36
|
var _useState = useState('Ctrl'),
|
|
27
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
38
|
symbol = _useState2[0],
|
|
@@ -31,10 +41,6 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
41
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
42
|
showTag = _useState4[0],
|
|
33
43
|
setShowTag = _useState4[1];
|
|
34
|
-
var _useState5 = useState(value),
|
|
35
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
-
inputValue = _useState6[0],
|
|
37
|
-
setInputValue = _useState6[1];
|
|
38
44
|
var _useStyles = useStyles(),
|
|
39
45
|
styles = _useStyles.styles,
|
|
40
46
|
cx = _useStyles.cx;
|
|
@@ -69,7 +75,6 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
69
75
|
onChange: function onChange(e) {
|
|
70
76
|
setInputValue(e.target.value);
|
|
71
77
|
setShowTag(!e.target.value);
|
|
72
|
-
if (_onChange) _onChange(e);
|
|
73
78
|
},
|
|
74
79
|
onFocus: function onFocus() {
|
|
75
80
|
return setShowTag(false);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IconProps } from "..";
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
3
|
+
import { type CSSProperties, ReactNode } from 'react';
|
|
4
|
+
export interface SelectWithImgOptionItem {
|
|
5
|
+
icon?: IconProps['icon'];
|
|
6
|
+
img: string;
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SelectWithImgProps {
|
|
11
|
+
className?: string;
|
|
12
|
+
classNames?: {
|
|
13
|
+
img?: string;
|
|
14
|
+
};
|
|
15
|
+
defaultValue?: SelectProps['defaultValue'];
|
|
16
|
+
height?: number;
|
|
17
|
+
onChange?: (value: this['value']) => void;
|
|
18
|
+
options?: SelectWithImgOptionItem[];
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
styles?: {
|
|
21
|
+
img?: CSSProperties;
|
|
22
|
+
};
|
|
23
|
+
value?: SelectProps['value'];
|
|
24
|
+
width?: number;
|
|
25
|
+
}
|
|
26
|
+
declare const SelectWithImg: import("react").NamedExoticComponent<SelectWithImgProps>;
|
|
27
|
+
export default SelectWithImg;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import { Icon } from "./..";
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { Flexbox } from 'react-layout-kit';
|
|
8
|
+
import useControlledState from 'use-merge-value';
|
|
9
|
+
import { useStyles } from "./styles";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var SelectWithImg = /*#__PURE__*/memo(function (_ref) {
|
|
13
|
+
var className = _ref.className,
|
|
14
|
+
style = _ref.style,
|
|
15
|
+
value = _ref.value,
|
|
16
|
+
defaultValue = _ref.defaultValue,
|
|
17
|
+
onChange = _ref.onChange,
|
|
18
|
+
options = _ref.options,
|
|
19
|
+
_ref$width = _ref.width,
|
|
20
|
+
width = _ref$width === void 0 ? 144 : _ref$width,
|
|
21
|
+
_ref$height = _ref.height,
|
|
22
|
+
height = _ref$height === void 0 ? 86 : _ref$height,
|
|
23
|
+
_ref$styles = _ref.styles,
|
|
24
|
+
outStyles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
25
|
+
_ref$classNames = _ref.classNames,
|
|
26
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames;
|
|
27
|
+
var _useControlledState = useControlledState(defaultValue, {
|
|
28
|
+
defaultValue: defaultValue,
|
|
29
|
+
onChange: onChange,
|
|
30
|
+
value: value
|
|
31
|
+
}),
|
|
32
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
33
|
+
currentValue = _useControlledState2[0],
|
|
34
|
+
setCurrentValue = _useControlledState2[1];
|
|
35
|
+
var _useStyles = useStyles(),
|
|
36
|
+
styles = _useStyles.styles,
|
|
37
|
+
cx = _useStyles.cx;
|
|
38
|
+
return /*#__PURE__*/_jsx(Flexbox, {
|
|
39
|
+
className: className,
|
|
40
|
+
gap: 16,
|
|
41
|
+
horizontal: true,
|
|
42
|
+
style: style,
|
|
43
|
+
children: options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
44
|
+
var isActive = item.value === currentValue;
|
|
45
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
46
|
+
align: 'center',
|
|
47
|
+
className: cx(styles.container, isActive && styles.active),
|
|
48
|
+
gap: 4,
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
return setCurrentValue(item.value);
|
|
51
|
+
},
|
|
52
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: cx(styles.imgCtn, isActive && styles.imgActive, classNames.img),
|
|
54
|
+
style: _objectSpread(_objectSpread({}, outStyles.img), {}, {
|
|
55
|
+
height: height,
|
|
56
|
+
width: width
|
|
57
|
+
}),
|
|
58
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
59
|
+
className: styles.img,
|
|
60
|
+
style: {
|
|
61
|
+
backgroundImage: "url(".concat(item.img, ")"),
|
|
62
|
+
height: height,
|
|
63
|
+
width: width
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
67
|
+
align: 'center',
|
|
68
|
+
gap: 4,
|
|
69
|
+
horizontal: true,
|
|
70
|
+
children: [item.icon && /*#__PURE__*/_jsx(Icon, {
|
|
71
|
+
icon: item.icon
|
|
72
|
+
}), item.label]
|
|
73
|
+
})]
|
|
74
|
+
}, item.value);
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
export default SelectWithImg;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
active: import("antd-style").SerializedStyles;
|
|
3
|
+
container: import("antd-style").SerializedStyles;
|
|
4
|
+
img: string;
|
|
5
|
+
imgActive: import("antd-style").SerializedStyles;
|
|
6
|
+
imgCtn: import("antd-style").SerializedStyles;
|
|
7
|
+
}>;
|