@lobehub/ui 1.54.0 → 1.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
+
import { type MessageModalProps } from "../MessageModal";
|
|
2
3
|
export interface EditableMessageProps {
|
|
3
4
|
/**
|
|
4
5
|
* @title The class name for the Markdown and MessageInput component
|
|
@@ -55,6 +56,7 @@ export interface EditableMessageProps {
|
|
|
55
56
|
*/
|
|
56
57
|
markdown?: CSSProperties;
|
|
57
58
|
};
|
|
59
|
+
text?: MessageModalProps['text'];
|
|
58
60
|
/**
|
|
59
61
|
* @title The current text value
|
|
60
62
|
*/
|
|
@@ -21,7 +21,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
21
21
|
_ref$showEditWhenEmpt = _ref.showEditWhenEmpty,
|
|
22
22
|
showEditWhenEmpty = _ref$showEditWhenEmpt === void 0 ? false : _ref$showEditWhenEmpt,
|
|
23
23
|
styles = _ref.styles,
|
|
24
|
-
editButtonSize = _ref.editButtonSize
|
|
24
|
+
editButtonSize = _ref.editButtonSize,
|
|
25
|
+
text = _ref.text;
|
|
25
26
|
var _useControlledState = useControlledState(false, {
|
|
26
27
|
onChange: onEditingChange,
|
|
27
28
|
value: editing
|
|
@@ -66,15 +67,20 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
66
67
|
}) : /*#__PURE__*/_jsx(Markdown, {
|
|
67
68
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
|
|
68
69
|
style: styles === null || styles === void 0 ? void 0 : styles.markdown,
|
|
69
|
-
children: value
|
|
70
|
+
children: value || placeholder
|
|
70
71
|
}), /*#__PURE__*/_jsx(MessageModal, {
|
|
71
72
|
editing: isEdit,
|
|
72
73
|
onChange: function onChange(text) {
|
|
73
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
74
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
74
75
|
},
|
|
75
76
|
onEditingChange: setTyping,
|
|
76
|
-
onOpenChange:
|
|
77
|
+
onOpenChange: function onOpenChange(e) {
|
|
78
|
+
setExpand(e);
|
|
79
|
+
setTyping(false);
|
|
80
|
+
},
|
|
77
81
|
open: expand,
|
|
82
|
+
placeholder: placeholder,
|
|
83
|
+
text: text,
|
|
78
84
|
value: value
|
|
79
85
|
})]
|
|
80
86
|
});
|
|
@@ -22,6 +22,13 @@ export interface MessageModalProps {
|
|
|
22
22
|
* @default false
|
|
23
23
|
*/
|
|
24
24
|
open?: boolean;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
text?: {
|
|
27
|
+
cancel?: string;
|
|
28
|
+
confirm?: string;
|
|
29
|
+
edit?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
};
|
|
25
32
|
/**
|
|
26
33
|
* @description The value of the message content
|
|
27
34
|
*/
|
package/es/MessageModal/index.js
CHANGED
|
@@ -14,8 +14,10 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
14
14
|
open = _ref.open,
|
|
15
15
|
onOpenChange = _ref.onOpenChange,
|
|
16
16
|
onEditingChange = _ref.onEditingChange,
|
|
17
|
+
placeholder = _ref.placeholder,
|
|
17
18
|
value = _ref.value,
|
|
18
|
-
onChange = _ref.onChange
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
text = _ref.text;
|
|
19
21
|
var _useStyles = useStyles(),
|
|
20
22
|
styles = _useStyles.styles;
|
|
21
23
|
var _useControlledState = useControlledState(false, {
|
|
@@ -33,13 +35,13 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
35
|
expand = _useControlledState4[0],
|
|
34
36
|
setExpand = _useControlledState4[1];
|
|
35
37
|
return /*#__PURE__*/_jsx(Modal, {
|
|
36
|
-
cancelText: 'Cancel',
|
|
38
|
+
cancelText: (text === null || text === void 0 ? void 0 : text.cancel) || 'Cancel',
|
|
37
39
|
className: styles.modal,
|
|
38
40
|
closeIcon: /*#__PURE__*/_jsx(Icon, {
|
|
39
41
|
icon: X
|
|
40
42
|
}),
|
|
41
43
|
footer: isEdit ? null : undefined,
|
|
42
|
-
okText: 'Edit',
|
|
44
|
+
okText: (text === null || text === void 0 ? void 0 : text.edit) || 'Edit',
|
|
43
45
|
onCancel: function onCancel() {
|
|
44
46
|
return setExpand(false);
|
|
45
47
|
},
|
|
@@ -51,7 +53,7 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
51
53
|
align: 'center',
|
|
52
54
|
gap: 4,
|
|
53
55
|
horizontal: true,
|
|
54
|
-
children:
|
|
56
|
+
children: (text === null || text === void 0 ? void 0 : text.title) || 'Prompt'
|
|
55
57
|
}),
|
|
56
58
|
width: 800,
|
|
57
59
|
children: isEdit ? /*#__PURE__*/_jsx(MessageInput, {
|
|
@@ -63,10 +65,18 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
63
65
|
onConfirm: function onConfirm(text) {
|
|
64
66
|
setTyping(false);
|
|
65
67
|
onChange === null || onChange === void 0 ? void 0 : onChange(text);
|
|
68
|
+
},
|
|
69
|
+
placeholder: placeholder,
|
|
70
|
+
text: {
|
|
71
|
+
cancel: text === null || text === void 0 ? void 0 : text.cancel,
|
|
72
|
+
confirm: text === null || text === void 0 ? void 0 : text.confirm
|
|
66
73
|
}
|
|
67
74
|
}) : /*#__PURE__*/_jsx(Markdown, {
|
|
68
75
|
className: styles.body,
|
|
69
|
-
|
|
76
|
+
style: value ? {} : {
|
|
77
|
+
opacity: 0.5
|
|
78
|
+
},
|
|
79
|
+
children: String(value || placeholder)
|
|
70
80
|
})
|
|
71
81
|
});
|
|
72
82
|
});
|
package/es/TokenTag/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export interface TokenTagProps extends DivProps {
|
|
|
10
10
|
*/
|
|
11
11
|
value: number;
|
|
12
12
|
}
|
|
13
|
-
declare const TokenTag: import("react").
|
|
13
|
+
declare const TokenTag: import("react").ForwardRefExoticComponent<TokenTagProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
14
|
export default TokenTag;
|
package/es/TokenTag/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["className", "maxValue", "value"];
|
|
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 { forwardRef } from 'react';
|
|
7
7
|
import FluentEmoji from "../FluentEmoji";
|
|
8
8
|
import { ICON_SIZE, useStyles } from "./style";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
var TokenTag = /*#__PURE__*/
|
|
11
|
+
var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
12
|
var className = _ref.className,
|
|
13
13
|
maxValue = _ref.maxValue,
|
|
14
14
|
value = _ref.value,
|
|
@@ -31,7 +31,8 @@ var TokenTag = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
31
|
styles = _useStyles.styles,
|
|
32
32
|
cx = _useStyles.cx;
|
|
33
33
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
34
|
-
className: cx(styles.container, className)
|
|
34
|
+
className: cx(styles.container, className),
|
|
35
|
+
ref: ref
|
|
35
36
|
}, props), {}, {
|
|
36
37
|
children: [/*#__PURE__*/_jsx(FluentEmoji, {
|
|
37
38
|
emoji: emoji,
|