@lobehub/ui 1.25.3 → 1.25.5

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.
@@ -7,8 +7,8 @@ var toggleShort = 16;
7
7
  export var useStyles = createStyles(function (_ref, prefix) {
8
8
  var token = _ref.token;
9
9
  var commonHandle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n z-index: 50;\n transition: all 0.2s ", ";\n }\n\n &:hover,\n &:active {\n &::before {\n background: ", " !important;\n }\n }\n "])), token.motionEaseOut, token.colorPrimary);
10
- var commonToggle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 1001;\n opacity: 0;\n transition: all 0.2s ", ";\n\n &:hover {\n opacity: 1 !important;\n }\n\n &:active {\n opacity: 1 !important;\n }\n\n > div {\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n background: ", ";\n border-color: ", ";\n border-style: solid;\n border-width: 1px;\n border-radius: 4px;\n\n transition: all 0.2s ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background: ", ";\n }\n }\n "])), token.motionEaseOut, token.colorTextTertiary, token.colorFillTertiary, token.colorBorderSecondary, token.motionEaseOut, token.colorTextSecondary, token.colorFillSecondary, token.colorText, token.colorFill);
11
- var float = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2000;\n "])));
10
+ var commonToggle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 101;\n opacity: 0;\n transition: all 0.2s ", ";\n\n &:hover {\n opacity: 1 !important;\n }\n\n &:active {\n opacity: 1 !important;\n }\n\n > div {\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n background: ", ";\n border-color: ", ";\n border-style: solid;\n border-width: 1px;\n border-radius: 4px;\n\n transition: all 0.2s ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background: ", ";\n }\n }\n "])), token.motionEaseOut, token.colorTextTertiary, token.colorFillTertiary, token.colorBorderSecondary, token.motionEaseOut, token.colorTextSecondary, token.colorFillSecondary, token.colorText, token.colorFill);
11
+ var float = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 200;\n "])));
12
12
  return {
13
13
  container: cx(prefix, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n border: 0 solid ", ";\n\n &:hover {\n .", "-toggle {\n opacity: 1;\n }\n }\n "])), token.colorBorderSecondary, prefix)),
14
14
  fixed: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n "]))),
@@ -1,13 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { PlusOutlined } from '@ant-design/icons';
3
2
  import { Button, Select } from 'antd';
4
3
  import isEqual from 'fast-deep-equal';
5
- import { TrashIcon } from 'lucide-react';
4
+ import { Plus, Trash } from 'lucide-react';
6
5
  import { memo, useEffect, useReducer } from 'react';
7
6
  import { Flexbox } from 'react-layout-kit';
8
- import IconAction from "../ActionIcon";
9
7
  import { messagesReducer } from "../Chat";
10
8
  import { ControlInput } from "../components/ControlInput";
9
+ import { ActionIcon, Icon } from "./..";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
@@ -45,13 +44,13 @@ export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
45
44
  },
46
45
  options: [{
47
46
  value: 'system',
48
- label: '系统'
47
+ label: 'System'
49
48
  }, {
50
49
  value: 'user',
51
- label: '输入'
50
+ label: 'Input'
52
51
  }, {
53
52
  value: 'assistant',
54
- label: '输出'
53
+ label: 'Output'
55
54
  }],
56
55
  style: {
57
56
  width: 120
@@ -68,8 +67,8 @@ export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
68
67
  },
69
68
  placeholder: item.role === 'user' ? '请填入输入的样例内容' : '请填入输出的样例',
70
69
  value: item.content
71
- }), /*#__PURE__*/_jsx(IconAction, {
72
- icon: TrashIcon,
70
+ }), /*#__PURE__*/_jsx(ActionIcon, {
71
+ icon: Trash,
73
72
  onClick: function onClick() {
74
73
  dispatch({
75
74
  type: 'deleteMessage',
@@ -77,13 +76,18 @@ export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
77
76
  });
78
77
  },
79
78
  placement: "right",
79
+ size: {
80
+ fontSize: 16
81
+ },
80
82
  title: "Delete"
81
83
  })]
82
84
  }, "".concat(index, "-").concat(item.content));
83
85
  }), /*#__PURE__*/_jsx(Button, {
84
86
  block: true,
85
87
  disabled: disabled,
86
- icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
88
+ icon: /*#__PURE__*/_jsx(Icon, {
89
+ icon: Plus
90
+ }),
87
91
  onClick: function onClick() {
88
92
  var lastMeg = chatMessages.at(-1);
89
93
  dispatch({
@@ -94,7 +98,7 @@ export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
94
98
  }
95
99
  });
96
100
  },
97
- children: "\u6DFB\u52A0\u4E00\u9879"
101
+ children: "Add Props"
98
102
  })]
99
103
  });
100
104
  }, isEqual);
@@ -4,7 +4,6 @@ var _excluded = ["style", "className", "row", "column", "description", "image",
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { Icon } from "./..";
7
- import { Link, history } from 'dumi';
8
7
  import * as LucideIcon from 'lucide-react';
9
8
  import { memo } from 'react';
10
9
  import { Center, Flexbox } from 'react-layout-kit';
@@ -49,18 +48,9 @@ var Item = /*#__PURE__*/memo(function (_ref2) {
49
48
  var FeatureIcon = icon && LucideIcon[icon];
50
49
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
51
50
  className: cx(styles.container, className),
52
- onClick: function onClick() {
53
- if (!link) return;
54
- if (openExternal) {
55
- window.open(link);
56
- } else {
57
- history.push(link);
58
- }
59
- },
60
51
  style: _objectSpread({
61
52
  gridRow: "span ".concat(rowNum),
62
- gridColumn: "span ".concat(column || 1),
63
- cursor: link ? 'pointer' : 'default'
53
+ gridColumn: "span ".concat(column || 1)
64
54
  }, style)
65
55
  }, props), {}, {
66
56
  children: /*#__PURE__*/_jsxs("div", {
@@ -90,8 +80,10 @@ var Item = /*#__PURE__*/memo(function (_ref2) {
90
80
  }
91
81
  }), link && /*#__PURE__*/_jsx("div", {
92
82
  className: styles.link,
93
- children: /*#__PURE__*/_jsx(Link, {
94
- to: link,
83
+ children: /*#__PURE__*/_jsx("a", {
84
+ href: link,
85
+ rel: "noreferrer",
86
+ target: openExternal ? '_blank' : undefined,
95
87
  children: "Read More"
96
88
  })
97
89
  })]
package/es/Hero/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { GradientButton, Icon } from "./..";
2
2
  import { Button, ConfigProvider, Space } from 'antd';
3
3
  import { useResponsive } from 'antd-style';
4
- import { Link } from 'dumi';
5
4
  import * as LucideIcon from 'lucide-react';
6
5
  import { memo, useCallback } from 'react';
7
6
  import { Center, Flexbox } from 'react-layout-kit';
@@ -29,26 +28,23 @@ var Hero = /*#__PURE__*/memo(function (_ref) {
29
28
  type = _ref2.type;
30
29
  // @ts-ignore
31
30
  var ButtonIcon = icon && LucideIcon[icon];
32
- return /*#__PURE__*/_jsx(Link, {
31
+ return /*#__PURE__*/_jsx("a", {
32
+ href: link,
33
33
  rel: "noreferrer",
34
34
  target: openExternal ? '_blank' : undefined,
35
- to: link,
36
35
  children: type === 'primary' ? /*#__PURE__*/_jsx(GradientButton, {
36
+ icon: ButtonIcon && /*#__PURE__*/_jsx(Icon, {
37
+ icon: ButtonIcon
38
+ }),
37
39
  size: "large",
38
40
  children: text
39
41
  }, index) : /*#__PURE__*/_jsx(Button, {
42
+ icon: ButtonIcon && /*#__PURE__*/_jsx(Icon, {
43
+ icon: ButtonIcon
44
+ }),
40
45
  size: "large",
41
46
  type: "primary",
42
- children: /*#__PURE__*/_jsxs(Space, {
43
- align: "center",
44
- children: [ButtonIcon && /*#__PURE__*/_jsx(Icon, {
45
- icon: ButtonIcon,
46
- size: {
47
- fontSize: 18,
48
- strokeWidth: 2
49
- }
50
- }), text]
51
- })
47
+ children: text
52
48
  }, index)
53
49
  }, text);
54
50
  })
@@ -1,10 +1,11 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { Loading3QuartersOutlined as Loading } from '@ant-design/icons';
3
2
  import { useThemeMode } from 'antd-style';
3
+ import { Loader2 } from 'lucide-react';
4
4
  import { memo, useEffect } from 'react';
5
5
  import { Center } from 'react-layout-kit';
6
6
  import { shallow } from 'zustand/shallow';
7
7
  import { useHighlight } from "../../hooks/useHighlight";
8
+ import { Icon } from "../..";
8
9
  import { useStyles } from "./style";
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -13,8 +14,7 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
13
14
  var children = _ref.children,
14
15
  language = _ref.language;
15
16
  var _useStyles = useStyles(),
16
- styles = _useStyles.styles,
17
- theme = _useStyles.theme;
17
+ styles = _useStyles.styles;
18
18
  var _useThemeMode = useThemeMode(),
19
19
  isDarkMode = _useThemeMode.isDarkMode;
20
20
  var _useHighlight = useHighlight(function (s) {
@@ -43,11 +43,9 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
43
43
  className: styles.loading,
44
44
  gap: 8,
45
45
  horizontal: true,
46
- children: [/*#__PURE__*/_jsx(Loading, {
47
- spin: true,
48
- style: {
49
- color: theme.colorTextTertiary
50
- }
46
+ children: [/*#__PURE__*/_jsx(Icon, {
47
+ icon: Loader2,
48
+ spin: true
51
49
  }), "Highlighting..."]
52
50
  })]
53
51
  });
package/es/Icon/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["icon", "size", "style", "className", "spin"];
3
+ var _excluded = ["icon", "size", "className", "spin"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { memo, useMemo } from 'react';
@@ -40,7 +40,6 @@ var calcSize = function calcSize(size) {
40
40
  var Icon = /*#__PURE__*/memo(function (_ref) {
41
41
  var icon = _ref.icon,
42
42
  size = _ref.size,
43
- style = _ref.style,
44
43
  className = _ref.className,
45
44
  spin = _ref.spin,
46
45
  props = _objectWithoutProperties(_ref, _excluded);
@@ -53,16 +52,16 @@ var Icon = /*#__PURE__*/memo(function (_ref) {
53
52
  }, [size]),
54
53
  fontSize = _useMemo.fontSize,
55
54
  strokeWidth = _useMemo.strokeWidth;
56
- return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
57
- className: cx(styles.icon, spin && styles.spin, className),
58
- style: _objectSpread({
59
- width: fontSize,
60
- height: fontSize
61
- }, style)
55
+ return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
56
+ className: cx('anticon', spin && styles.spin, className),
57
+ role: "img"
62
58
  }, props), {}, {
63
59
  children: /*#__PURE__*/_jsx(SvgIcon, {
60
+ focusable: false,
61
+ height: fontSize,
64
62
  size: fontSize,
65
- strokeWidth: strokeWidth
63
+ strokeWidth: strokeWidth,
64
+ width: fontSize
66
65
  })
67
66
  }));
68
67
  });
@@ -1,4 +1,3 @@
1
1
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
- icon: import("antd-style").SerializedStyles;
3
2
  spin: import("antd-style").SerializedStyles;
4
3
  }>;
package/es/Icon/style.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3;
2
+ var _templateObject, _templateObject2;
3
3
  import { createStyles, keyframes } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref) {
5
5
  var css = _ref.css;
6
6
  var spin = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n "])));
7
7
  return {
8
- icon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n "]))),
9
- spin: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " 1s linear infinite;\n "])), spin)
8
+ spin: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: ", " 1s linear infinite;\n "])), spin)
10
9
  };
11
10
  });
@@ -1,14 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { AimOutlined } from '@ant-design/icons';
3
2
  import { Modal } from 'antd';
3
+ import { X } from 'lucide-react';
4
4
  import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
  import useControlledState from 'use-merge-value';
7
- import Markdown from "../Markdown";
8
- import MessageInput from "../MessageInput";
7
+ import { Icon, Markdown, MessageInput } from "./..";
9
8
  import { useStyles } from "./style";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
- import { jsxs as _jsxs } from "react/jsx-runtime";
12
10
  var MessageModal = /*#__PURE__*/memo(function (_ref) {
13
11
  var editing = _ref.editing,
14
12
  open = _ref.open,
@@ -33,10 +31,13 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
33
31
  expand = _useControlledState4[0],
34
32
  setExpand = _useControlledState4[1];
35
33
  return /*#__PURE__*/_jsx(Modal, {
36
- cancelText: '关闭',
34
+ cancelText: 'Cancel',
37
35
  className: styles.modal,
36
+ closeIcon: /*#__PURE__*/_jsx(Icon, {
37
+ icon: X
38
+ }),
38
39
  footer: isEdit ? null : undefined,
39
- okText: '编辑',
40
+ okText: 'Edit',
40
41
  onCancel: function onCancel() {
41
42
  return setExpand(false);
42
43
  },
@@ -44,11 +45,11 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
44
45
  setTyping(true);
45
46
  },
46
47
  open: expand,
47
- title: /*#__PURE__*/_jsxs(Flexbox, {
48
+ title: /*#__PURE__*/_jsx(Flexbox, {
48
49
  align: 'center',
49
50
  gap: 4,
50
51
  horizontal: true,
51
- children: [/*#__PURE__*/_jsx(AimOutlined, {}), "\u63D0\u793A\u8BCD"]
52
+ children: "Prompt"
52
53
  }),
53
54
  width: 800,
54
55
  children: isEdit ? /*#__PURE__*/_jsx(MessageInput, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.25.3",
3
+ "version": "1.25.5",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -82,7 +82,6 @@
82
82
  "chroma-js": "^2",
83
83
  "copy-to-clipboard": "^3",
84
84
  "dayjs": "^1",
85
- "dumi": "^2",
86
85
  "fast-deep-equal": "^3",
87
86
  "immer": "^10",
88
87
  "leva": "^0",
@@ -99,7 +98,7 @@
99
98
  "react-rnd": "^10",
100
99
  "remark-gfm": "^3",
101
100
  "shiki-es": "^0",
102
- "styled-components": "beta",
101
+ "styled-components": "latest",
103
102
  "ts-md5": "^1",
104
103
  "use-merge-value": "^1",
105
104
  "zustand": "^4",
@@ -118,6 +117,7 @@
118
117
  "commitlint": "^17",
119
118
  "concurrently": "^8",
120
119
  "cross-env": "^7",
120
+ "dumi": "^2",
121
121
  "dumi-assets-types": "^1",
122
122
  "dumi-theme-lobehub": "workspace:latest",
123
123
  "eslint": "^8",
@@ -138,7 +138,6 @@
138
138
  "peerDependencies": {
139
139
  "antd": ">=5",
140
140
  "antd-style": ">=3",
141
- "dumi": ">=2",
142
141
  "react": ">=18",
143
142
  "react-dom": ">=18"
144
143
  },