@lobehub/ui 1.92.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/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/SpotlightCard/SpotlightCardItem.js +1 -1
- package/es/SpotlightCard/index.d.ts +1 -0
- package/es/SpotlightCard/index.js +4 -1
- package/es/SpotlightCard/style.js +1 -1
- package/es/TokenTag/index.js +4 -1
- package/package.json +1 -1
package/es/ActionIcon/index.js
CHANGED
|
@@ -86,6 +86,7 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
86
86
|
borderRadius = _useMemo.borderRadius;
|
|
87
87
|
var content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
88
88
|
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
89
|
+
className: styles.icon,
|
|
89
90
|
color: color,
|
|
90
91
|
fill: fill,
|
|
91
92
|
icon: icon,
|
package/es/ActionIcon/style.d.ts
CHANGED
package/es/ActionIcon/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -9,6 +9,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
9
9
|
var active = _ref2.active,
|
|
10
10
|
glass = _ref2.glass;
|
|
11
11
|
return {
|
|
12
|
-
block: cx(glass && stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition:\n color 600ms ", ",\n scale 400ms ", ",\n background-color 100ms ", ";\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n
|
|
12
|
+
block: cx(glass && stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition:\n color 600ms ", ",\n scale 400ms ", ",\n background-color 100ms ", ";\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), active ? token.colorText : token.colorTextTertiary, active ? token.colorFillTertiary : 'transparent', token.motionEaseOut, token.motionEaseOut, token.motionEaseOut, token.colorText, token.colorFillSecondary, token.colorText, token.colorFill)),
|
|
13
|
+
icon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transition: scale 400ms ", ";\n\n &:active {\n scale: 0.8;\n }\n "])), token.motionEaseOut)
|
|
13
14
|
};
|
|
14
15
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
-
import { createStyles } from 'antd-style';
|
|
3
|
+
import { createStyles, useResponsive } from 'antd-style';
|
|
4
4
|
import { Maximize2, Minimize2 } from 'lucide-react';
|
|
5
5
|
import { memo, useCallback } from 'react';
|
|
6
6
|
import ActionIcon from "../ActionIcon";
|
|
@@ -21,6 +21,8 @@ var Action = /*#__PURE__*/memo(function (_ref2) {
|
|
|
21
21
|
onExpandChange = _ref2.onExpandChange;
|
|
22
22
|
var _useStyles = useStyles(),
|
|
23
23
|
styles = _useStyles.styles;
|
|
24
|
+
var _useResponsive = useResponsive(),
|
|
25
|
+
mobile = _useResponsive.mobile;
|
|
24
26
|
var handleExpandClick = useCallback(function () {
|
|
25
27
|
if (onExpandChange) onExpandChange(!expand);
|
|
26
28
|
}, [expand]);
|
|
@@ -31,7 +33,7 @@ var Action = /*#__PURE__*/memo(function (_ref2) {
|
|
|
31
33
|
children: actions
|
|
32
34
|
}), /*#__PURE__*/_jsxs("div", {
|
|
33
35
|
className: styles.actionsRight,
|
|
34
|
-
children: [actionsRight, /*#__PURE__*/_jsx(ActionIcon, {
|
|
36
|
+
children: [actionsRight, !mobile && /*#__PURE__*/_jsx(ActionIcon, {
|
|
35
37
|
icon: expand ? Minimize2 : Maximize2,
|
|
36
38
|
onClick: handleExpandClick
|
|
37
39
|
})]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type InputRef } from 'antd';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { type TextAreaProps } from "../Input";
|
|
4
|
+
import type { ChatInputBase } from './type';
|
|
5
|
+
export type ChatInputAreaDesktop = ChatInputBase & TextAreaProps & {
|
|
6
|
+
minHeight?: number;
|
|
7
|
+
textareaClassName?: string;
|
|
8
|
+
textareaId?: string;
|
|
9
|
+
textareaStyle?: CSSProperties;
|
|
10
|
+
};
|
|
11
|
+
declare const ChatInputArea: import("react").ForwardRefExoticComponent<ChatInputBase & TextAreaProps & {
|
|
12
|
+
minHeight?: number | undefined;
|
|
13
|
+
textareaClassName?: string | undefined;
|
|
14
|
+
textareaId?: string | undefined;
|
|
15
|
+
textareaStyle?: CSSProperties | undefined;
|
|
16
|
+
} & import("react").RefAttributes<InputRef>>;
|
|
17
|
+
export default ChatInputArea;
|
|
@@ -0,0 +1,131 @@
|
|
|
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 = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "textareaId", "actionsRight", "onStop", "value"];
|
|
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 { Button } from 'antd';
|
|
8
|
+
import { Loader2 } from 'lucide-react';
|
|
9
|
+
import { forwardRef, useCallback, useRef } from 'react';
|
|
10
|
+
import useControlledState from 'use-merge-value';
|
|
11
|
+
import Icon from "../Icon";
|
|
12
|
+
import { TextArea } from "../Input";
|
|
13
|
+
import Action from "./Action";
|
|
14
|
+
import { useStyles } from "./style";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
18
|
+
var text = _ref.text,
|
|
19
|
+
textareaClassName = _ref.textareaClassName,
|
|
20
|
+
style = _ref.style,
|
|
21
|
+
textareaStyle = _ref.textareaStyle,
|
|
22
|
+
_ref$minHeight = _ref.minHeight,
|
|
23
|
+
minHeight = _ref$minHeight === void 0 ? 200 : _ref$minHeight,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
actions = _ref.actions,
|
|
26
|
+
footer = _ref.footer,
|
|
27
|
+
expand = _ref.expand,
|
|
28
|
+
_ref$placeholder = _ref.placeholder,
|
|
29
|
+
placeholder = _ref$placeholder === void 0 ? 'Type something to chat...' : _ref$placeholder,
|
|
30
|
+
onExpandChange = _ref.onExpandChange,
|
|
31
|
+
onSend = _ref.onSend,
|
|
32
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
33
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
34
|
+
loading = _ref.loading,
|
|
35
|
+
disabled = _ref.disabled,
|
|
36
|
+
onInputChange = _ref.onInputChange,
|
|
37
|
+
_onPressEnter = _ref.onPressEnter,
|
|
38
|
+
_onCompositionStart = _ref.onCompositionStart,
|
|
39
|
+
_onCompositionEnd = _ref.onCompositionEnd,
|
|
40
|
+
_onBlur = _ref.onBlur,
|
|
41
|
+
_onChange = _ref.onChange,
|
|
42
|
+
_ref$textareaId = _ref.textareaId,
|
|
43
|
+
textareaId = _ref$textareaId === void 0 ? 'lobe-chat-input-area' : _ref$textareaId,
|
|
44
|
+
actionsRight = _ref.actionsRight,
|
|
45
|
+
onStop = _ref.onStop,
|
|
46
|
+
value = _ref.value,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
var _useControlledState = useControlledState(defaultValue, {
|
|
49
|
+
defaultValue: defaultValue,
|
|
50
|
+
onChange: onInputChange,
|
|
51
|
+
value: value
|
|
52
|
+
}),
|
|
53
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
54
|
+
currentValue = _useControlledState2[0],
|
|
55
|
+
setCurrentValue = _useControlledState2[1];
|
|
56
|
+
var _useStyles = useStyles(),
|
|
57
|
+
cx = _useStyles.cx,
|
|
58
|
+
styles = _useStyles.styles;
|
|
59
|
+
var isChineseInput = useRef(false);
|
|
60
|
+
var handleSend = useCallback(function () {
|
|
61
|
+
if (loading && disabled) return;
|
|
62
|
+
if (onSend) onSend(currentValue);
|
|
63
|
+
setCurrentValue('');
|
|
64
|
+
}, [disabled, currentValue]);
|
|
65
|
+
return /*#__PURE__*/_jsxs("section", {
|
|
66
|
+
className: cx(styles.container, className),
|
|
67
|
+
style: _objectSpread({
|
|
68
|
+
minHeight: minHeight
|
|
69
|
+
}, style),
|
|
70
|
+
children: [/*#__PURE__*/_jsx(Action, {
|
|
71
|
+
actions: actions,
|
|
72
|
+
actionsRight: actionsRight,
|
|
73
|
+
expand: expand,
|
|
74
|
+
onExpandChange: onExpandChange
|
|
75
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
76
|
+
className: styles.textareaContainer,
|
|
77
|
+
children: /*#__PURE__*/_jsx(TextArea, _objectSpread(_objectSpread({
|
|
78
|
+
className: cx(styles.textarea, textareaClassName),
|
|
79
|
+
defaultValue: defaultValue,
|
|
80
|
+
id: textareaId,
|
|
81
|
+
ref: ref,
|
|
82
|
+
style: textareaStyle
|
|
83
|
+
}, props), {}, {
|
|
84
|
+
onBlur: function onBlur(e) {
|
|
85
|
+
if (_onBlur) _onBlur(e);
|
|
86
|
+
setCurrentValue(e.target.value);
|
|
87
|
+
},
|
|
88
|
+
onChange: function onChange(e) {
|
|
89
|
+
if (_onChange) _onChange(e);
|
|
90
|
+
setCurrentValue(e.target.value);
|
|
91
|
+
},
|
|
92
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
93
|
+
if (_onCompositionEnd) _onCompositionEnd(e);
|
|
94
|
+
isChineseInput.current = false;
|
|
95
|
+
},
|
|
96
|
+
onCompositionStart: function onCompositionStart(e) {
|
|
97
|
+
if (_onCompositionStart) _onCompositionStart(e);
|
|
98
|
+
isChineseInput.current = true;
|
|
99
|
+
},
|
|
100
|
+
onPressEnter: function onPressEnter(e) {
|
|
101
|
+
if (_onPressEnter) _onPressEnter(e);
|
|
102
|
+
if (!loading && !e.shiftKey && !isChineseInput.current) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
handleSend();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
placeholder: placeholder,
|
|
108
|
+
resize: false,
|
|
109
|
+
type: "pure",
|
|
110
|
+
value: currentValue
|
|
111
|
+
}))
|
|
112
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
113
|
+
className: styles.footerBar,
|
|
114
|
+
children: [footer, loading ? /*#__PURE__*/_jsx(Button, {
|
|
115
|
+
disabled: disabled,
|
|
116
|
+
icon: loading && /*#__PURE__*/_jsx(Icon, {
|
|
117
|
+
icon: Loader2,
|
|
118
|
+
spin: true
|
|
119
|
+
}),
|
|
120
|
+
onClick: onStop,
|
|
121
|
+
children: (text === null || text === void 0 ? void 0 : text.stop) || 'Stop'
|
|
122
|
+
}) : /*#__PURE__*/_jsx(Button, {
|
|
123
|
+
disabled: disabled,
|
|
124
|
+
onClick: handleSend,
|
|
125
|
+
type: 'primary',
|
|
126
|
+
children: (text === null || text === void 0 ? void 0 : text.send) || 'Send'
|
|
127
|
+
})]
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
export default ChatInputArea;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type InputRef } from 'antd';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { type InputProps } from "../Input";
|
|
4
|
+
import type { ChatInputBase } from './type';
|
|
5
|
+
export type ChatInputAreaMobile = ChatInputBase & InputProps & {
|
|
6
|
+
inputClassName?: string;
|
|
7
|
+
inputId?: string;
|
|
8
|
+
inputStyle?: CSSProperties;
|
|
9
|
+
minHeight?: number;
|
|
10
|
+
};
|
|
11
|
+
declare const ChatInputArea: import("react").ForwardRefExoticComponent<ChatInputBase & InputProps & {
|
|
12
|
+
inputClassName?: string | undefined;
|
|
13
|
+
inputId?: string | undefined;
|
|
14
|
+
inputStyle?: CSSProperties | undefined;
|
|
15
|
+
minHeight?: number | undefined;
|
|
16
|
+
} & import("react").RefAttributes<InputRef>>;
|
|
17
|
+
export default ChatInputArea;
|
|
@@ -0,0 +1,132 @@
|
|
|
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 = ["inputClassName", "style", "inputStyle", "minHeight", "className", "actions", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "inputId", "actionsRight", "onStop", "value"];
|
|
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 { Button } from 'antd';
|
|
8
|
+
import { Loader2, SendHorizonal } from 'lucide-react';
|
|
9
|
+
import { forwardRef, useCallback, useRef } from 'react';
|
|
10
|
+
import { Flexbox } from 'react-layout-kit';
|
|
11
|
+
import useControlledState from 'use-merge-value';
|
|
12
|
+
import Icon from "../Icon";
|
|
13
|
+
import { Input } from "../Input";
|
|
14
|
+
import Action from "./Action";
|
|
15
|
+
import { useStyles } from "./style.mobile";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
19
|
+
var inputClassName = _ref.inputClassName,
|
|
20
|
+
style = _ref.style,
|
|
21
|
+
inputStyle = _ref.inputStyle,
|
|
22
|
+
_ref$minHeight = _ref.minHeight,
|
|
23
|
+
minHeight = _ref$minHeight === void 0 ? 200 : _ref$minHeight,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
actions = _ref.actions,
|
|
26
|
+
expand = _ref.expand,
|
|
27
|
+
_ref$placeholder = _ref.placeholder,
|
|
28
|
+
placeholder = _ref$placeholder === void 0 ? 'Type something to chat...' : _ref$placeholder,
|
|
29
|
+
onExpandChange = _ref.onExpandChange,
|
|
30
|
+
onSend = _ref.onSend,
|
|
31
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
32
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
33
|
+
loading = _ref.loading,
|
|
34
|
+
disabled = _ref.disabled,
|
|
35
|
+
onInputChange = _ref.onInputChange,
|
|
36
|
+
_onPressEnter = _ref.onPressEnter,
|
|
37
|
+
_onCompositionStart = _ref.onCompositionStart,
|
|
38
|
+
_onCompositionEnd = _ref.onCompositionEnd,
|
|
39
|
+
_onBlur = _ref.onBlur,
|
|
40
|
+
_onChange = _ref.onChange,
|
|
41
|
+
_ref$inputId = _ref.inputId,
|
|
42
|
+
inputId = _ref$inputId === void 0 ? 'lobe-chat-input-area' : _ref$inputId,
|
|
43
|
+
actionsRight = _ref.actionsRight,
|
|
44
|
+
onStop = _ref.onStop,
|
|
45
|
+
value = _ref.value,
|
|
46
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var _useControlledState = useControlledState(defaultValue, {
|
|
48
|
+
defaultValue: defaultValue,
|
|
49
|
+
onChange: onInputChange,
|
|
50
|
+
value: value
|
|
51
|
+
}),
|
|
52
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
53
|
+
currentValue = _useControlledState2[0],
|
|
54
|
+
setCurrentValue = _useControlledState2[1];
|
|
55
|
+
var _useStyles = useStyles(),
|
|
56
|
+
cx = _useStyles.cx,
|
|
57
|
+
styles = _useStyles.styles;
|
|
58
|
+
var isChineseInput = useRef(false);
|
|
59
|
+
var handleSend = useCallback(function () {
|
|
60
|
+
if (loading && disabled) return;
|
|
61
|
+
if (onSend) onSend(currentValue);
|
|
62
|
+
setCurrentValue('');
|
|
63
|
+
}, [disabled, currentValue]);
|
|
64
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
65
|
+
className: cx(styles.container, className),
|
|
66
|
+
gap: 12,
|
|
67
|
+
style: _objectSpread({
|
|
68
|
+
minHeight: minHeight
|
|
69
|
+
}, style),
|
|
70
|
+
children: [/*#__PURE__*/_jsx(Action, {
|
|
71
|
+
actions: actions,
|
|
72
|
+
actionsRight: actionsRight,
|
|
73
|
+
expand: expand,
|
|
74
|
+
onExpandChange: onExpandChange
|
|
75
|
+
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
76
|
+
className: styles.inner,
|
|
77
|
+
gap: 8,
|
|
78
|
+
horizontal: true,
|
|
79
|
+
children: [/*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({
|
|
80
|
+
className: cx(styles.input, inputClassName),
|
|
81
|
+
defaultValue: defaultValue,
|
|
82
|
+
id: inputId,
|
|
83
|
+
ref: ref,
|
|
84
|
+
style: inputStyle
|
|
85
|
+
}, props), {}, {
|
|
86
|
+
onBlur: function onBlur(e) {
|
|
87
|
+
if (_onBlur) _onBlur(e);
|
|
88
|
+
setCurrentValue(e.target.value);
|
|
89
|
+
},
|
|
90
|
+
onChange: function onChange(e) {
|
|
91
|
+
if (_onChange) _onChange(e);
|
|
92
|
+
setCurrentValue(e.target.value);
|
|
93
|
+
},
|
|
94
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
95
|
+
if (_onCompositionEnd) _onCompositionEnd(e);
|
|
96
|
+
isChineseInput.current = false;
|
|
97
|
+
},
|
|
98
|
+
onCompositionStart: function onCompositionStart(e) {
|
|
99
|
+
if (_onCompositionStart) _onCompositionStart(e);
|
|
100
|
+
isChineseInput.current = true;
|
|
101
|
+
},
|
|
102
|
+
onPressEnter: function onPressEnter(e) {
|
|
103
|
+
if (_onPressEnter) _onPressEnter(e);
|
|
104
|
+
if (!loading && !e.shiftKey && !isChineseInput.current) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
handleSend();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
placeholder: placeholder,
|
|
110
|
+
type: 'block',
|
|
111
|
+
value: currentValue
|
|
112
|
+
})), /*#__PURE__*/_jsx("div", {
|
|
113
|
+
children: loading ? /*#__PURE__*/_jsx(Button, {
|
|
114
|
+
disabled: disabled,
|
|
115
|
+
icon: loading && /*#__PURE__*/_jsx(Icon, {
|
|
116
|
+
icon: Loader2,
|
|
117
|
+
spin: true
|
|
118
|
+
}),
|
|
119
|
+
onClick: onStop
|
|
120
|
+
}) : /*#__PURE__*/_jsx(Button, {
|
|
121
|
+
disabled: disabled,
|
|
122
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
123
|
+
icon: SendHorizonal
|
|
124
|
+
}),
|
|
125
|
+
onClick: handleSend,
|
|
126
|
+
type: 'primary'
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
export default ChatInputArea;
|
|
@@ -1,69 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type InputRef } from 'antd';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* @description Footer content to be displayed below the input area
|
|
21
|
-
*/
|
|
22
|
-
footer?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* @description Whether the input area is in loading state
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
loading?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* @description Minimum height of the input area
|
|
30
|
-
* @default 200
|
|
31
|
-
*/
|
|
32
|
-
minHeight?: number;
|
|
33
|
-
/**
|
|
34
|
-
* @description Callback function when the input value changes
|
|
35
|
-
* @param value - The current value of the input area
|
|
36
|
-
*/
|
|
37
|
-
onInputChange?: (value: string) => void;
|
|
38
|
-
/**
|
|
39
|
-
* @description Callback function when the send button is clicked
|
|
40
|
-
* @param value - The current value of the input area
|
|
41
|
-
*/
|
|
42
|
-
onSend?: (value: string) => void;
|
|
43
|
-
onStop?: () => void;
|
|
44
|
-
/**
|
|
45
|
-
* @description Placeholder text for the input area
|
|
46
|
-
* @default 'Type something to chat...'
|
|
47
|
-
*/
|
|
48
|
-
placeholder?: string;
|
|
49
|
-
/**
|
|
50
|
-
* @description CSS styles for the component
|
|
51
|
-
*/
|
|
52
|
-
style?: CSSProperties;
|
|
53
|
-
text?: {
|
|
54
|
-
send?: string;
|
|
55
|
-
stop?: string;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* @description Additional class name for the textarea element
|
|
59
|
-
*/
|
|
60
|
-
textareaClassName?: string;
|
|
61
|
-
textareaId?: string;
|
|
62
|
-
/**
|
|
63
|
-
* @description CSS styles for the textarea element
|
|
64
|
-
*/
|
|
65
|
-
textareaStyle?: CSSProperties;
|
|
66
|
-
value?: string;
|
|
67
|
-
}
|
|
68
|
-
declare const ChatInputArea: import("react").ForwardRefExoticComponent<ChatInputAreaProps & import("react").RefAttributes<InputRef>>;
|
|
3
|
+
import { ChatInputAreaDesktop } from './Desktop';
|
|
4
|
+
import { ChatInputAreaMobile } from './Mobile';
|
|
5
|
+
export type ChatInputAreaProps = ChatInputAreaDesktop & ChatInputAreaMobile;
|
|
6
|
+
declare const ChatInputArea: import("react").ForwardRefExoticComponent<import("./type").ChatInputBase & import("..").TextAreaProps & {
|
|
7
|
+
minHeight?: number | undefined;
|
|
8
|
+
textareaClassName?: string | undefined;
|
|
9
|
+
textareaId?: string | undefined;
|
|
10
|
+
textareaStyle?: import("react").CSSProperties | undefined;
|
|
11
|
+
} & import("..").InputProps & {
|
|
12
|
+
inputClassName?: string | undefined;
|
|
13
|
+
inputId?: string | undefined;
|
|
14
|
+
inputStyle?: import("react").CSSProperties | undefined;
|
|
15
|
+
minHeight?: number | undefined;
|
|
16
|
+
} & import("react").RefAttributes<InputRef>>;
|
|
69
17
|
export default ChatInputArea;
|
|
@@ -1,131 +1,17 @@
|
|
|
1
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 = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "textareaId", "actionsRight", "onStop", "value"];
|
|
5
2
|
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
3
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import Icon from "../Icon";
|
|
12
|
-
import { TextArea } from "../Input";
|
|
13
|
-
import Action from "./Action";
|
|
14
|
-
import { useStyles } from "./style";
|
|
4
|
+
import { useResponsive } from 'antd-style';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import Desktop from "./Desktop";
|
|
7
|
+
import Mobile from "./Mobile";
|
|
15
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
minHeight = _ref$minHeight === void 0 ? 200 : _ref$minHeight,
|
|
24
|
-
className = _ref.className,
|
|
25
|
-
actions = _ref.actions,
|
|
26
|
-
footer = _ref.footer,
|
|
27
|
-
expand = _ref.expand,
|
|
28
|
-
_ref$placeholder = _ref.placeholder,
|
|
29
|
-
placeholder = _ref$placeholder === void 0 ? 'Type something to chat...' : _ref$placeholder,
|
|
30
|
-
onExpandChange = _ref.onExpandChange,
|
|
31
|
-
onSend = _ref.onSend,
|
|
32
|
-
_ref$defaultValue = _ref.defaultValue,
|
|
33
|
-
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
34
|
-
loading = _ref.loading,
|
|
35
|
-
disabled = _ref.disabled,
|
|
36
|
-
onInputChange = _ref.onInputChange,
|
|
37
|
-
_onPressEnter = _ref.onPressEnter,
|
|
38
|
-
_onCompositionStart = _ref.onCompositionStart,
|
|
39
|
-
_onCompositionEnd = _ref.onCompositionEnd,
|
|
40
|
-
_onBlur = _ref.onBlur,
|
|
41
|
-
_onChange = _ref.onChange,
|
|
42
|
-
_ref$textareaId = _ref.textareaId,
|
|
43
|
-
textareaId = _ref$textareaId === void 0 ? 'lobe-chat-input-area' : _ref$textareaId,
|
|
44
|
-
actionsRight = _ref.actionsRight,
|
|
45
|
-
onStop = _ref.onStop,
|
|
46
|
-
value = _ref.value,
|
|
47
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
-
var _useControlledState = useControlledState(defaultValue, {
|
|
49
|
-
defaultValue: defaultValue,
|
|
50
|
-
onChange: onInputChange,
|
|
51
|
-
value: value
|
|
52
|
-
}),
|
|
53
|
-
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
54
|
-
currentValue = _useControlledState2[0],
|
|
55
|
-
setCurrentValue = _useControlledState2[1];
|
|
56
|
-
var _useStyles = useStyles(),
|
|
57
|
-
cx = _useStyles.cx,
|
|
58
|
-
styles = _useStyles.styles;
|
|
59
|
-
var isChineseInput = useRef(false);
|
|
60
|
-
var handleSend = useCallback(function () {
|
|
61
|
-
if (loading && disabled) return;
|
|
62
|
-
if (onSend) onSend(currentValue);
|
|
63
|
-
setCurrentValue('');
|
|
64
|
-
}, [disabled, currentValue]);
|
|
65
|
-
return /*#__PURE__*/_jsxs("section", {
|
|
66
|
-
className: cx(styles.container, className),
|
|
67
|
-
style: _objectSpread({
|
|
68
|
-
minHeight: minHeight
|
|
69
|
-
}, style),
|
|
70
|
-
children: [/*#__PURE__*/_jsx(Action, {
|
|
71
|
-
actions: actions,
|
|
72
|
-
actionsRight: actionsRight,
|
|
73
|
-
expand: expand,
|
|
74
|
-
onExpandChange: onExpandChange
|
|
75
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
76
|
-
className: styles.textareaContainer,
|
|
77
|
-
children: /*#__PURE__*/_jsx(TextArea, _objectSpread(_objectSpread({
|
|
78
|
-
className: cx(styles.textarea, textareaClassName),
|
|
79
|
-
defaultValue: defaultValue,
|
|
80
|
-
id: textareaId,
|
|
81
|
-
ref: ref,
|
|
82
|
-
style: textareaStyle
|
|
83
|
-
}, props), {}, {
|
|
84
|
-
onBlur: function onBlur(e) {
|
|
85
|
-
if (_onBlur) _onBlur(e);
|
|
86
|
-
setCurrentValue(e.target.value);
|
|
87
|
-
},
|
|
88
|
-
onChange: function onChange(e) {
|
|
89
|
-
if (_onChange) _onChange(e);
|
|
90
|
-
setCurrentValue(e.target.value);
|
|
91
|
-
},
|
|
92
|
-
onCompositionEnd: function onCompositionEnd(e) {
|
|
93
|
-
if (_onCompositionEnd) _onCompositionEnd(e);
|
|
94
|
-
isChineseInput.current = false;
|
|
95
|
-
},
|
|
96
|
-
onCompositionStart: function onCompositionStart(e) {
|
|
97
|
-
if (_onCompositionStart) _onCompositionStart(e);
|
|
98
|
-
isChineseInput.current = true;
|
|
99
|
-
},
|
|
100
|
-
onPressEnter: function onPressEnter(e) {
|
|
101
|
-
if (_onPressEnter) _onPressEnter(e);
|
|
102
|
-
if (!loading && !e.shiftKey && !isChineseInput.current) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
handleSend();
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
placeholder: placeholder,
|
|
108
|
-
resize: false,
|
|
109
|
-
type: "pure",
|
|
110
|
-
value: currentValue
|
|
111
|
-
}))
|
|
112
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
113
|
-
className: styles.footerBar,
|
|
114
|
-
children: [footer, loading ? /*#__PURE__*/_jsx(Button, {
|
|
115
|
-
disabled: disabled,
|
|
116
|
-
icon: loading && /*#__PURE__*/_jsx(Icon, {
|
|
117
|
-
icon: Loader2,
|
|
118
|
-
spin: true
|
|
119
|
-
}),
|
|
120
|
-
onClick: onStop,
|
|
121
|
-
children: (text === null || text === void 0 ? void 0 : text.stop) || 'Stop'
|
|
122
|
-
}) : /*#__PURE__*/_jsx(Button, {
|
|
123
|
-
disabled: disabled,
|
|
124
|
-
onClick: handleSend,
|
|
125
|
-
type: 'primary',
|
|
126
|
-
children: (text === null || text === void 0 ? void 0 : text.send) || 'Send'
|
|
127
|
-
})]
|
|
128
|
-
})]
|
|
129
|
-
});
|
|
9
|
+
var ChatInputArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
10
|
+
var _useResponsive = useResponsive(),
|
|
11
|
+
mobile = _useResponsive.mobile;
|
|
12
|
+
var Render = mobile ? Mobile : Desktop;
|
|
13
|
+
return /*#__PURE__*/_jsx(Render, _objectSpread({
|
|
14
|
+
ref: ref
|
|
15
|
+
}, props));
|
|
130
16
|
});
|
|
131
17
|
export default ChatInputArea;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
7
|
+
return {
|
|
8
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 12px 0;\n "]))),
|
|
9
|
+
inner: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 16px;\n "]))),
|
|
10
|
+
input: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: ", " !important;\n border: none !important;\n "])), token.colorFillSecondary)
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -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
|
*/
|
|
@@ -21,7 +21,7 @@ var SpotlightCardItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
21
21
|
styles = _useStyles.styles,
|
|
22
22
|
cx = _useStyles.cx;
|
|
23
23
|
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
24
|
-
className: cx(
|
|
24
|
+
className: cx(styles.itemContainer, className),
|
|
25
25
|
style: _objectSpread({
|
|
26
26
|
borderRadius: borderRadius
|
|
27
27
|
}, style)
|
|
@@ -7,6 +7,7 @@ export interface SpotlightCardProps<T = any> extends DivProps {
|
|
|
7
7
|
items: T[];
|
|
8
8
|
renderItem: (item: T) => ReactNode;
|
|
9
9
|
size?: number;
|
|
10
|
+
spotlight?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const SpotlightCard: import("react").NamedExoticComponent<SpotlightCardProps<any>>;
|
|
12
13
|
export default SpotlightCard;
|
|
@@ -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 = ["items", "renderItem", "className", "columns", "gap", "style", "size", "borderRadius"];
|
|
3
|
+
var _excluded = ["items", "renderItem", "className", "columns", "gap", "style", "size", "borderRadius", "spotlight"];
|
|
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
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -24,6 +24,8 @@ var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
size = _ref$size === void 0 ? 800 : _ref$size,
|
|
25
25
|
_ref$borderRadius = _ref.borderRadius,
|
|
26
26
|
borderRadius = _ref$borderRadius === void 0 ? 12 : _ref$borderRadius,
|
|
27
|
+
_ref$spotlight = _ref.spotlight,
|
|
28
|
+
spotlight = _ref$spotlight === void 0 ? true : _ref$spotlight,
|
|
27
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
30
|
var _useStyles = useStyles({
|
|
29
31
|
borderRadius: borderRadius,
|
|
@@ -39,6 +41,7 @@ var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
41
|
}, [columns]);
|
|
40
42
|
useEffect(function () {
|
|
41
43
|
if (!ref.current) return;
|
|
44
|
+
if (!spotlight) return;
|
|
42
45
|
var fn = function fn(e) {
|
|
43
46
|
var _iterator = _createForOfIteratorHelper(document.querySelectorAll(".".concat(CHILDREN_CLASSNAME))),
|
|
44
47
|
_step;
|
|
@@ -14,6 +14,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
14
14
|
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:hover > .", "::after {\n opacity: 1;\n }\n "])), CHILDREN_CLASSNAME),
|
|
15
15
|
content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 2;\n\n flex-grow: 1;\n\n height: 100%;\n margin: 1px;\n\n background: ", ";\n border-radius: ", "px;\n "])), token.colorBgContainer, borderRadius - 1),
|
|
16
16
|
grid: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: grid;\n\n ", " {\n display: flex;\n flex-direction: column;\n }\n "])), responsive.mobile),
|
|
17
|
-
itemContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n\n background: ", ";\n border-radius: ", "px;\n\n &::before,\n &::after {\n content: '';\n\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n\n opacity: 0;\n border-radius: inherit;\n\n transition: opacity 500ms;\n }\n\n &::before {\n pointer-events: none;\n user-select: none;\n z-index: 3;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n &::after {\n z-index: 1;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n :hover::before {\n opacity: 1;\n }\n "])), rgba(token.
|
|
17
|
+
itemContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n\n background: ", ";\n border-radius: ", "px;\n\n &::before,\n &::after {\n content: '';\n\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n\n opacity: 0;\n border-radius: inherit;\n\n transition: opacity 500ms;\n }\n\n &::before {\n pointer-events: none;\n user-select: none;\n z-index: 3;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n &::after {\n z-index: 1;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n :hover::before {\n opacity: 1;\n }\n "])), rgba(token.colorBorderSecondary, 0.75), borderRadius, size, rgba(token.colorTextBase, isDarkMode ? 0.06 : 0.02), size * 0.75, rgba(token.colorTextBase, isDarkMode ? 0.4 : 0.2))
|
|
18
18
|
};
|
|
19
19
|
});
|
package/es/TokenTag/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["className", "displayMode", "maxValue", "value", "text", "shape"];
|
|
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 { forwardRef } from 'react';
|
|
7
8
|
import FluentEmoji from "../FluentEmoji";
|
|
8
9
|
import { ICON_SIZE, useStyles } from "./style";
|
|
@@ -18,6 +19,8 @@ var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
18
19
|
_ref$shape = _ref.shape,
|
|
19
20
|
shape = _ref$shape === void 0 ? 'round' : _ref$shape,
|
|
20
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _useResponsive = useResponsive(),
|
|
23
|
+
mobile = _useResponsive.mobile;
|
|
21
24
|
var valueLeft = maxValue - value;
|
|
22
25
|
var percent = valueLeft / maxValue;
|
|
23
26
|
var type;
|
|
@@ -45,7 +48,7 @@ var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
45
48
|
children: [/*#__PURE__*/_jsx(FluentEmoji, {
|
|
46
49
|
emoji: emoji,
|
|
47
50
|
size: ICON_SIZE
|
|
48
|
-
}), valueLeft > 0 ? [displayMode === 'remained' ? (text === null || text === void 0 ? void 0 : text.remained) || 'Remained' : (text === null || text === void 0 ? void 0 : text.used) || 'Used', displayMode === 'remained' ? valueLeft : value].join(' ') : (text === null || text === void 0 ? void 0 : text.overload) || 'Overload']
|
|
51
|
+
}), valueLeft > 0 ? [mobile ? '' : displayMode === 'remained' ? (text === null || text === void 0 ? void 0 : text.remained) || 'Remained' : (text === null || text === void 0 ? void 0 : text.used) || 'Used', displayMode === 'remained' ? valueLeft : value].join(' ') : (text === null || text === void 0 ? void 0 : text.overload) || 'Overload']
|
|
49
52
|
}));
|
|
50
53
|
});
|
|
51
54
|
export default TokenTag;
|