@lobehub/ui 1.145.6 → 1.146.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/ChatHeader/index.d.ts +7 -4
- package/es/ChatHeader/index.js +10 -2
- package/es/ChatHeader/style.d.ts +1 -0
- package/es/ChatHeader/style.js +5 -4
- package/es/SearchBar/index.d.ts +15 -6
- package/es/SearchBar/index.js +40 -10
- package/package.json +1 -1
package/es/ChatHeader/index.d.ts
CHANGED
|
@@ -2,14 +2,12 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import { DivProps } from "../types";
|
|
3
3
|
export interface ChatHeaderProps extends DivProps {
|
|
4
4
|
classNames?: {
|
|
5
|
+
center?: string;
|
|
5
6
|
left?: string;
|
|
6
7
|
right?: string;
|
|
7
8
|
};
|
|
8
|
-
contentStyles?: {
|
|
9
|
-
left?: CSSProperties;
|
|
10
|
-
right?: CSSProperties;
|
|
11
|
-
};
|
|
12
9
|
gap?: {
|
|
10
|
+
center?: number;
|
|
13
11
|
left?: number;
|
|
14
12
|
right?: number;
|
|
15
13
|
};
|
|
@@ -17,6 +15,11 @@ export interface ChatHeaderProps extends DivProps {
|
|
|
17
15
|
onBackClick?: () => void;
|
|
18
16
|
right?: ReactNode;
|
|
19
17
|
showBackButton?: boolean;
|
|
18
|
+
styles?: {
|
|
19
|
+
center?: CSSProperties;
|
|
20
|
+
left?: CSSProperties;
|
|
21
|
+
right?: CSSProperties;
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
declare const ChatHeader: import("react").NamedExoticComponent<ChatHeaderProps>;
|
|
22
25
|
export default ChatHeader;
|
package/es/ChatHeader/index.js
CHANGED
|
@@ -12,11 +12,12 @@ var ChatHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
12
12
|
right = _ref.right,
|
|
13
13
|
className = _ref.className,
|
|
14
14
|
style = _ref.style,
|
|
15
|
-
contentStyles = _ref.
|
|
15
|
+
contentStyles = _ref.styles,
|
|
16
16
|
classNames = _ref.classNames,
|
|
17
17
|
showBackButton = _ref.showBackButton,
|
|
18
18
|
onBackClick = _ref.onBackClick,
|
|
19
|
-
gap = _ref.gap
|
|
19
|
+
gap = _ref.gap,
|
|
20
|
+
children = _ref.children;
|
|
20
21
|
var _useStyles = useStyles(),
|
|
21
22
|
cx = _useStyles.cx,
|
|
22
23
|
styles = _useStyles.styles;
|
|
@@ -45,6 +46,13 @@ var ChatHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
46
|
marginRight: gap !== null && gap !== void 0 && gap.left ? -gap.left / 2 : -6
|
|
46
47
|
}
|
|
47
48
|
}), left]
|
|
49
|
+
}), children && /*#__PURE__*/_jsx(Flexbox, {
|
|
50
|
+
align: 'center',
|
|
51
|
+
className: cx(styles.center, classNames === null || classNames === void 0 ? void 0 : classNames.center),
|
|
52
|
+
gap: (gap === null || gap === void 0 ? void 0 : gap.center) || 12,
|
|
53
|
+
horizontal: true,
|
|
54
|
+
style: contentStyles === null || contentStyles === void 0 ? void 0 : contentStyles.center,
|
|
55
|
+
children: children
|
|
48
56
|
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
49
57
|
align: 'center',
|
|
50
58
|
className: cx(styles.right, classNames === null || classNames === void 0 ? void 0 : classNames.right),
|
package/es/ChatHeader/style.d.ts
CHANGED
package/es/ChatHeader/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { rgba } from 'polished';
|
|
5
5
|
export var useStyles = createStyles(function (_ref) {
|
|
@@ -8,8 +8,9 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
8
8
|
stylish = _ref.stylish,
|
|
9
9
|
cx = _ref.cx;
|
|
10
10
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
center: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n "]))),
|
|
12
|
+
container: cx(stylish.blurStrong, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n\n overflow: hidden;\n grid-area: header;\n align-self: stretch;\n\n width: 100%;\n height: 64px;\n\n background: linear-gradient(\n to bottom,\n ", ",\n ", "\n );\n border-block-end: 1px solid ", ";\n "])), rgba(token.colorBgLayout, 0.8), rgba(token.colorBgLayout, 0.4), token.colorBorder)),
|
|
13
|
+
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: 1;\n "]))),
|
|
14
|
+
right: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: none;\n "])))
|
|
14
15
|
};
|
|
15
16
|
});
|
package/es/SearchBar/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
2
|
import { type InputProps } from "../Input";
|
|
3
|
-
export interface SearchBarProps extends InputProps {
|
|
3
|
+
export interface SearchBarProps extends Omit<InputProps, 'styles' | 'classNames'> {
|
|
4
|
+
classNames: {
|
|
5
|
+
input?: string;
|
|
6
|
+
shortKey?: string;
|
|
7
|
+
};
|
|
4
8
|
defaultValue?: string;
|
|
5
9
|
/**
|
|
6
10
|
* @description Whether to enable the shortcut key to focus on the input
|
|
@@ -9,16 +13,21 @@ export interface SearchBarProps extends InputProps {
|
|
|
9
13
|
enableShortKey?: boolean;
|
|
10
14
|
loading?: boolean;
|
|
11
15
|
onInputChange?: (value: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @description Whether add spotlight background
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
onSearch?: (value: string) => void;
|
|
12
21
|
/**
|
|
13
22
|
* @description The shortcut key to focus on the input. Only works if `enableShortKey` is true
|
|
14
23
|
* @default 'f'
|
|
15
24
|
*/
|
|
16
25
|
shortKey?: string;
|
|
17
|
-
/**
|
|
18
|
-
* @description Whether add spotlight background
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
26
|
spotlight?: boolean;
|
|
27
|
+
styles: {
|
|
28
|
+
input?: CSSProperties;
|
|
29
|
+
shortKey?: CSSProperties;
|
|
30
|
+
};
|
|
22
31
|
value?: string;
|
|
23
32
|
}
|
|
24
33
|
declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
|
package/es/SearchBar/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChange", "placeholder", "enableShortKey", "shortKey", "loading"];
|
|
6
|
+
var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChange", "placeholder", "enableShortKey", "shortKey", "onSearch", "loading", "style", "onChange", "onBlur", "onPressEnter", "onFocus", "styles", "classNames"];
|
|
7
7
|
import { LucideLoader2, Search } from 'lucide-react';
|
|
8
8
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import useControlledState from 'use-merge-value';
|
|
@@ -24,8 +24,20 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
enableShortKey = _ref.enableShortKey,
|
|
25
25
|
_ref$shortKey = _ref.shortKey,
|
|
26
26
|
shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
|
|
27
|
+
onSearch = _ref.onSearch,
|
|
27
28
|
loading = _ref.loading,
|
|
28
|
-
|
|
29
|
+
style = _ref.style,
|
|
30
|
+
_onChange = _ref.onChange,
|
|
31
|
+
_onBlur = _ref.onBlur,
|
|
32
|
+
_onPressEnter = _ref.onPressEnter,
|
|
33
|
+
_onFocus = _ref.onFocus,
|
|
34
|
+
_ref$styles = _ref.styles,
|
|
35
|
+
inputStyle = _ref$styles.input,
|
|
36
|
+
shortKeyStyle = _ref$styles.shortKey,
|
|
37
|
+
_ref$classNames = _ref.classNames,
|
|
38
|
+
inputClassName = _ref$classNames.input,
|
|
39
|
+
shortKeyClassName = _ref$classNames.shortKey,
|
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
41
|
var _useControlledState = useControlledState(defaultValue, {
|
|
30
42
|
defaultValue: defaultValue,
|
|
31
43
|
onChange: onInputChange,
|
|
@@ -67,18 +79,34 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
67
79
|
}, []);
|
|
68
80
|
return /*#__PURE__*/_jsxs("div", {
|
|
69
81
|
className: cx(styles.search, className),
|
|
82
|
+
style: style,
|
|
70
83
|
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
71
84
|
allowClear: true,
|
|
72
|
-
className: styles.input,
|
|
73
|
-
onBlur: function onBlur() {
|
|
74
|
-
|
|
85
|
+
className: cx(styles.input, inputClassName),
|
|
86
|
+
onBlur: function onBlur(e) {
|
|
87
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(e);
|
|
88
|
+
setInputValue(e.target.value);
|
|
89
|
+
if (!e.target.value) {
|
|
90
|
+
setShowTag(true);
|
|
91
|
+
}
|
|
75
92
|
},
|
|
76
93
|
onChange: function onChange(e) {
|
|
94
|
+
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
77
95
|
setInputValue(e.target.value);
|
|
78
|
-
|
|
96
|
+
if (e.target.value) {
|
|
97
|
+
setShowTag(false);
|
|
98
|
+
} else {
|
|
99
|
+
setShowTag(true);
|
|
100
|
+
onSearch === null || onSearch === void 0 || onSearch(e.target.value);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onFocus: function onFocus(e) {
|
|
104
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(e);
|
|
105
|
+
setShowTag(false);
|
|
79
106
|
},
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
onPressEnter: function onPressEnter(e) {
|
|
108
|
+
_onPressEnter === null || _onPressEnter === void 0 || _onPressEnter(e);
|
|
109
|
+
onSearch === null || onSearch === void 0 || onSearch(inputValue);
|
|
82
110
|
},
|
|
83
111
|
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Type keywords...',
|
|
84
112
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -91,9 +119,11 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
91
119
|
}
|
|
92
120
|
}),
|
|
93
121
|
ref: inputReference,
|
|
122
|
+
style: inputStyle,
|
|
94
123
|
value: value
|
|
95
|
-
},
|
|
96
|
-
className: styles.tag,
|
|
124
|
+
}, rest)), enableShortKey && showTag && !inputValue && /*#__PURE__*/_jsxs(Tag, {
|
|
125
|
+
className: cx(styles.tag, shortKeyClassName),
|
|
126
|
+
style: shortKeyStyle,
|
|
97
127
|
children: [symbol, " ", shortKey.toUpperCase()]
|
|
98
128
|
})]
|
|
99
129
|
});
|