@lobehub/ui 1.9.0 → 1.10.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 +2 -2
- package/es/EditableMessageList/index.js +6 -6
- package/es/EditableText/index.js +1 -4
- package/es/Icon/index.d.ts +1 -0
- package/es/Icon/index.js +5 -2
- package/es/Input/index.d.ts +13 -0
- package/es/Input/index.js +36 -0
- package/es/Input/style.d.ts +6 -0
- package/es/Input/style.js +13 -0
- package/es/MessageInput/index.d.ts +2 -0
- package/es/MessageInput/index.js +10 -8
- package/es/SearchBar/index.d.ts +1 -2
- package/es/SearchBar/index.js +7 -17
- package/es/SearchBar/style.d.ts +1 -3
- package/es/SearchBar/style.js +6 -8
- package/es/StroyBook/style.js +1 -1
- package/es/components/ControlInput.d.ts +1 -1
- package/es/components/ControlInput.js +20 -23
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/types/index.d.ts +15 -4
- package/lib/ActionIcon/index.js +2 -2
- package/lib/EditableMessageList/index.js +6 -6
- package/lib/EditableText/index.js +1 -1
- package/lib/Icon/index.d.ts +1 -0
- package/lib/Icon/index.js +5 -2
- package/lib/Input/index.d.ts +13 -0
- package/lib/Input/index.js +41 -0
- package/lib/Input/style.d.ts +6 -0
- package/lib/Input/style.js +71 -0
- package/lib/MessageInput/index.d.ts +2 -0
- package/lib/MessageInput/index.js +6 -5
- package/lib/SearchBar/index.d.ts +1 -2
- package/lib/SearchBar/index.js +6 -25
- package/lib/SearchBar/style.d.ts +1 -3
- package/lib/SearchBar/style.js +1 -20
- package/lib/StroyBook/style.js +5 -0
- package/lib/components/ControlInput.d.ts +1 -1
- package/lib/components/ControlInput.js +9 -19
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -0
- package/lib/types/index.d.ts +15 -4
- package/package.json +1 -1
package/es/ActionIcon/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
36
36
|
borderRadius = 5;
|
|
37
37
|
break;
|
|
38
38
|
case 'small':
|
|
39
|
-
blockSize =
|
|
39
|
+
blockSize = 24;
|
|
40
40
|
borderRadius = 5;
|
|
41
41
|
break;
|
|
42
42
|
case 'site':
|
|
@@ -57,7 +57,7 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
57
|
}, style)
|
|
58
58
|
}, props), {}, {
|
|
59
59
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
60
|
-
size: size === 'site' ? '
|
|
60
|
+
size: size === 'site' ? 'normal' : size,
|
|
61
61
|
icon: icon
|
|
62
62
|
})
|
|
63
63
|
}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import IconAction from "../ActionIcon";
|
|
3
|
+
import { messagesReducer } from "../Chat";
|
|
4
|
+
import { ControlInput } from "../components/ControlInput";
|
|
2
5
|
import { PlusOutlined } from '@ant-design/icons';
|
|
3
6
|
import { Button, Select } from 'antd';
|
|
4
7
|
import isEqual from 'fast-deep-equal';
|
|
8
|
+
import { TrashIcon } from 'lucide-react';
|
|
5
9
|
import { memo, useEffect, useReducer } from 'react';
|
|
6
10
|
import { Flexbox } from 'react-layout-kit';
|
|
7
|
-
import IconAction from "../ActionIcon";
|
|
8
|
-
import { messagesReducer } from "../Chat";
|
|
9
|
-
import { ControlInput } from "../components/ControlInput";
|
|
10
|
-
import { TrashIcon } from 'lucide-react';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -70,8 +70,8 @@ export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
|
|
|
70
70
|
placeholder: item.role === 'user' ? '请填入输入的样例内容' : '请填入输出的样例'
|
|
71
71
|
}), /*#__PURE__*/_jsx(IconAction, {
|
|
72
72
|
icon: TrashIcon,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
placement: "right",
|
|
74
|
+
title: "Delete",
|
|
75
75
|
onClick: function onClick() {
|
|
76
76
|
dispatch({
|
|
77
77
|
type: 'deleteMessage',
|
package/es/EditableText/index.js
CHANGED
package/es/Icon/index.d.ts
CHANGED
package/es/Icon/index.js
CHANGED
|
@@ -13,12 +13,15 @@ var Icon = function Icon(_ref) {
|
|
|
13
13
|
var SvgIcon = icon;
|
|
14
14
|
switch (size) {
|
|
15
15
|
case 'large':
|
|
16
|
-
case 'normal':
|
|
17
16
|
fontSize = 24;
|
|
18
17
|
strokeWidth = 2;
|
|
19
18
|
break;
|
|
20
|
-
case '
|
|
19
|
+
case 'normal':
|
|
21
20
|
fontSize = 20;
|
|
21
|
+
strokeWidth = 2;
|
|
22
|
+
break;
|
|
23
|
+
case 'small':
|
|
24
|
+
fontSize = 14;
|
|
22
25
|
strokeWidth = 1.5;
|
|
23
26
|
break;
|
|
24
27
|
default:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputProps as AntdInputProps } from 'antd';
|
|
3
|
+
import { TextAreaProps as AntdTextAreaProps } from 'antd/es/input/TextArea';
|
|
4
|
+
export interface InputProps extends AntdInputProps {
|
|
5
|
+
ref?: any;
|
|
6
|
+
type?: 'ghost' | 'block';
|
|
7
|
+
}
|
|
8
|
+
export declare const Input: import("react").NamedExoticComponent<InputProps>;
|
|
9
|
+
export interface TextAreaProps extends AntdTextAreaProps {
|
|
10
|
+
ref?: any;
|
|
11
|
+
type?: 'ghost' | 'block';
|
|
12
|
+
}
|
|
13
|
+
export declare const TextArea: import("react").NamedExoticComponent<TextAreaProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "type"],
|
|
4
|
+
_excluded2 = ["className", "type"];
|
|
5
|
+
import { Input as AntInput } from 'antd';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useStyles } from "./style";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export var Input = /*#__PURE__*/memo(function (_ref) {
|
|
10
|
+
var className = _ref.className,
|
|
11
|
+
_ref$type = _ref.type,
|
|
12
|
+
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
var _useStyles = useStyles({
|
|
15
|
+
type: type
|
|
16
|
+
}),
|
|
17
|
+
styles = _useStyles.styles,
|
|
18
|
+
cx = _useStyles.cx;
|
|
19
|
+
return /*#__PURE__*/_jsx(AntInput, _objectSpread({
|
|
20
|
+
className: cx(styles.input, className)
|
|
21
|
+
}, props));
|
|
22
|
+
});
|
|
23
|
+
export var TextArea = /*#__PURE__*/memo(function (_ref2) {
|
|
24
|
+
var className = _ref2.className,
|
|
25
|
+
_ref2$type = _ref2.type,
|
|
26
|
+
type = _ref2$type === void 0 ? 'ghost' : _ref2$type,
|
|
27
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
28
|
+
var _useStyles2 = useStyles({
|
|
29
|
+
type: type
|
|
30
|
+
}),
|
|
31
|
+
styles = _useStyles2.styles,
|
|
32
|
+
cx = _useStyles2.cx;
|
|
33
|
+
return /*#__PURE__*/_jsx(AntInput.TextArea, _objectSpread({
|
|
34
|
+
className: cx(styles.textarea, className)
|
|
35
|
+
}, props));
|
|
36
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token;
|
|
8
|
+
var type = _ref2.type;
|
|
9
|
+
return {
|
|
10
|
+
input: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n height: 36px;\n padding: 0 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n input {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? rgba(token.colorBgElevated, 0.6) : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, token.motionEaseOut, token.colorFillTertiary),
|
|
11
|
+
textarea: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n padding: 8px 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n textarea {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? rgba(token.colorBgElevated, 0.6) : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, token.motionEaseOut, token.colorFillTertiary)
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type TextAreaProps } from "../index";
|
|
2
3
|
import { ButtonProps } from 'antd';
|
|
3
4
|
/**
|
|
4
5
|
* @title MessageInputProps
|
|
@@ -30,6 +31,7 @@ export interface MessageInputProps {
|
|
|
30
31
|
renderButtons?: (text: string) => ButtonProps[];
|
|
31
32
|
height?: number;
|
|
32
33
|
className?: string;
|
|
34
|
+
type?: TextAreaProps['type'];
|
|
33
35
|
}
|
|
34
36
|
declare const MessageInput: import("react").NamedExoticComponent<MessageInputProps>;
|
|
35
37
|
export default MessageInput;
|
package/es/MessageInput/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import {
|
|
3
|
+
import { TextArea } from "./..";
|
|
4
|
+
import { Button } from 'antd';
|
|
4
5
|
import { cx } from 'antd-style';
|
|
5
6
|
import { memo, useState } from 'react';
|
|
6
7
|
import { Flexbox } from 'react-layout-kit';
|
|
@@ -14,7 +15,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
17
|
-
var
|
|
18
|
+
var type = _ref.type,
|
|
19
|
+
onCancel = _ref.onCancel,
|
|
18
20
|
defaultValue = _ref.defaultValue,
|
|
19
21
|
onConfirm = _ref.onConfirm,
|
|
20
22
|
renderButtons = _ref.renderButtons,
|
|
@@ -26,9 +28,9 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
28
|
setRole = _useState2[1];
|
|
27
29
|
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
28
30
|
gap: 8,
|
|
29
|
-
children: [/*#__PURE__*/_jsx(
|
|
31
|
+
children: [/*#__PURE__*/_jsx(TextArea, {
|
|
32
|
+
type: type,
|
|
30
33
|
value: tempSystemRole,
|
|
31
|
-
allowClear: true,
|
|
32
34
|
placeholder: '例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。',
|
|
33
35
|
style: {
|
|
34
36
|
height: height !== null && height !== void 0 ? height : 200
|
|
@@ -44,15 +46,15 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
46
|
return /*#__PURE__*/_jsx(Button, _objectSpread({}, buttonProps), index);
|
|
45
47
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
48
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
47
|
-
type:
|
|
49
|
+
type: "primary",
|
|
48
50
|
onClick: function onClick() {
|
|
49
51
|
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(tempSystemRole);
|
|
50
52
|
},
|
|
51
|
-
children: "
|
|
53
|
+
children: "Confirm"
|
|
52
54
|
}), /*#__PURE__*/_jsx(Button, {
|
|
53
|
-
type:
|
|
55
|
+
type: "text",
|
|
54
56
|
onClick: onCancel,
|
|
55
|
-
children: "
|
|
57
|
+
children: "Cancel"
|
|
56
58
|
})]
|
|
57
59
|
})
|
|
58
60
|
})]
|
package/es/SearchBar/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InputProps } from
|
|
2
|
+
import { InputProps } from "../index";
|
|
3
3
|
export interface SearchBarProps extends InputProps {
|
|
4
4
|
shortKey?: string;
|
|
5
5
|
enableShortKey?: boolean;
|
|
6
|
-
type?: 'ghost' | 'block';
|
|
7
6
|
}
|
|
8
7
|
declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
|
|
9
8
|
export default SearchBar;
|
package/es/SearchBar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["className", "value", "onChange", "
|
|
4
|
+
var _excluded = ["className", "value", "onChange", "placeholder", "enableShortKey", "shortKey"];
|
|
5
5
|
var _navigator;
|
|
6
|
-
import { Icon } from "./..";
|
|
7
|
-
import {
|
|
6
|
+
import { Icon, Input } from "./..";
|
|
7
|
+
import { Tag } from 'antd';
|
|
8
8
|
import { Search } from 'lucide-react';
|
|
9
9
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
10
10
|
import { useStyles } from "./style";
|
|
@@ -16,10 +16,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
16
16
|
var className = _ref.className,
|
|
17
17
|
value = _ref.value,
|
|
18
18
|
_onChange = _ref.onChange,
|
|
19
|
-
style = _ref.style,
|
|
20
19
|
placeholder = _ref.placeholder,
|
|
21
|
-
_ref$type = _ref.type,
|
|
22
|
-
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
23
20
|
enableShortKey = _ref.enableShortKey,
|
|
24
21
|
_ref$shortKey = _ref.shortKey,
|
|
25
22
|
shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
|
|
@@ -32,9 +29,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
32
29
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
30
|
inputValue = _useState4[0],
|
|
34
31
|
setInputValue = _useState4[1];
|
|
35
|
-
var _useStyles = useStyles(
|
|
36
|
-
type: type
|
|
37
|
-
}),
|
|
32
|
+
var _useStyles = useStyles(),
|
|
38
33
|
styles = _useStyles.styles,
|
|
39
34
|
cx = _useStyles.cx;
|
|
40
35
|
var inputRef = useRef(null);
|
|
@@ -52,16 +47,14 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
52
47
|
};
|
|
53
48
|
}, []);
|
|
54
49
|
return /*#__PURE__*/_jsxs("div", {
|
|
55
|
-
className:
|
|
50
|
+
className: styles.search,
|
|
56
51
|
children: [/*#__PURE__*/_jsx(Input, _objectSpread({
|
|
57
52
|
ref: inputRef,
|
|
58
|
-
className: styles.input,
|
|
53
|
+
className: cx(styles.input, className),
|
|
59
54
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
60
55
|
className: styles.icon,
|
|
61
56
|
icon: Search,
|
|
62
|
-
size:
|
|
63
|
-
fontSize: 14
|
|
64
|
-
},
|
|
57
|
+
size: "small",
|
|
65
58
|
style: {
|
|
66
59
|
marginRight: 4
|
|
67
60
|
}
|
|
@@ -69,9 +62,6 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
69
62
|
allowClear: true,
|
|
70
63
|
value: value,
|
|
71
64
|
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Type keywords...',
|
|
72
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
73
|
-
borderColor: 'transparent'
|
|
74
|
-
}),
|
|
75
65
|
onChange: function onChange(e) {
|
|
76
66
|
setInputValue(e.target.value);
|
|
77
67
|
setShowTag(e.target.value ? false : true);
|
package/es/SearchBar/style.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const useStyles: (props?: {
|
|
2
|
-
type: 'ghost' | 'block';
|
|
3
|
-
} | undefined) => import("antd-style").ReturnStyles<{
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
4
2
|
search: import("antd-style").SerializedStyles;
|
|
5
3
|
input: import("antd-style").SerializedStyles;
|
|
6
4
|
tag: import("antd-style").SerializedStyles;
|
package/es/SearchBar/style.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
|
|
5
|
-
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
6
5
|
var css = _ref.css,
|
|
7
6
|
token = _ref.token;
|
|
8
|
-
var type = _ref2.type;
|
|
9
7
|
return {
|
|
10
|
-
search: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n
|
|
11
|
-
input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n
|
|
12
|
-
tag: css(
|
|
13
|
-
icon: css(
|
|
8
|
+
search: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n "]))),
|
|
9
|
+
input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 8px 0 12px;\n "]))),
|
|
10
|
+
tag: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n "]))),
|
|
11
|
+
icon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextPlaceholder)
|
|
14
12
|
};
|
|
15
13
|
});
|
package/es/StroyBook/style.js
CHANGED
|
@@ -9,6 +9,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
9
9
|
return {
|
|
10
10
|
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n\n width: inherit;\n min-height: inherit;\n ", "\n "])), mobile && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-direction: column;\n "])))),
|
|
11
11
|
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto;\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n\n ", "\n "])), !noPadding && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
|
|
12
|
-
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n --leva-fonts-mono: ", ";\n\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n input:checked + label > svg {\n stroke: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.fontFamilyCode, token.colorBgLayout, token.colorBorder)
|
|
12
|
+
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n --leva-fonts-mono: ", ";\n\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n\n input:checked + label > svg {\n stroke: ", ";\n }\n\n button {\n --leva-colors-accent2: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.fontFamilyCode, token.colorBgLayout, token.colorBorder, token.colorFillSecondary)
|
|
13
13
|
};
|
|
14
14
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InputProps } from
|
|
2
|
+
import { InputProps } from "../index";
|
|
3
3
|
export interface ControlInputProps extends Omit<InputProps, 'onChange' | 'value' | 'onAbort'> {
|
|
4
4
|
onChange?: (value: string) => void;
|
|
5
5
|
onValueChanging?: (value: string) => void;
|
|
@@ -2,7 +2,9 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["value", "onChange", "onValueChanging", "onChangeEnd"];
|
|
5
|
-
import {
|
|
5
|
+
import { ActionIcon, Input } from "./..";
|
|
6
|
+
import { ConfigProvider, Space } from 'antd';
|
|
7
|
+
import { RotateCcw, Save } from 'lucide-react';
|
|
6
8
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -54,33 +56,28 @@ export var ControlInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
54
56
|
onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(input);
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
|
-
suffix: value === input ? /*#__PURE__*/_jsx("span", {}) : /*#__PURE__*/
|
|
59
|
+
suffix: value === input ? /*#__PURE__*/_jsx("span", {}) : /*#__PURE__*/_jsx(ConfigProvider, {
|
|
58
60
|
theme: {
|
|
59
61
|
token: {
|
|
60
62
|
fontSize: 14
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
|
-
children:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
onClick: function onClick() {
|
|
80
|
-
updateValue();
|
|
81
|
-
},
|
|
82
|
-
children: "\u4FDD\u5B58 \u21B5"
|
|
83
|
-
})]
|
|
65
|
+
children: /*#__PURE__*/_jsxs(Space, {
|
|
66
|
+
size: 2,
|
|
67
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
68
|
+
title: "Reset",
|
|
69
|
+
icon: RotateCcw,
|
|
70
|
+
size: "small",
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
setInput(value);
|
|
73
|
+
}
|
|
74
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
75
|
+
title: "\u2705 Save",
|
|
76
|
+
icon: Save,
|
|
77
|
+
size: "small",
|
|
78
|
+
onClick: updateValue
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
84
81
|
})
|
|
85
82
|
}));
|
|
86
83
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as EditableMessageList, type EditableMessageListProps, } from '
|
|
|
10
10
|
export { default as EditableText, type EditableTextProps } from './EditableText';
|
|
11
11
|
export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
|
|
12
12
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
13
|
+
export { Input, TextArea, type InputProps, type TextAreaProps } from './Input';
|
|
13
14
|
export { default as List } from './List';
|
|
14
15
|
export { default as Logo, type LogoProps } from './Logo';
|
|
15
16
|
export { default as Markdown, type MarkdownProps } from './Markdown';
|
package/es/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as EditableMessageList } from "./EditableMessageList";
|
|
|
9
9
|
export { default as EditableText } from "./EditableText";
|
|
10
10
|
export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
|
|
11
11
|
export { default as Icon } from "./Icon";
|
|
12
|
+
export { Input, TextArea } from "./Input";
|
|
12
13
|
export { default as List } from "./List";
|
|
13
14
|
export { default as Logo } from "./Logo";
|
|
14
15
|
export { default as Markdown } from "./Markdown";
|
package/es/types/index.d.ts
CHANGED
|
@@ -11,8 +11,19 @@ export type DivProps = React.DetailedHTMLProps<
|
|
|
11
11
|
HTMLDivElement
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
14
|
+
export type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export type ImgProps = React.DetailedHTMLProps<
|
|
17
|
+
React.HTMLAttributes<HTMLImageElement>,
|
|
18
|
+
HTMLImageElement
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type InputProps = React.DetailedHTMLProps<
|
|
22
|
+
React.HTMLAttributes<HTMLInputElement>,
|
|
23
|
+
HTMLInputElement
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type TextAreaProps = React.DetailedHTMLProps<
|
|
27
|
+
React.HTMLAttributes<HTMLTextAreaElement>,
|
|
28
|
+
HTMLTextAreaElement
|
|
29
|
+
>;
|
package/lib/ActionIcon/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var ActionIcon = (0, import_react.memo)(
|
|
|
51
51
|
borderRadius = 5;
|
|
52
52
|
break;
|
|
53
53
|
case "small":
|
|
54
|
-
blockSize =
|
|
54
|
+
blockSize = 24;
|
|
55
55
|
borderRadius = 5;
|
|
56
56
|
break;
|
|
57
57
|
case "site":
|
|
@@ -70,7 +70,7 @@ var ActionIcon = (0, import_react.memo)(
|
|
|
70
70
|
style: { width: blockSize, height: blockSize, borderRadius, ...style },
|
|
71
71
|
...props
|
|
72
72
|
},
|
|
73
|
-
/* @__PURE__ */ React.createElement(import__.Icon, { size: size === "site" ? "
|
|
73
|
+
/* @__PURE__ */ React.createElement(import__.Icon, { size: size === "site" ? "normal" : size, icon })
|
|
74
74
|
);
|
|
75
75
|
if (!title)
|
|
76
76
|
return actionIconBlock;
|
|
@@ -33,15 +33,15 @@ __export(EditableMessageList_exports, {
|
|
|
33
33
|
default: () => EditableMessageList_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(EditableMessageList_exports);
|
|
36
|
+
var import_ActionIcon = __toESM(require("../ActionIcon"));
|
|
37
|
+
var import_Chat = require("../Chat");
|
|
38
|
+
var import_ControlInput = require("../components/ControlInput");
|
|
36
39
|
var import_icons = require("@ant-design/icons");
|
|
37
40
|
var import_antd = require("antd");
|
|
38
41
|
var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
|
|
42
|
+
var import_lucide_react = require("lucide-react");
|
|
39
43
|
var import_react = require("react");
|
|
40
44
|
var import_react_layout_kit = require("react-layout-kit");
|
|
41
|
-
var import_ActionIcon = __toESM(require("../ActionIcon"));
|
|
42
|
-
var import_Chat = require("../Chat");
|
|
43
|
-
var import_ControlInput = require("../components/ControlInput");
|
|
44
|
-
var import_lucide_react = require("lucide-react");
|
|
45
45
|
var EditableMessageList = (0, import_react.memo)(
|
|
46
46
|
({ disabled, dataSources, onChange }) => {
|
|
47
47
|
const [chatMessages, dispatch] = (0, import_react.useReducer)(import_Chat.messagesReducer, dataSources);
|
|
@@ -91,8 +91,8 @@ var EditableMessageList = (0, import_react.memo)(
|
|
|
91
91
|
import_ActionIcon.default,
|
|
92
92
|
{
|
|
93
93
|
icon: import_lucide_react.TrashIcon,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
placement: "right",
|
|
95
|
+
title: "Delete",
|
|
96
96
|
onClick: () => {
|
|
97
97
|
dispatch({ type: "deleteMessage", index });
|
|
98
98
|
}
|
package/lib/Icon/index.d.ts
CHANGED
package/lib/Icon/index.js
CHANGED
|
@@ -29,12 +29,15 @@ var Icon = ({ icon, size = "normal", ...props }) => {
|
|
|
29
29
|
const SvgIcon = icon;
|
|
30
30
|
switch (size) {
|
|
31
31
|
case "large":
|
|
32
|
-
case "normal":
|
|
33
32
|
fontSize = 24;
|
|
34
33
|
strokeWidth = 2;
|
|
35
34
|
break;
|
|
36
|
-
case "
|
|
35
|
+
case "normal":
|
|
37
36
|
fontSize = 20;
|
|
37
|
+
strokeWidth = 2;
|
|
38
|
+
break;
|
|
39
|
+
case "small":
|
|
40
|
+
fontSize = 14;
|
|
38
41
|
strokeWidth = 1.5;
|
|
39
42
|
break;
|
|
40
43
|
default:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputProps as AntdInputProps } from 'antd';
|
|
3
|
+
import { TextAreaProps as AntdTextAreaProps } from 'antd/es/input/TextArea';
|
|
4
|
+
export interface InputProps extends AntdInputProps {
|
|
5
|
+
ref?: any;
|
|
6
|
+
type?: 'ghost' | 'block';
|
|
7
|
+
}
|
|
8
|
+
export declare const Input: import("react").NamedExoticComponent<InputProps>;
|
|
9
|
+
export interface TextAreaProps extends AntdTextAreaProps {
|
|
10
|
+
ref?: any;
|
|
11
|
+
type?: 'ghost' | 'block';
|
|
12
|
+
}
|
|
13
|
+
export declare const TextArea: import("react").NamedExoticComponent<TextAreaProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/Input/index.tsx
|
|
20
|
+
var Input_exports = {};
|
|
21
|
+
__export(Input_exports, {
|
|
22
|
+
Input: () => Input,
|
|
23
|
+
TextArea: () => TextArea
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Input_exports);
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_style = require("./style");
|
|
29
|
+
var Input = (0, import_react.memo)(({ className, type = "ghost", ...props }) => {
|
|
30
|
+
const { styles, cx } = (0, import_style.useStyles)({ type });
|
|
31
|
+
return /* @__PURE__ */ React.createElement(import_antd.Input, { className: cx(styles.input, className), ...props });
|
|
32
|
+
});
|
|
33
|
+
var TextArea = (0, import_react.memo)(({ className, type = "ghost", ...props }) => {
|
|
34
|
+
const { styles, cx } = (0, import_style.useStyles)({ type });
|
|
35
|
+
return /* @__PURE__ */ React.createElement(import_antd.Input.TextArea, { className: cx(styles.textarea, className), ...props });
|
|
36
|
+
});
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Input,
|
|
40
|
+
TextArea
|
|
41
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/Input/style.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
useStyles: () => useStyles
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_antd_style = require("antd-style");
|
|
26
|
+
var import_polished = require("polished");
|
|
27
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token }, { type }) => ({
|
|
28
|
+
input: css`
|
|
29
|
+
position: relative;
|
|
30
|
+
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
height: 36px;
|
|
33
|
+
padding: 0 12px;
|
|
34
|
+
|
|
35
|
+
background-color: ${type === "block" ? (0, import_polished.rgba)(token.colorBgElevated, 0.6) : "transparent"};
|
|
36
|
+
border: 1px solid ${type === "block" ? "transparent" : token.colorBorder};
|
|
37
|
+
|
|
38
|
+
transition: background-color 100ms ${token.motionEaseOut};
|
|
39
|
+
|
|
40
|
+
input {
|
|
41
|
+
background: transparent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: ${token.colorFillTertiary};
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
textarea: css`
|
|
49
|
+
position: relative;
|
|
50
|
+
|
|
51
|
+
max-width: 100%;
|
|
52
|
+
padding: 8px 12px;
|
|
53
|
+
|
|
54
|
+
background-color: ${type === "block" ? (0, import_polished.rgba)(token.colorBgElevated, 0.6) : "transparent"};
|
|
55
|
+
border: 1px solid ${type === "block" ? "transparent" : token.colorBorder};
|
|
56
|
+
|
|
57
|
+
transition: background-color 100ms ${token.motionEaseOut};
|
|
58
|
+
|
|
59
|
+
textarea {
|
|
60
|
+
background: transparent;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
background-color: ${token.colorFillTertiary};
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
}));
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
useStyles
|
|
71
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type TextAreaProps } from "../index";
|
|
2
3
|
import { ButtonProps } from 'antd';
|
|
3
4
|
/**
|
|
4
5
|
* @title MessageInputProps
|
|
@@ -30,6 +31,7 @@ export interface MessageInputProps {
|
|
|
30
31
|
renderButtons?: (text: string) => ButtonProps[];
|
|
31
32
|
height?: number;
|
|
32
33
|
className?: string;
|
|
34
|
+
type?: TextAreaProps['type'];
|
|
33
35
|
}
|
|
34
36
|
declare const MessageInput: import("react").NamedExoticComponent<MessageInputProps>;
|
|
35
37
|
export default MessageInput;
|
|
@@ -22,18 +22,19 @@ __export(MessageInput_exports, {
|
|
|
22
22
|
default: () => MessageInput_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(MessageInput_exports);
|
|
25
|
+
var import__ = require("../index");
|
|
25
26
|
var import_antd = require("antd");
|
|
26
27
|
var import_antd_style = require("antd-style");
|
|
27
28
|
var import_react = require("react");
|
|
28
29
|
var import_react_layout_kit = require("react-layout-kit");
|
|
29
30
|
var MessageInput = (0, import_react.memo)(
|
|
30
|
-
({ onCancel, defaultValue, onConfirm, renderButtons, height, className }) => {
|
|
31
|
+
({ type, onCancel, defaultValue, onConfirm, renderButtons, height, className }) => {
|
|
31
32
|
const [tempSystemRole, setRole] = (0, import_react.useState)(defaultValue || "");
|
|
32
33
|
return /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { gap: 8 }, /* @__PURE__ */ React.createElement(
|
|
33
|
-
|
|
34
|
+
import__.TextArea,
|
|
34
35
|
{
|
|
36
|
+
type,
|
|
35
37
|
value: tempSystemRole,
|
|
36
|
-
allowClear: true,
|
|
37
38
|
placeholder: "例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。",
|
|
38
39
|
style: { height: height ?? 200 },
|
|
39
40
|
onChange: (e) => {
|
|
@@ -49,8 +50,8 @@ var MessageInput = (0, import_react.memo)(
|
|
|
49
50
|
onConfirm == null ? void 0 : onConfirm(tempSystemRole);
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
|
-
"
|
|
53
|
-
), /* @__PURE__ */ React.createElement(import_antd.Button, { type: "text", onClick: onCancel }, "
|
|
53
|
+
"Confirm"
|
|
54
|
+
), /* @__PURE__ */ React.createElement(import_antd.Button, { type: "text", onClick: onCancel }, "Cancel"))));
|
|
54
55
|
}
|
|
55
56
|
);
|
|
56
57
|
var MessageInput_default = MessageInput;
|
package/lib/SearchBar/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InputProps } from
|
|
2
|
+
import { InputProps } from "../index";
|
|
3
3
|
export interface SearchBarProps extends InputProps {
|
|
4
4
|
shortKey?: string;
|
|
5
5
|
enableShortKey?: boolean;
|
|
6
|
-
type?: 'ghost' | 'block';
|
|
7
6
|
}
|
|
8
7
|
declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
|
|
9
8
|
export default SearchBar;
|
package/lib/SearchBar/index.js
CHANGED
|
@@ -32,20 +32,10 @@ var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(
|
|
|
32
32
|
);
|
|
33
33
|
var symbol = isAppleDevice ? "⌘" : "Ctrl";
|
|
34
34
|
var SearchBar = (0, import_react.memo)(
|
|
35
|
-
({
|
|
36
|
-
className,
|
|
37
|
-
value,
|
|
38
|
-
onChange,
|
|
39
|
-
style,
|
|
40
|
-
placeholder,
|
|
41
|
-
type = "ghost",
|
|
42
|
-
enableShortKey,
|
|
43
|
-
shortKey = "f",
|
|
44
|
-
...props
|
|
45
|
-
}) => {
|
|
35
|
+
({ className, value, onChange, placeholder, enableShortKey, shortKey = "f", ...props }) => {
|
|
46
36
|
const [showTag, setShowTag] = (0, import_react.useState)(true);
|
|
47
37
|
const [inputValue, setInputValue] = (0, import_react.useState)(value);
|
|
48
|
-
const { styles, cx } = (0, import_style.useStyles)(
|
|
38
|
+
const { styles, cx } = (0, import_style.useStyles)();
|
|
49
39
|
const inputRef = (0, import_react.useRef)(null);
|
|
50
40
|
(0, import_react.useEffect)(() => {
|
|
51
41
|
if (!enableShortKey)
|
|
@@ -59,24 +49,15 @@ var SearchBar = (0, import_react.memo)(
|
|
|
59
49
|
document.addEventListener("keydown", handler);
|
|
60
50
|
return () => document.removeEventListener("keydown", handler);
|
|
61
51
|
}, []);
|
|
62
|
-
return /* @__PURE__ */ React.createElement("div", { className:
|
|
63
|
-
|
|
52
|
+
return /* @__PURE__ */ React.createElement("div", { className: styles.search }, /* @__PURE__ */ React.createElement(
|
|
53
|
+
import__.Input,
|
|
64
54
|
{
|
|
65
55
|
ref: inputRef,
|
|
66
|
-
className: styles.input,
|
|
67
|
-
prefix: /* @__PURE__ */ React.createElement(
|
|
68
|
-
import__.Icon,
|
|
69
|
-
{
|
|
70
|
-
className: styles.icon,
|
|
71
|
-
icon: import_lucide_react.Search,
|
|
72
|
-
size: { fontSize: 14 },
|
|
73
|
-
style: { marginRight: 4 }
|
|
74
|
-
}
|
|
75
|
-
),
|
|
56
|
+
className: cx(styles.input, className),
|
|
57
|
+
prefix: /* @__PURE__ */ React.createElement(import__.Icon, { className: styles.icon, icon: import_lucide_react.Search, size: "small", style: { marginRight: 4 } }),
|
|
76
58
|
allowClear: true,
|
|
77
59
|
value,
|
|
78
60
|
placeholder: placeholder ?? "Type keywords...",
|
|
79
|
-
style: { ...style, borderColor: "transparent" },
|
|
80
61
|
onChange: (e) => {
|
|
81
62
|
setInputValue(e.target.value);
|
|
82
63
|
setShowTag(e.target.value ? false : true);
|
package/lib/SearchBar/style.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const useStyles: (props?: {
|
|
2
|
-
type: 'ghost' | 'block';
|
|
3
|
-
} | undefined) => import("antd-style").ReturnStyles<{
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
4
2
|
search: import("antd-style").SerializedStyles;
|
|
5
3
|
input: import("antd-style").SerializedStyles;
|
|
6
4
|
tag: import("antd-style").SerializedStyles;
|
package/lib/SearchBar/style.js
CHANGED
|
@@ -23,33 +23,14 @@ __export(style_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(style_exports);
|
|
25
25
|
var import_antd_style = require("antd-style");
|
|
26
|
-
var
|
|
27
|
-
var useStyles = (0, import_antd_style.createStyles)(({ css, token }, { type }) => ({
|
|
26
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token }) => ({
|
|
28
27
|
search: css`
|
|
29
28
|
position: relative;
|
|
30
29
|
max-width: 100%;
|
|
31
|
-
height: 36px;
|
|
32
30
|
`,
|
|
33
31
|
input: css`
|
|
34
32
|
position: relative;
|
|
35
|
-
height: inherit;
|
|
36
33
|
padding: 0 8px 0 12px;
|
|
37
|
-
transition: background-color 100ms ${token.motionEaseOut};
|
|
38
|
-
|
|
39
|
-
${type === "block" ? css`
|
|
40
|
-
background-color: ${(0, import_polished.rgba)(token.colorBgElevated, 0.6)} !important;
|
|
41
|
-
` : css`
|
|
42
|
-
background: transparent !important;
|
|
43
|
-
border: 1px solid ${token.colorBorder} !important;
|
|
44
|
-
`}
|
|
45
|
-
|
|
46
|
-
&:hover {
|
|
47
|
-
background-color: ${token.colorFillTertiary} !important;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
input {
|
|
51
|
-
background: transparent;
|
|
52
|
-
}
|
|
53
34
|
`,
|
|
54
35
|
tag: css`
|
|
55
36
|
position: absolute;
|
package/lib/StroyBook/style.js
CHANGED
|
@@ -72,9 +72,14 @@ var useStyles = (0, import_antd_style.createStyles)(
|
|
|
72
72
|
background: transparent;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
|
|
75
76
|
input:checked + label > svg {
|
|
76
77
|
stroke: ${token.colorBorder};
|
|
77
78
|
}
|
|
79
|
+
|
|
80
|
+
button {
|
|
81
|
+
--leva-colors-accent2: ${token.colorFillSecondary};
|
|
82
|
+
}
|
|
78
83
|
`
|
|
79
84
|
};
|
|
80
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { InputProps } from
|
|
2
|
+
import { InputProps } from "../index";
|
|
3
3
|
export interface ControlInputProps extends Omit<InputProps, 'onChange' | 'value' | 'onAbort'> {
|
|
4
4
|
onChange?: (value: string) => void;
|
|
5
5
|
onValueChanging?: (value: string) => void;
|
|
@@ -22,7 +22,9 @@ __export(ControlInput_exports, {
|
|
|
22
22
|
ControlInput: () => ControlInput
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(ControlInput_exports);
|
|
25
|
+
var import__ = require("../index");
|
|
25
26
|
var import_antd = require("antd");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
26
28
|
var import_react = require("react");
|
|
27
29
|
var ControlInput = (0, import_react.memo)(
|
|
28
30
|
({ value, onChange, onValueChanging, onChangeEnd, ...props }) => {
|
|
@@ -38,7 +40,7 @@ var ControlInput = (0, import_react.memo)(
|
|
|
38
40
|
setInput(value);
|
|
39
41
|
}, [value]);
|
|
40
42
|
return /* @__PURE__ */ React.createElement(
|
|
41
|
-
|
|
43
|
+
import__.Input,
|
|
42
44
|
{
|
|
43
45
|
ref: inputRef,
|
|
44
46
|
...props,
|
|
@@ -68,29 +70,17 @@ var ControlInput = (0, import_react.memo)(
|
|
|
68
70
|
onChangeEnd == null ? void 0 : onChangeEnd(input);
|
|
69
71
|
}
|
|
70
72
|
},
|
|
71
|
-
suffix: value === input ? /* @__PURE__ */ React.createElement("span", null) : /* @__PURE__ */ React.createElement(import_antd.ConfigProvider, { theme: { token: { fontSize: 14 } } }, /* @__PURE__ */ React.createElement(
|
|
72
|
-
|
|
73
|
+
suffix: value === input ? /* @__PURE__ */ React.createElement("span", null) : /* @__PURE__ */ React.createElement(import_antd.ConfigProvider, { theme: { token: { fontSize: 14 } } }, /* @__PURE__ */ React.createElement(import_antd.Space, { size: 2 }, /* @__PURE__ */ React.createElement(
|
|
74
|
+
import__.ActionIcon,
|
|
73
75
|
{
|
|
74
|
-
|
|
76
|
+
title: "Reset",
|
|
77
|
+
icon: import_lucide_react.RotateCcw,
|
|
75
78
|
size: "small",
|
|
76
79
|
onClick: () => {
|
|
77
80
|
setInput(value);
|
|
78
|
-
},
|
|
79
|
-
style: { padding: 0 }
|
|
80
|
-
},
|
|
81
|
-
"重置"
|
|
82
|
-
), /* @__PURE__ */ React.createElement(
|
|
83
|
-
import_antd.Button,
|
|
84
|
-
{
|
|
85
|
-
type: "link",
|
|
86
|
-
size: "small",
|
|
87
|
-
style: { padding: 0 },
|
|
88
|
-
onClick: () => {
|
|
89
|
-
updateValue();
|
|
90
81
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
))
|
|
82
|
+
}
|
|
83
|
+
), /* @__PURE__ */ React.createElement(import__.ActionIcon, { title: "✅ Save", icon: import_lucide_react.Save, size: "small", onClick: updateValue })))
|
|
94
84
|
}
|
|
95
85
|
);
|
|
96
86
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as EditableMessageList, type EditableMessageListProps, } from '
|
|
|
10
10
|
export { default as EditableText, type EditableTextProps } from './EditableText';
|
|
11
11
|
export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
|
|
12
12
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
13
|
+
export { Input, TextArea, type InputProps, type TextAreaProps } from './Input';
|
|
13
14
|
export { default as List } from './List';
|
|
14
15
|
export { default as Logo, type LogoProps } from './Logo';
|
|
15
16
|
export { default as Markdown, type MarkdownProps } from './Markdown';
|
package/lib/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
EditableText: () => import_EditableText.default,
|
|
41
41
|
Highlighter: () => import_Highlighter.default,
|
|
42
42
|
Icon: () => import_Icon.default,
|
|
43
|
+
Input: () => import_Input.Input,
|
|
43
44
|
List: () => import_List.default,
|
|
44
45
|
Logo: () => import_Logo.default,
|
|
45
46
|
Markdown: () => import_Markdown.default,
|
|
@@ -52,6 +53,7 @@ __export(src_exports, {
|
|
|
52
53
|
Swatches: () => import_Swatches.default,
|
|
53
54
|
SyntaxHighlighter: () => import_Highlighter.SyntaxHighlighter,
|
|
54
55
|
TabsNav: () => import_TabsNav.default,
|
|
56
|
+
TextArea: () => import_Input.TextArea,
|
|
55
57
|
ThemeProvider: () => import_ThemeProvider.default,
|
|
56
58
|
ThemeSwitch: () => import_ThemeSwitch.default,
|
|
57
59
|
Tooltip: () => import_Tooltip.default,
|
|
@@ -70,6 +72,7 @@ var import_EditableMessageList = __toESM(require("./EditableMessageList"));
|
|
|
70
72
|
var import_EditableText = __toESM(require("./EditableText"));
|
|
71
73
|
var import_Highlighter = __toESM(require("./Highlighter"));
|
|
72
74
|
var import_Icon = __toESM(require("./Icon"));
|
|
75
|
+
var import_Input = require("./Input");
|
|
73
76
|
var import_List = __toESM(require("./List"));
|
|
74
77
|
var import_Logo = __toESM(require("./Logo"));
|
|
75
78
|
var import_Markdown = __toESM(require("./Markdown"));
|
|
@@ -97,6 +100,7 @@ var import_Tooltip = __toESM(require("./Tooltip"));
|
|
|
97
100
|
EditableText,
|
|
98
101
|
Highlighter,
|
|
99
102
|
Icon,
|
|
103
|
+
Input,
|
|
100
104
|
List,
|
|
101
105
|
Logo,
|
|
102
106
|
Markdown,
|
|
@@ -109,6 +113,7 @@ var import_Tooltip = __toESM(require("./Tooltip"));
|
|
|
109
113
|
Swatches,
|
|
110
114
|
SyntaxHighlighter,
|
|
111
115
|
TabsNav,
|
|
116
|
+
TextArea,
|
|
112
117
|
ThemeProvider,
|
|
113
118
|
ThemeSwitch,
|
|
114
119
|
Tooltip,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -11,8 +11,19 @@ export type DivProps = React.DetailedHTMLProps<
|
|
|
11
11
|
HTMLDivElement
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
14
|
+
export type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export type ImgProps = React.DetailedHTMLProps<
|
|
17
|
+
React.HTMLAttributes<HTMLImageElement>,
|
|
18
|
+
HTMLImageElement
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type InputProps = React.DetailedHTMLProps<
|
|
22
|
+
React.HTMLAttributes<HTMLInputElement>,
|
|
23
|
+
HTMLInputElement
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type TextAreaProps = React.DetailedHTMLProps<
|
|
27
|
+
React.HTMLAttributes<HTMLTextAreaElement>,
|
|
28
|
+
HTMLTextAreaElement
|
|
29
|
+
>;
|