@lobehub/ui 1.8.1 → 1.9.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.
Files changed (56) hide show
  1. package/es/ActionIcon/index.js +1 -3
  2. package/es/Chat/store/store.js +8 -10
  3. package/es/Chat/utils/fetch.js +3 -3
  4. package/es/ContextMenu/MenuItem/index.js +1 -2
  5. package/es/ContextMenu/index.js +1 -3
  6. package/es/Conversation/ChatList/index.js +1 -3
  7. package/es/Conversation/InputArea/index.js +1 -1
  8. package/es/Conversation/StoreUpdater.js +0 -2
  9. package/es/Conversation/index.js +1 -3
  10. package/es/CopyButton/index.js +1 -3
  11. package/es/DraggablePanel/index.js +1 -2
  12. package/es/EditableText/index.js +14 -10
  13. package/es/Highlighter/SyntaxHighlighter/Prism.js +1 -3
  14. package/es/Icon/index.js +1 -3
  15. package/es/List/ListItem/index.js +1 -3
  16. package/es/Logo/Divider.js +1 -3
  17. package/es/Logo/Logo3D.js +1 -3
  18. package/es/Logo/LogoFlat.js +1 -3
  19. package/es/Logo/LogoHighContrast.js +1 -3
  20. package/es/Logo/LogoText.js +1 -3
  21. package/es/Logo/index.js +1 -3
  22. package/es/Markdown/style.js +1 -1
  23. package/es/MessageInput/index.js +1 -3
  24. package/es/SearchBar/index.d.ts +6 -2
  25. package/es/SearchBar/index.js +83 -18
  26. package/es/SearchBar/style.d.ts +8 -0
  27. package/es/SearchBar/style.js +15 -0
  28. package/es/SideNav/index.js +1 -3
  29. package/es/Snippet/index.js +1 -3
  30. package/es/StroyBook/index.js +1 -3
  31. package/es/StroyBook/style.js +1 -1
  32. package/es/TabsNav/index.js +1 -3
  33. package/es/ThemeProvider/GlobalStyle.js +4 -1
  34. package/es/ThemeProvider/index.js +1 -5
  35. package/es/ThemeSwitch/index.js +1 -3
  36. package/es/Tooltip/index.js +6 -5
  37. package/es/components/ControlInput.js +1 -3
  38. package/es/hooks/useHighlight.js +3 -3
  39. package/es/styles/algorithms/index.js +1 -2
  40. package/es/styles/theme/base.js +4 -4
  41. package/es/styles/theme/dark.js +1 -2
  42. package/es/styles/theme/light.js +1 -3
  43. package/lib/Conversation/InputArea/index.js +0 -1
  44. package/lib/Conversation/StoreUpdater.js +0 -2
  45. package/lib/EditableText/index.js +10 -6
  46. package/lib/Markdown/style.js +1 -1
  47. package/lib/SearchBar/index.d.ts +6 -2
  48. package/lib/SearchBar/index.js +62 -9
  49. package/lib/SearchBar/style.d.ts +8 -0
  50. package/lib/SearchBar/style.js +68 -0
  51. package/lib/StroyBook/style.js +1 -0
  52. package/lib/ThemeProvider/GlobalStyle.js +9 -2
  53. package/lib/ThemeProvider/index.js +0 -1
  54. package/lib/Tooltip/index.js +2 -2
  55. package/lib/styles/theme/base.js +4 -4
  56. package/package.json +65 -65
@@ -1,7 +1,7 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { createGlobalStyle } from 'antd-style';
4
- var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\";\n --font-variations: \"opsz\" auto;\n\n overflow-x: hidden;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-tap-highlight-color: transparent;\n }\n\n\n * {\n box-sizing: border-box;\n vertical-align: baseline;\n }\n\n #root {\n\t min-height: 100vh;\n }\n\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n background-color: transparent;\n\n &-thumb {\n background-color: ", ";\n border-radius: 4px;\n }\n\n &-corner {\n display: none;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n"])), function (_ref) {
4
+ var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\", \"tnum\", \"kern\";\n --font-variations: \"opsz\" auto, tabular-nums;\n\n overflow-x: hidden;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-tap-highlight-color: transparent;\n }\n\n\n * {\n box-sizing: border-box;\n vertical-align: baseline;\n }\n\n #root {\n\t min-height: 100vh;\n }\n\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n background-color: transparent;\n\n &-thumb {\n background-color: ", ";\n border-radius: 4px;\n }\n\n &-corner {\n display: none;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n\n code {\n\t font-family: ", " !important;\n\t * {\n\t\t font-family: inherit !important;\n\t }\n }\n"])), function (_ref) {
5
5
  var theme = _ref.theme;
6
6
  return theme.fontFamily;
7
7
  }, function (_ref2) {
@@ -16,5 +16,8 @@ var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _tagge
16
16
  }, function (_ref5) {
17
17
  var theme = _ref5.theme;
18
18
  return theme.colorFill;
19
+ }, function (_ref6) {
20
+ var theme = _ref6.theme;
21
+ return theme.fontFamilyCode;
19
22
  });
20
23
  export default GlobalStyle;
@@ -1,6 +1,4 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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; }
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; }
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
2
  import { App } from 'antd';
5
3
  import { ThemeProvider as AntdThemeProvider, StyleProvider, setupStyled } from 'antd-style';
6
4
  import React, { useCallback } from 'react';
@@ -34,8 +32,6 @@ var ThemeProvider = function ThemeProvider(_ref) {
34
32
  customStylish: getCustomStylish,
35
33
  customToken: getCustomToken,
36
34
  children: [/*#__PURE__*/_jsx(ReactFontLoader, {
37
- url: "https://raw.githubusercontent.com/divspace/hack/master/css/hack.css"
38
- }), /*#__PURE__*/_jsx(ReactFontLoader, {
39
35
  url: "https://raw.githubusercontent.com/IKKI2000/harmonyos-fonts/main/css/harmonyos_sans.css"
40
36
  }), /*#__PURE__*/_jsx(ReactFontLoader, {
41
37
  url: "https://raw.githubusercontent.com/IKKI2000/harmonyos-fonts/main/css/harmonyos_sans_sc.css"
@@ -1,8 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  var _excluded = ["size", "themeMode", "onThemeSwitch"];
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
- 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
4
  import { ActionIcon, Icon } from "./..";
7
5
  import { Dropdown } from 'antd';
8
6
  import { Monitor, Moon, Sun } from 'lucide-react';
@@ -1,20 +1,21 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["className"];
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
- 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; }
3
+ var _excluded = ["className", "arrow"];
6
4
  import { Tooltip as AntdTooltip } from 'antd';
7
5
  import { memo } from 'react';
8
6
  import { useStyles } from "./style";
9
7
  import { jsx as _jsx } from "react/jsx-runtime";
10
8
  var Tooltip = /*#__PURE__*/memo(function (_ref) {
11
9
  var className = _ref.className,
10
+ _ref$arrow = _ref.arrow,
11
+ arrow = _ref$arrow === void 0 ? false : _ref$arrow,
12
12
  props = _objectWithoutProperties(_ref, _excluded);
13
13
  var _useStyles = useStyles(),
14
14
  styles = _useStyles.styles,
15
15
  cx = _useStyles.cx;
16
16
  return /*#__PURE__*/_jsx(AntdTooltip, _objectSpread({
17
- overlayClassName: cx(styles.tooltip, className)
17
+ overlayClassName: cx(styles.tooltip, className),
18
+ arrow: arrow
18
19
  }, props));
19
20
  });
20
21
  export default Tooltip;
@@ -1,9 +1,7 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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
4
  var _excluded = ["value", "onChange", "onValueChanging", "onChangeEnd"];
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
5
  import { Button, ConfigProvider, Input } from 'antd';
8
6
  import { memo, useCallback, useEffect, useRef, useState } from 'react';
9
7
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getHighlighter } from 'shiki-es';
4
4
  import { create } from 'zustand';
5
5
  var THEME = {
@@ -16,9 +16,9 @@ export var useHighlight = create(function (set, get) {
16
16
  return {
17
17
  highlighter: undefined,
18
18
  initHighlighter: function () {
19
- var _initHighlighter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
19
+ var _initHighlighter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
20
20
  var highlighter;
21
- return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
24
  if (get().highlighter) {
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- 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; }
4
- 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; }
5
4
  import { generateAssociatedColors } from "./colorRelationship";
6
5
  import { generateColorPalette, generateNeutralPalette } from "./paletteGenerator";
7
6
  var defaultRelationship = function defaultRelationship(type) {
@@ -1,7 +1,7 @@
1
- var FONT_EMOJI = "\"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Apple Color Emoji\", \"Twemoji Mozilla\", \"Noto Color Emoji\", \"Android Emoji\"";
2
- var FONT_EN = "\"HarmonyOS Sans\", \"Segoe UI\", \"SF Pro Display\",-apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif";
3
- var FONT_CN = "\"HarmonyOS Sans SC\", \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft Yahei UI\", \"Microsoft Yahei\", \"Source Han Sans CN\", sans-serif";
4
- var FONT_CODE = "ui-monospace, Hack, \"SFMono Regular\", Consolas, \"Liberation Mono\", Menlo, Courier, monospace";
1
+ var FONT_EMOJI = "\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Apple Color Emoji\",\"Twemoji Mozilla\",\"Noto Color Emoji\",\"Android Emoji\"";
2
+ var FONT_EN = "\"HarmonyOS Sans\",\"Segoe UI\",\"SF Pro Display\",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,\"Open Sans\",\"Helvetica Neue\",sans-serif";
3
+ var FONT_CN = "\"HarmonyOS Sans SC\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft Yahei UI\",\"Microsoft Yahei\",\"Source Han Sans CN\",sans-serif";
4
+ var FONT_CODE = "ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace";
5
5
  export var baseTheme = {
6
6
  token: {
7
7
  colorInfo: '#0070f3',
@@ -1,6 +1,5 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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; }
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; }
4
3
  import { theme } from 'antd';
5
4
  import { genMapTokenAlgorithm } from "../algorithms";
6
5
  import { baseTheme } from "./base";
@@ -1,6 +1,4 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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; }
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; }
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
2
  import { genMapTokenAlgorithm } from "../algorithms";
5
3
  import { baseTheme } from "./base";
6
4
  var lightMode = genMapTokenAlgorithm('light');
@@ -47,7 +47,6 @@ var useStyles = (0, import_antd_style.createStyles)(({ css, responsive, token })
47
47
  z-index: ${token.zIndexPopupBase};
48
48
  bottom: 0;
49
49
 
50
- width: ${token.contentWidth}px;
51
50
  padding-top: 12px;
52
51
  padding-bottom: 24px;
53
52
 
@@ -29,7 +29,6 @@ var StoreUpdater = ({
29
29
  createAt,
30
30
  title,
31
31
  description,
32
- agent,
33
32
  messages,
34
33
  onAgentChange,
35
34
  onMessagesChange,
@@ -37,7 +36,6 @@ var StoreUpdater = ({
37
36
  onResponseStart
38
37
  }) => {
39
38
  const useStoreUpdater = (0, import_zustand_utils.createStoreUpdater)((0, import_store.useStoreApi)());
40
- useStoreUpdater("agent", agent);
41
39
  useStoreUpdater("onAgentChange", onAgentChange);
42
40
  useStoreUpdater("messages", messages);
43
41
  useStoreUpdater("onMessagesChange", onMessagesChange);
@@ -22,11 +22,11 @@ __export(EditableText_exports, {
22
22
  default: () => EditableText_default
23
23
  });
24
24
  module.exports = __toCommonJS(EditableText_exports);
25
- var import_icons = require("@ant-design/icons");
26
- var import_antd = require("antd");
25
+ var import_ControlInput = require("../components/ControlInput");
26
+ var import__ = require("../index");
27
+ var import_lucide_react = require("lucide-react");
27
28
  var import_react = require("react");
28
29
  var import_react_layout_kit = require("react-layout-kit");
29
- var import_ControlInput = require("../components/ControlInput");
30
30
  var EditableText = (0, import_react.memo)(({ value, onChange }) => {
31
31
  const [edited, setEdited] = (0, import_react.useState)(false);
32
32
  return edited ? /* @__PURE__ */ React.createElement(
@@ -38,14 +38,18 @@ var EditableText = (0, import_react.memo)(({ value, onChange }) => {
38
38
  },
39
39
  onChange
40
40
  }
41
- ) : /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, value, /* @__PURE__ */ React.createElement(import_antd.Tooltip, { title: "编辑" }, /* @__PURE__ */ React.createElement(
42
- import_icons.EditOutlined,
41
+ ) : /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, value, /* @__PURE__ */ React.createElement(
42
+ import__.ActionIcon,
43
43
  {
44
+ title: "Edit",
45
+ placement: "right",
46
+ icon: import_lucide_react.Edit3,
47
+ size: { fontSize: 14, blockSize: 24 },
44
48
  onClick: () => {
45
49
  setEdited(!edited);
46
50
  }
47
51
  }
48
- )));
52
+ ));
49
53
  });
50
54
  var EditableText_default = EditableText;
51
55
  // Annotate the CommonJS export names for ESM import in node:
@@ -32,7 +32,7 @@ var useStyles = (0, import_antd_style.createStyles)(({ css, token, isDarkMode })
32
32
  margin: 20px auto;
33
33
 
34
34
  font-size: 14px;
35
- line-height: 2;
35
+ line-height: 1.8;
36
36
  color: ${token.colorText};
37
37
  text-align: justify;
38
38
  word-wrap: break-word;
@@ -1,5 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { InputProps } from 'antd';
3
- export declare type SearchBarProps = InputProps;
4
- declare const SearchBar: import("react").MemoExoticComponent<({ value, onChange, style, placeholder, ...props }: SearchBarProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export interface SearchBarProps extends InputProps {
4
+ shortKey?: string;
5
+ enableShortKey?: boolean;
6
+ type?: 'ghost' | 'block';
7
+ }
8
+ declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
5
9
  export default SearchBar;
@@ -22,21 +22,74 @@ __export(SearchBar_exports, {
22
22
  default: () => SearchBar_default
23
23
  });
24
24
  module.exports = __toCommonJS(SearchBar_exports);
25
- var import_icons = require("@ant-design/icons");
25
+ var import__ = require("../index");
26
26
  var import_antd = require("antd");
27
+ var import_lucide_react = require("lucide-react");
27
28
  var import_react = require("react");
28
- var SearchBar = (0, import_react.memo)(({ value, onChange, style, placeholder, ...props }) => /* @__PURE__ */ React.createElement(
29
- import_antd.Input,
30
- {
31
- prefix: /* @__PURE__ */ React.createElement(import_icons.SearchOutlined, null),
32
- allowClear: true,
29
+ var import_style = require("./style");
30
+ var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(
31
+ typeof navigator !== "undefined" ? navigator == null ? void 0 : navigator.platform : ""
32
+ );
33
+ var symbol = isAppleDevice ? "⌘" : "Ctrl";
34
+ var SearchBar = (0, import_react.memo)(
35
+ ({
36
+ className,
33
37
  value,
34
- placeholder: placeholder ?? "Search",
35
- style: { ...style, borderColor: "transparent" },
36
38
  onChange,
39
+ style,
40
+ placeholder,
41
+ type = "ghost",
42
+ enableShortKey,
43
+ shortKey = "f",
37
44
  ...props
45
+ }) => {
46
+ const [showTag, setShowTag] = (0, import_react.useState)(true);
47
+ const [inputValue, setInputValue] = (0, import_react.useState)(value);
48
+ const { styles, cx } = (0, import_style.useStyles)({ type });
49
+ const inputRef = (0, import_react.useRef)(null);
50
+ (0, import_react.useEffect)(() => {
51
+ if (!enableShortKey)
52
+ return;
53
+ const handler = (ev) => {
54
+ if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === shortKey) {
55
+ ev.preventDefault();
56
+ inputRef.current.focus();
57
+ }
58
+ };
59
+ document.addEventListener("keydown", handler);
60
+ return () => document.removeEventListener("keydown", handler);
61
+ }, []);
62
+ return /* @__PURE__ */ React.createElement("div", { className: cx(styles.search, className) }, /* @__PURE__ */ React.createElement(
63
+ import_antd.Input,
64
+ {
65
+ 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
+ ),
76
+ allowClear: true,
77
+ value,
78
+ placeholder: placeholder ?? "Type keywords...",
79
+ style: { ...style, borderColor: "transparent" },
80
+ onChange: (e) => {
81
+ setInputValue(e.target.value);
82
+ setShowTag(e.target.value ? false : true);
83
+ if (onChange)
84
+ onChange(e);
85
+ },
86
+ onFocus: () => setShowTag(false),
87
+ onBlur: () => setShowTag(true),
88
+ ...props
89
+ }
90
+ ), enableShortKey && showTag && !inputValue && /* @__PURE__ */ React.createElement(import_antd.Tag, { className: styles.tag }, symbol, " ", shortKey.toUpperCase()));
38
91
  }
39
- ));
92
+ );
40
93
  var SearchBar_default = SearchBar;
41
94
  // Annotate the CommonJS export names for ESM import in node:
42
95
  0 && (module.exports = {});
@@ -0,0 +1,8 @@
1
+ export declare const useStyles: (props?: {
2
+ type: 'ghost' | 'block';
3
+ } | undefined) => import("antd-style").ReturnStyles<{
4
+ search: import("antd-style").SerializedStyles;
5
+ input: import("antd-style").SerializedStyles;
6
+ tag: import("antd-style").SerializedStyles;
7
+ icon: import("antd-style").SerializedStyles;
8
+ }>;
@@ -0,0 +1,68 @@
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/SearchBar/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
+ search: css`
29
+ position: relative;
30
+ max-width: 100%;
31
+ height: 36px;
32
+ `,
33
+ input: css`
34
+ position: relative;
35
+ height: inherit;
36
+ 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
+ `,
54
+ tag: css`
55
+ position: absolute;
56
+ z-index: 5;
57
+ top: 50%;
58
+ right: 0;
59
+ transform: translateY(-50%);
60
+ `,
61
+ icon: css`
62
+ color: ${token.colorTextPlaceholder};
63
+ `
64
+ }));
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ useStyles
68
+ });
@@ -62,6 +62,7 @@ var useStyles = (0, import_antd_style.createStyles)(
62
62
  --leva-colors-vivid1: ${token.colorWarning};
63
63
  --leva-shadows-level1: unset;
64
64
  --leva-shadows-level2: unset;
65
+ --leva-fonts-mono: ${token.fontFamilyCode};
65
66
 
66
67
  padding: 6px 0;
67
68
  background: ${token.colorBgLayout};
@@ -26,8 +26,8 @@ var import_antd_style = require("antd-style");
26
26
  var GlobalStyle = import_antd_style.createGlobalStyle`
27
27
 
28
28
  html,body {
29
- --font-settings: "cv01";
30
- --font-variations: "opsz" auto;
29
+ --font-settings: "cv01", "tnum", "kern";
30
+ --font-variations: "opsz" auto, tabular-nums;
31
31
 
32
32
  overflow-x: hidden;
33
33
 
@@ -81,6 +81,13 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
81
81
  text-align: justify;
82
82
  word-wrap: break-word;
83
83
  }
84
+
85
+ code {
86
+ font-family: ${({ theme }) => theme.fontFamilyCode} !important;
87
+ * {
88
+ font-family: inherit !important;
89
+ }
90
+ }
84
91
  `;
85
92
  var GlobalStyle_default = GlobalStyle;
86
93
  // Annotate the CommonJS export names for ESM import in node:
@@ -60,7 +60,6 @@ var ThemeProvider = ({ token, children, themeMode }) => {
60
60
  customStylish: import_styles.getCustomStylish,
61
61
  customToken: getCustomToken
62
62
  },
63
- /* @__PURE__ */ import_react.default.createElement(import_react_font_loader.default, { url: "https://raw.githubusercontent.com/divspace/hack/master/css/hack.css" }),
64
63
  /* @__PURE__ */ import_react.default.createElement(import_react_font_loader.default, { url: "https://raw.githubusercontent.com/IKKI2000/harmonyos-fonts/main/css/harmonyos_sans.css" }),
65
64
  /* @__PURE__ */ import_react.default.createElement(import_react_font_loader.default, { url: "https://raw.githubusercontent.com/IKKI2000/harmonyos-fonts/main/css/harmonyos_sans_sc.css" }),
66
65
  /* @__PURE__ */ import_react.default.createElement(import_GlobalStyle.default, null),
@@ -25,9 +25,9 @@ module.exports = __toCommonJS(Tooltip_exports);
25
25
  var import_antd = require("antd");
26
26
  var import_react = require("react");
27
27
  var import_style = require("./style");
28
- var Tooltip = (0, import_react.memo)(({ className, ...props }) => {
28
+ var Tooltip = (0, import_react.memo)(({ className, arrow = false, ...props }) => {
29
29
  const { styles, cx } = (0, import_style.useStyles)();
30
- return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { overlayClassName: cx(styles.tooltip, className), ...props });
30
+ return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { overlayClassName: cx(styles.tooltip, className), arrow, ...props });
31
31
  });
32
32
  var Tooltip_default = Tooltip;
33
33
  // Annotate the CommonJS export names for ESM import in node:
@@ -22,10 +22,10 @@ __export(base_exports, {
22
22
  baseTheme: () => baseTheme
23
23
  });
24
24
  module.exports = __toCommonJS(base_exports);
25
- var FONT_EMOJI = `"Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"`;
26
- var FONT_EN = `"HarmonyOS Sans", "Segoe UI", "SF Pro Display",-apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif`;
27
- var FONT_CN = `"HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei UI", "Microsoft Yahei", "Source Han Sans CN", sans-serif`;
28
- var FONT_CODE = `ui-monospace, Hack, "SFMono Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace`;
25
+ var FONT_EMOJI = `"Segoe UI Emoji","Segoe UI Symbol","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"`;
26
+ var FONT_EN = `"HarmonyOS Sans","Segoe UI","SF Pro Display",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif`;
27
+ var FONT_CN = `"HarmonyOS Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei UI","Microsoft Yahei","Source Han Sans CN",sans-serif`;
28
+ var FONT_CODE = `ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace`;
29
29
  var baseTheme = {
30
30
  token: {
31
31
  colorInfo: "#0070f3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -67,75 +67,75 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@ant-design/icons": "^5",
71
- "@babel/runtime": "^7",
72
- "@dqbd/tiktoken": "^1",
73
- "@floating-ui/react": "^0.24",
74
- "ahooks": "^3",
75
- "antd-style": "^3",
76
- "chroma-js": "^2",
77
- "copy-to-clipboard": "^3",
78
- "dayjs": "^1",
79
- "fast-deep-equal": "^3",
80
- "immer": "^10",
81
- "leva": "^0.9",
82
- "lodash": "^4",
70
+ "@ant-design/icons": "^5.1.2",
71
+ "@babel/runtime": "^7.21.5",
72
+ "@dqbd/tiktoken": "^1.0.7",
73
+ "@floating-ui/react": "^0.24.1",
74
+ "ahooks": "^3.7.7",
75
+ "antd-style": "^3.1.1",
76
+ "chroma-js": "^2.4.2",
77
+ "copy-to-clipboard": "^3.3.3",
78
+ "dayjs": "^1.11.7",
79
+ "fast-deep-equal": "^3.1.3",
80
+ "immer": "^10.0.2",
81
+ "leva": "^0.9.34",
82
+ "lodash": "^4.17.21",
83
83
  "lucide-react": "latest",
84
- "pangu": "^4",
85
- "polished": "^4",
86
- "prism-react-renderer": "^2",
87
- "re-resizable": "^6",
84
+ "pangu": "^4.0.7",
85
+ "polished": "^4.2.2",
86
+ "prism-react-renderer": "^2.0.4",
87
+ "re-resizable": "^6.9.9",
88
88
  "react-font-loader": "^2.0.0",
89
- "react-layout-kit": "^1",
90
- "react-markdown": "^8",
91
- "react-rnd": "^10",
92
- "remark-gfm": "^3",
93
- "shiki-es": "^0.2",
94
- "styled-components": "^6.0.0-rc.1",
95
- "ts-md5": "^1",
96
- "use-merge-value": "^1",
97
- "zustand": "^4",
98
- "zustand-utils": "^1"
89
+ "react-layout-kit": "^1.7.0",
90
+ "react-markdown": "^8.0.7",
91
+ "react-rnd": "^10.4.1",
92
+ "remark-gfm": "^3.0.1",
93
+ "shiki-es": "^0.2.0",
94
+ "styled-components": "6.0.0-rc.2",
95
+ "ts-md5": "^1.3.1",
96
+ "use-merge-value": "^1.2.0",
97
+ "zustand": "^4.3.8",
98
+ "zustand-utils": "^1.2.2"
99
99
  },
100
100
  "devDependencies": {
101
- "@ant-design/colors": "^7",
102
- "@commitlint/cli": "^17",
103
- "@testing-library/react": "^14",
104
- "@types/chroma-js": "^2",
105
- "@types/lodash": "^4",
106
- "@types/pangu": "^4",
107
- "@types/react": "^18",
108
- "@types/react-dom": "^18",
109
- "@umijs/lint": "^4",
101
+ "@ant-design/colors": "^7.0.0",
102
+ "@commitlint/cli": "^17.6.3",
103
+ "@testing-library/react": "^14.0.0",
104
+ "@types/chroma-js": "^2.4.0",
105
+ "@types/lodash": "^4.14.195",
106
+ "@types/pangu": "^4.0.0",
107
+ "@types/react": "^18.2.7",
108
+ "@types/react-dom": "^18.2.4",
109
+ "@umijs/lint": "^4.0.69",
110
110
  "@vitest/coverage-c8": "latest",
111
- "antd": "^5",
112
- "commitlint": "^17",
113
- "commitlint-config-gitmoji": "^2",
114
- "concurrently": "^8",
115
- "cross-env": "^7",
116
- "dumi": "2",
117
- "dumi-assets-types": "^1",
118
- "dumi-theme-lobehub": "latest",
119
- "eslint": "^8",
120
- "eslint-import-resolver-alias": "^1",
121
- "eslint-import-resolver-typescript": "^3",
122
- "father": "^4",
123
- "husky": "^8",
124
- "jsdom": "^22",
125
- "lint-staged": "^13",
126
- "postcss-styled-syntax": "^0.4",
127
- "prettier": "^2",
128
- "prettier-plugin-organize-imports": "^3",
129
- "prettier-plugin-packagejson": "^2",
130
- "react": "^18",
131
- "react-dom": "^18",
132
- "semantic-release": "^21",
133
- "semantic-release-config-gitmoji": "^1",
134
- "stylelint": "^15",
135
- "stylelint-config-clean-order": "^5",
136
- "stylelint-config-recommended": "^12",
137
- "stylelint-order": "^6",
138
- "typescript": "^5",
111
+ "antd": "^5.5.1",
112
+ "commitlint": "^17.6.3",
113
+ "commitlint-config-gitmoji": "^2.3.1",
114
+ "concurrently": "^8.0.1",
115
+ "cross-env": "^7.0.3",
116
+ "dumi": "^2.2.0",
117
+ "dumi-assets-types": "^1.0.1",
118
+ "dumi-theme-lobehub": "workspace:latest",
119
+ "eslint": "^8.41.0",
120
+ "eslint-import-resolver-alias": "^1.1.2",
121
+ "eslint-import-resolver-typescript": "^3.5.5",
122
+ "father": "^4.1.9",
123
+ "husky": "^8.0.3",
124
+ "jsdom": "^22.0.0",
125
+ "lint-staged": "^13.2.2",
126
+ "postcss-styled-syntax": "^0.4.0",
127
+ "prettier": "^2.8.8",
128
+ "prettier-plugin-organize-imports": "^3.2.2",
129
+ "prettier-plugin-packagejson": "^2.4.3",
130
+ "react": "^18.2.0",
131
+ "react-dom": "^18.2.0",
132
+ "semantic-release": "^21.0.2",
133
+ "semantic-release-config-gitmoji": "^1.5.0",
134
+ "stylelint": "^15.6.2",
135
+ "stylelint-config-clean-order": "^5.0.1",
136
+ "stylelint-config-recommended": "^12.0.0",
137
+ "stylelint-order": "^6.0.3",
138
+ "typescript": "^5.0.4",
139
139
  "vitest": "latest"
140
140
  },
141
141
  "peerDependencies": {