@lobehub/ui 1.63.0 → 1.65.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.
|
@@ -16,6 +16,7 @@ var useStyles = createStyles(function (_ref) {
|
|
|
16
16
|
});
|
|
17
17
|
var Action = /*#__PURE__*/memo(function (_ref2) {
|
|
18
18
|
var actions = _ref2.actions,
|
|
19
|
+
actionsRight = _ref2.actionsRight,
|
|
19
20
|
expand = _ref2.expand,
|
|
20
21
|
onExpandChange = _ref2.onExpandChange;
|
|
21
22
|
var _useStyles = useStyles(),
|
|
@@ -28,12 +29,12 @@ var Action = /*#__PURE__*/memo(function (_ref2) {
|
|
|
28
29
|
children: [/*#__PURE__*/_jsx("div", {
|
|
29
30
|
className: styles.actionLeft,
|
|
30
31
|
children: actions
|
|
31
|
-
}), /*#__PURE__*/
|
|
32
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
32
33
|
className: styles.actionsRight,
|
|
33
|
-
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
34
|
+
children: [actionsRight, /*#__PURE__*/_jsx(ActionIcon, {
|
|
34
35
|
icon: expand ? Minimize2 : Maximize2,
|
|
35
36
|
onClick: handleExpandClick
|
|
36
|
-
})
|
|
37
|
+
})]
|
|
37
38
|
})]
|
|
38
39
|
});
|
|
39
40
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
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 = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "textareaId"];
|
|
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"];
|
|
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 { Button } from 'antd';
|
|
@@ -39,6 +39,7 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
_onChange = _ref.onChange,
|
|
40
40
|
_ref$textareaId = _ref.textareaId,
|
|
41
41
|
textareaId = _ref$textareaId === void 0 ? 'lobe-chat-input-area' : _ref$textareaId,
|
|
42
|
+
actionsRight = _ref.actionsRight,
|
|
42
43
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
44
|
var _useStyles = useStyles(),
|
|
44
45
|
cx = _useStyles.cx,
|
|
@@ -63,6 +64,7 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
63
64
|
}, style),
|
|
64
65
|
children: [/*#__PURE__*/_jsx(Action, {
|
|
65
66
|
actions: actions,
|
|
67
|
+
actionsRight: actionsRight,
|
|
66
68
|
expand: expand,
|
|
67
69
|
onExpandChange: onExpandChange
|
|
68
70
|
}), /*#__PURE__*/_jsxs("div", {
|
package/es/TokenTag/index.d.ts
CHANGED
|
@@ -4,14 +4,16 @@ export interface TokenTagProps extends DivProps {
|
|
|
4
4
|
/**
|
|
5
5
|
* @default 'left'
|
|
6
6
|
*/
|
|
7
|
-
displayMode?: '
|
|
7
|
+
displayMode?: 'remained' | 'used';
|
|
8
8
|
/**
|
|
9
9
|
* @description Maximum value for the token
|
|
10
10
|
*/
|
|
11
11
|
maxValue: number;
|
|
12
12
|
text?: {
|
|
13
13
|
overload?: string;
|
|
14
|
+
remained?: string;
|
|
14
15
|
tokens?: string;
|
|
16
|
+
used?: string;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* @description Current value of the token
|
package/es/TokenTag/index.js
CHANGED
|
@@ -3,7 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["className", "displayMode", "maxValue", "value", "text"];
|
|
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 {
|
|
6
|
+
import { useHover } from 'ahooks';
|
|
7
|
+
import { forwardRef, useRef } from 'react';
|
|
7
8
|
import FluentEmoji from "../FluentEmoji";
|
|
8
9
|
import { ICON_SIZE, useStyles } from "./style";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -11,11 +12,13 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
12
|
var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
13
|
var className = _ref.className,
|
|
13
14
|
_ref$displayMode = _ref.displayMode,
|
|
14
|
-
displayMode = _ref$displayMode === void 0 ? '
|
|
15
|
+
displayMode = _ref$displayMode === void 0 ? 'remained' : _ref$displayMode,
|
|
15
16
|
maxValue = _ref.maxValue,
|
|
16
17
|
value = _ref.value,
|
|
17
18
|
text = _ref.text,
|
|
18
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var reference = useRef(ref);
|
|
21
|
+
var isHovering = useHover(reference);
|
|
19
22
|
var valueLeft = maxValue - value;
|
|
20
23
|
var percent = valueLeft / maxValue;
|
|
21
24
|
var type;
|
|
@@ -35,12 +38,12 @@ var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
38
|
cx = _useStyles.cx;
|
|
36
39
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
37
40
|
className: cx(styles.container, className),
|
|
38
|
-
ref:
|
|
41
|
+
ref: reference
|
|
39
42
|
}, props), {}, {
|
|
40
43
|
children: [/*#__PURE__*/_jsx(FluentEmoji, {
|
|
41
44
|
emoji: emoji,
|
|
42
45
|
size: ICON_SIZE
|
|
43
|
-
}), valueLeft > 0 ? (text === null || text === void 0 ? void 0 : text.
|
|
46
|
+
}), 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, isHovering ? (text === null || text === void 0 ? void 0 : text.tokens) || 'Tokens' : ''].join(' ') : (text === null || text === void 0 ? void 0 : text.overload) || 'Overload']
|
|
44
47
|
}));
|
|
45
48
|
});
|
|
46
49
|
export default TokenTag;
|
package/es/TokenTag/style.js
CHANGED
|
@@ -26,6 +26,6 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
return {
|
|
29
|
-
container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 4px;\n align-items: center;\n\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n font-family: ", ";\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, (HEIGHT - ICON_SIZE) * 1.2, (HEIGHT - ICON_SIZE) / 2, token.fontFamilyCode, token.colorFillSecondary, HEIGHT / 2))
|
|
29
|
+
container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n user-select: none;\n\n overflow: hidden;\n display: flex;\n flex: 0;\n gap: 4px;\n align-items: center;\n\n min-width: fit-content;\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n font-family: ", ";\n font-size: 13px;\n line-height: 1;\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, (HEIGHT - ICON_SIZE) * 1.2, (HEIGHT - ICON_SIZE) / 2, token.fontFamilyCode, token.colorFillSecondary, HEIGHT / 2))
|
|
30
30
|
};
|
|
31
31
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Lobe UI is an open-source UI component library for building
|
|
3
|
+
"version": "1.65.0",
|
|
4
|
+
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
7
7
|
"components",
|