@lobehub/ui 1.116.2 → 1.116.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
- import { type IconProps, type IconSizeConfig, type IconSizeType } from "../Icon";
3
- import type { TooltipProps } from "../Tooltip";
4
- interface ActionIconSizeConfig extends IconSizeConfig {
2
+ import { type IconProps } from "../Icon";
3
+ import { type TooltipProps } from "../Tooltip";
4
+ import { DivProps } from "../types";
5
+ export type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
5
6
  blockSize?: number;
6
7
  borderRadius?: number;
7
- }
8
- type ActionIconSizeType = 'site' | IconSizeType;
9
- export type ActionIconSize = ActionIconSizeType | ActionIconSizeConfig;
10
- export interface ActionIconProps extends Omit<IconProps, 'size' | 'icon'> {
8
+ fontSize?: number;
9
+ strokeWidth?: number;
10
+ };
11
+ export interface ActionIconProps extends DivProps {
11
12
  /**
12
13
  * @description Whether the icon is active or not
13
14
  * @default false
@@ -18,11 +19,17 @@ export interface ActionIconProps extends Omit<IconProps, 'size' | 'icon'> {
18
19
  * @default false
19
20
  */
20
21
  arrow?: boolean;
22
+ color?: IconProps['color'];
23
+ fill?: IconProps['fill'];
21
24
  /**
22
25
  * @description Glass blur style
23
26
  * @default 'false'
24
27
  */
25
28
  glass?: boolean;
29
+ /**
30
+ * @description The icon element to be rendered
31
+ * @type LucideIcon
32
+ */
26
33
  icon?: IconProps['icon'];
27
34
  /**
28
35
  * @description Set the loading status of ActionIcon
@@ -1,21 +1,57 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay", "fillOpacity", "fillRule", "focusable"];
3
+ var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  import { Loader2 } from 'lucide-react';
7
- import { Suspense, forwardRef, lazy, useMemo } from 'react';
7
+ import { forwardRef, useMemo } from 'react';
8
8
  import Icon from "../Icon";
9
- import { calcSize } from "./calcSize";
9
+ import Spotlight from "../Spotlight";
10
+ import Tooltip from "../Tooltip";
10
11
  import { useStyles } from "./style";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
- var Tooltip = /*#__PURE__*/lazy(function () {
14
- return import("../Tooltip");
15
- });
16
- var Spotlight = /*#__PURE__*/lazy(function () {
17
- return import("../Spotlight");
18
- });
15
+ var calcSize = function calcSize(size) {
16
+ var blockSize;
17
+ var borderRadius;
18
+ switch (size) {
19
+ case 'large':
20
+ {
21
+ blockSize = 44;
22
+ borderRadius = 8;
23
+ break;
24
+ }
25
+ case 'normal':
26
+ {
27
+ blockSize = 36;
28
+ borderRadius = 5;
29
+ break;
30
+ }
31
+ case 'small':
32
+ {
33
+ blockSize = 24;
34
+ borderRadius = 5;
35
+ break;
36
+ }
37
+ case 'site':
38
+ {
39
+ blockSize = 34;
40
+ borderRadius = 5;
41
+ break;
42
+ }
43
+ default:
44
+ {
45
+ blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
46
+ borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
47
+ break;
48
+ }
49
+ }
50
+ return {
51
+ blockSize: blockSize,
52
+ borderRadius: borderRadius
53
+ };
54
+ };
19
55
  var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
56
  var color = _ref.color,
21
57
  fill = _ref.fill,
@@ -36,9 +72,6 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
72
  loading = _ref.loading,
37
73
  _ref$tooltipDelay = _ref.tooltipDelay,
38
74
  tooltipDelay = _ref$tooltipDelay === void 0 ? 0.5 : _ref$tooltipDelay,
39
- fillOpacity = _ref.fillOpacity,
40
- fillRule = _ref.fillRule,
41
- focusable = _ref.focusable,
42
75
  rest = _objectWithoutProperties(_ref, _excluded);
43
76
  var _useStyles = useStyles({
44
77
  active: Boolean(active),
@@ -51,23 +84,21 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
51
84
  }, [size]),
52
85
  blockSize = _useMemo.blockSize,
53
86
  borderRadius = _useMemo.borderRadius;
54
- var iconProps = {
87
+ var content = /*#__PURE__*/_jsxs(_Fragment, {
88
+ children: [icon && /*#__PURE__*/_jsx(Icon, {
89
+ className: styles.icon,
90
+ color: color,
91
+ fill: fill,
92
+ icon: icon,
93
+ size: size === 'site' ? 'normal' : size
94
+ }), children]
95
+ });
96
+ var spin = /*#__PURE__*/_jsx(Icon, {
55
97
  color: color,
56
- fill: fill,
57
- fillOpacity: fillOpacity,
58
- fillRule: fillRule,
59
- focusable: focusable,
60
- size: size === 'site' ? 'normal' : size
61
- };
62
- var content = icon && /*#__PURE__*/_jsx(Icon, _objectSpread({
63
- className: styles.icon,
64
- icon: icon
65
- }, iconProps));
66
- var spin = /*#__PURE__*/_jsx(Icon, _objectSpread(_objectSpread({
67
- icon: Loader2
68
- }, iconProps), {}, {
98
+ icon: Loader2,
99
+ size: size === 'site' ? 'normal' : size,
69
100
  spin: true
70
- }));
101
+ });
71
102
  var actionIconBlock = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
72
103
  className: cx(styles.block, className),
73
104
  onClick: loading ? undefined : onClick,
@@ -78,24 +109,18 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
78
109
  width: blockSize
79
110
  }, style)
80
111
  }, rest), {}, {
81
- children: [/*#__PURE__*/_jsx(Suspense, {
82
- fallback: null,
83
- children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
84
- }), loading ? spin : content, children]
112
+ children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), loading ? spin : content]
85
113
  }));
86
114
  if (!title) return actionIconBlock;
87
- return /*#__PURE__*/_jsx(Suspense, {
88
- fallback: actionIconBlock,
89
- children: /*#__PURE__*/_jsx(Tooltip, {
90
- arrow: arrow,
91
- mouseEnterDelay: tooltipDelay,
92
- overlayStyle: {
93
- pointerEvents: 'none'
94
- },
95
- placement: placement,
96
- title: title,
97
- children: actionIconBlock
98
- })
115
+ return /*#__PURE__*/_jsx(Tooltip, {
116
+ arrow: arrow,
117
+ mouseEnterDelay: tooltipDelay,
118
+ overlayStyle: {
119
+ pointerEvents: 'none'
120
+ },
121
+ placement: placement,
122
+ title: title,
123
+ children: actionIconBlock
99
124
  });
100
125
  });
101
126
  export default ActionIcon;
@@ -4,19 +4,17 @@ var _excluded = ["avatarAddon", "onAvatarClick", "actions", "className", "primar
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  import { useResponsive } from 'antd-style';
7
- import { Suspense, lazy, memo } from 'react';
7
+ import { memo } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
  import Actions from "./components/Actions";
10
10
  import Avatar from "./components/Avatar";
11
11
  import BorderSpacing from "./components/BorderSpacing";
12
+ import ErrorContent from "./components/ErrorContent";
12
13
  import MessageContent from "./components/MessageContent";
13
14
  import Title from "./components/Title";
14
15
  import { useStyles } from "./style";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
- var ErrorContent = /*#__PURE__*/lazy(function () {
18
- return import("./components/ErrorContent");
19
- });
20
18
  var MOBILE_AVATAR_SIZE = 32;
21
19
  var ChatItem = /*#__PURE__*/memo(function (_ref) {
22
20
  var avatarAddon = _ref.avatarAddon,
@@ -80,13 +78,10 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
80
78
  className: styles.messageContent,
81
79
  direction: type === 'block' ? placement === 'left' ? 'horizontal' : 'horizontal-reverse' : 'vertical',
82
80
  gap: 8,
83
- children: [error ? /*#__PURE__*/_jsx(Suspense, {
84
- fallback: null,
85
- children: /*#__PURE__*/_jsx(ErrorContent, {
86
- error: error,
87
- message: errorMessage,
88
- placement: placement
89
- })
81
+ children: [error ? /*#__PURE__*/_jsx(ErrorContent, {
82
+ error: error,
83
+ message: errorMessage,
84
+ placement: placement
90
85
  }) : /*#__PURE__*/_jsx(MessageContent, {
91
86
  editing: editing,
92
87
  message: message,
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
- import type { MessageInputProps } from "../MessageInput";
3
- import type { MessageModalProps } from "../MessageModal";
2
+ import { type MessageInputProps } from "../MessageInput";
3
+ import { type MessageModalProps } from "../MessageModal";
4
4
  export interface EditableMessageProps {
5
5
  /**
6
6
  * @title The class name for the Markdown and MessageInput component
@@ -3,18 +3,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { createStyles } from 'antd-style';
6
- import { Suspense, lazy, memo } from 'react';
6
+ import { memo } from 'react';
7
7
  import useControlledState from 'use-merge-value';
8
8
  import Markdown from "../Markdown";
9
+ import MessageInput from "../MessageInput";
10
+ import MessageModal from "../MessageModal";
9
11
  import { jsx as _jsx } from "react/jsx-runtime";
10
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- var MessageInput = /*#__PURE__*/lazy(function () {
13
- return import("../MessageInput");
14
- });
15
- var MessageModal = /*#__PURE__*/lazy(function () {
16
- return import("../MessageModal");
17
- });
18
14
  var useStyles = createStyles(function (_ref) {
19
15
  var stylish = _ref.stylish;
20
16
  return {
@@ -59,29 +55,26 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
59
55
  expand = _useControlledState4[0],
60
56
  setExpand = _useControlledState4[1];
61
57
  var isAutoSize = height === 'auto';
62
- var input = /*#__PURE__*/_jsx(Suspense, {
63
- fallback: null,
64
- children: /*#__PURE__*/_jsx(MessageInput, {
65
- className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
66
- classNames: {
67
- textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
68
- },
69
- defaultValue: value,
70
- editButtonSize: editButtonSize,
71
- height: height,
72
- onCancel: function onCancel() {
73
- return setTyping(false);
74
- },
75
- onConfirm: function onConfirm(text) {
76
- _onChange === null || _onChange === void 0 || _onChange(text);
77
- setTyping(false);
78
- },
79
- placeholder: placeholder,
80
- style: stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.input,
81
- text: text,
82
- textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
83
- type: inputType
84
- })
58
+ var input = /*#__PURE__*/_jsx(MessageInput, {
59
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
60
+ classNames: {
61
+ textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
62
+ },
63
+ defaultValue: value,
64
+ editButtonSize: editButtonSize,
65
+ height: height,
66
+ onCancel: function onCancel() {
67
+ return setTyping(false);
68
+ },
69
+ onConfirm: function onConfirm(text) {
70
+ _onChange === null || _onChange === void 0 || _onChange(text);
71
+ setTyping(false);
72
+ },
73
+ placeholder: placeholder,
74
+ style: stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.input,
75
+ text: text,
76
+ textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
77
+ type: inputType
85
78
  });
86
79
  if (!value && showEditWhenEmpty) return input;
87
80
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -94,26 +87,23 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
94
87
  overflowY: 'auto'
95
88
  }, stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.markdown),
96
89
  children: value || placeholder
97
- }), /*#__PURE__*/_jsx(Suspense, {
98
- fallback: null,
99
- children: /*#__PURE__*/_jsx(MessageModal, {
100
- editing: isEdit,
101
- extra: model === null || model === void 0 ? void 0 : model.extra,
102
- footer: model === null || model === void 0 ? void 0 : model.footer,
103
- height: height,
104
- onChange: function onChange(text) {
105
- return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
106
- },
107
- onEditingChange: setTyping,
108
- onOpenChange: function onOpenChange(e) {
109
- setExpand(e);
110
- setTyping(false);
111
- },
112
- open: expand,
113
- placeholder: placeholder,
114
- text: text,
115
- value: value
116
- })
90
+ }), /*#__PURE__*/_jsx(MessageModal, {
91
+ editing: isEdit,
92
+ extra: model === null || model === void 0 ? void 0 : model.extra,
93
+ footer: model === null || model === void 0 ? void 0 : model.footer,
94
+ height: height,
95
+ onChange: function onChange(text) {
96
+ return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
97
+ },
98
+ onEditingChange: setTyping,
99
+ onOpenChange: function onOpenChange(e) {
100
+ setExpand(e);
101
+ setTyping(false);
102
+ },
103
+ open: expand,
104
+ placeholder: placeholder,
105
+ text: text,
106
+ value: value
117
107
  })]
118
108
  });
119
109
  });
@@ -1,53 +1,32 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import data from '@emoji-mart/data';
5
- import DEFAULT_I18N from '@emoji-mart/data/i18n/en.json';
5
+ import Picker from '@emoji-mart/react';
6
6
  import { Avatar } from "./..";
7
7
  import { Popover } from 'antd';
8
- import { Suspense, lazy, memo } from 'react';
8
+ import { memo } from 'react';
9
9
  import useSWR from 'swr';
10
10
  import useMergeState from 'use-merge-value';
11
11
  import { useStyles } from "./style";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- var Picker = /*#__PURE__*/lazy(function () {
14
- return import('@emoji-mart/react');
15
- });
16
- var DEFAULT_EMOJI = '🤖';
17
- var DEFAULT_LOCALE = 'en-US';
18
- var DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)';
19
- var formatLocale = function formatLocale(locale) {
20
- return locale.split('-')[0];
21
- };
22
13
  var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
23
14
  var value = _ref.value,
24
15
  _ref$defaultAvatar = _ref.defaultAvatar,
25
- defaultAvatar = _ref$defaultAvatar === void 0 ? DEFAULT_EMOJI : _ref$defaultAvatar,
16
+ defaultAvatar = _ref$defaultAvatar === void 0 ? '🤖' : _ref$defaultAvatar,
26
17
  _ref$backgroundColor = _ref.backgroundColor,
27
- backgroundColor = _ref$backgroundColor === void 0 ? DEFAULT_BACKGROUND_COLOR : _ref$backgroundColor,
18
+ backgroundColor = _ref$backgroundColor === void 0 ? 'rgba(0,0,0,0)' : _ref$backgroundColor,
28
19
  onChange = _ref.onChange,
29
20
  _ref$locale = _ref.locale,
30
- locale = _ref$locale === void 0 ? DEFAULT_LOCALE : _ref$locale;
31
- var _useMergeState = useMergeState(locale, {
32
- defaultValue: locale
33
- }),
34
- _useMergeState2 = _slicedToArray(_useMergeState, 2),
35
- emojiLocale = _useMergeState2[0],
36
- setEmojiLocale = _useMergeState2[1];
37
- var _useMergeState3 = useMergeState('🤖', {
38
- defaultValue: defaultAvatar,
39
- onChange: onChange,
40
- value: value
41
- }),
42
- _useMergeState4 = _slicedToArray(_useMergeState3, 2),
43
- ava = _useMergeState4[0],
44
- setAva = _useMergeState4[1];
45
- var _useSWR = useSWR(emojiLocale === DEFAULT_LOCALE ? null : emojiLocale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
21
+ locale = _ref$locale === void 0 ? 'en-US' : _ref$locale;
22
+ var _useStyles = useStyles(),
23
+ styles = _useStyles.styles;
24
+ var _useSWR = useSWR(locale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
46
25
  return _regeneratorRuntime.wrap(function _callee$(_context) {
47
26
  while (1) switch (_context.prev = _context.next) {
48
27
  case 0:
49
28
  _context.next = 2;
50
- return import("@emoji-mart/data/i18n/".concat(formatLocale(emojiLocale), ".json"));
29
+ return import("@emoji-mart/data/i18n/".concat(locale.split('-')[0], ".json"));
51
30
  case 2:
52
31
  return _context.abrupt("return", _context.sent);
53
32
  case 3:
@@ -55,32 +34,28 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
55
34
  return _context.stop();
56
35
  }
57
36
  }, _callee);
58
- })), {
59
- onError: function onError() {
60
- return setEmojiLocale(DEFAULT_LOCALE);
61
- },
62
- onErrorRetry: function onErrorRetry() {
63
- return setEmojiLocale(DEFAULT_LOCALE);
64
- }
65
- }),
37
+ }))),
66
38
  i18n = _useSWR.data;
67
- var _useStyles = useStyles(),
68
- styles = _useStyles.styles;
39
+ var _useMergeState = useMergeState('🤖', {
40
+ defaultValue: defaultAvatar,
41
+ onChange: onChange,
42
+ value: value
43
+ }),
44
+ _useMergeState2 = _slicedToArray(_useMergeState, 2),
45
+ ava = _useMergeState2[0],
46
+ setAva = _useMergeState2[1];
69
47
  return /*#__PURE__*/_jsx(Popover, {
70
48
  content: /*#__PURE__*/_jsx("div", {
71
49
  className: styles.picker,
72
- children: /*#__PURE__*/_jsx(Suspense, {
73
- fallback: null,
74
- children: /*#__PURE__*/_jsx(Picker, {
75
- data: data,
76
- i18n: i18n || DEFAULT_I18N,
77
- locale: formatLocale(emojiLocale) || DEFAULT_LOCALE,
78
- onEmojiSelect: function onEmojiSelect(e) {
79
- return setAva(e.native);
80
- },
81
- skinTonePosition: 'none',
82
- theme: 'auto'
83
- })
50
+ children: /*#__PURE__*/_jsx(Picker, {
51
+ data: data,
52
+ i18n: i18n,
53
+ locale: locale.split('-')[0],
54
+ onEmojiSelect: function onEmojiSelect(e) {
55
+ return setAva(e.native);
56
+ },
57
+ skinTonePosition: 'none',
58
+ theme: 'auto'
84
59
  })
85
60
  }),
86
61
  placement: 'left',
@@ -1,5 +1,5 @@
1
1
  import { type GiscusProps as GiscusComponentProps } from '@giscus/react';
2
- import { type CSSProperties } from 'react';
2
+ import { CSSProperties } from 'react';
3
3
  export interface GiscusProps extends GiscusComponentProps {
4
4
  className?: string;
5
5
  style?: CSSProperties;
@@ -3,17 +3,15 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { Suspense, lazy, memo } from 'react';
6
+ import { memo } from 'react';
7
7
  import CopyButton from "../CopyButton";
8
+ import Spotlight from "../Spotlight";
8
9
  import Tag from "../Tag";
9
10
  import FullFeatured from "./FullFeatured";
10
11
  import SyntaxHighlighter from "./SyntaxHighlighter";
11
12
  import { useStyles } from "./style";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var Spotlight = /*#__PURE__*/lazy(function () {
15
- return import("../Spotlight");
16
- });
17
15
  export var Highlighter = /*#__PURE__*/memo(function (_ref) {
18
16
  var fullFeatured = _ref.fullFeatured,
19
17
  _ref$copyButtonSize = _ref.copyButtonSize,
@@ -46,11 +44,8 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
46
44
  "data-code-type": "highlighter",
47
45
  style: style
48
46
  }, rest), {}, {
49
- children: [/*#__PURE__*/_jsx(Suspense, {
50
- fallback: null,
51
- children: spotlight && /*#__PURE__*/_jsx(Spotlight, {
52
- size: 240
53
- })
47
+ children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {
48
+ size: 240
54
49
  }), copyable && /*#__PURE__*/_jsx(CopyButton, {
55
50
  className: styles.button,
56
51
  content: children,
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { LucideIcon, LucideProps } from 'lucide-react';
2
+ import { LucideIcon } from 'lucide-react';
3
3
  import { DivProps } from "../types";
4
- export interface IconSizeConfig extends Pick<LucideProps, 'strokeWidth' | 'absoluteStrokeWidth'> {
4
+ export type IconSize = 'large' | 'normal' | 'small' | {
5
5
  fontSize?: number;
6
- }
7
- export type IconSizeType = 'large' | 'normal' | 'small';
8
- export type IconSize = IconSizeType | IconSizeConfig;
9
- export interface IconProps extends DivProps, Pick<LucideProps, 'fill' | 'fillRule' | 'fillOpacity' | 'color' | 'focusable'> {
6
+ strokeWidth?: number;
7
+ };
8
+ export interface IconProps extends DivProps {
9
+ color?: string;
10
+ fill?: string;
10
11
  /**
11
12
  * @description The icon element to be rendered
12
13
  * @type LucideIcon
@@ -23,5 +24,5 @@ export interface IconProps extends DivProps, Pick<LucideProps, 'fill' | 'fillRul
23
24
  */
24
25
  spin?: boolean;
25
26
  }
26
- declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
27
+ declare const Icon: import("react").NamedExoticComponent<IconProps>;
27
28
  export default Icon;
package/es/Icon/index.js CHANGED
@@ -1,24 +1,57 @@
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", "color", "fill", "className", "focusable", "spin", "fillRule", "fillOpacity"],
4
- _excluded2 = ["fontSize"];
3
+ var _excluded = ["icon", "size", "color", "fill", "className", "spin"];
5
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import { forwardRef, useMemo } from 'react';
8
- import { calcSize } from "./calcSize";
6
+ import { memo, useMemo } from 'react';
9
7
  import { useStyles } from "./style";
10
8
  import { jsx as _jsx } from "react/jsx-runtime";
11
- var Icon = /*#__PURE__*/forwardRef(function (_ref, ref) {
9
+ var calcSize = function calcSize(size) {
10
+ var fontSize;
11
+ var strokeWidth;
12
+ switch (size) {
13
+ case 'large':
14
+ {
15
+ fontSize = 24;
16
+ strokeWidth = 2;
17
+ break;
18
+ }
19
+ case 'normal':
20
+ {
21
+ fontSize = 20;
22
+ strokeWidth = 2;
23
+ break;
24
+ }
25
+ case 'small':
26
+ {
27
+ fontSize = 14;
28
+ strokeWidth = 1.5;
29
+ break;
30
+ }
31
+ default:
32
+ {
33
+ if (size) {
34
+ fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
35
+ strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
36
+ } else {
37
+ fontSize = '1em';
38
+ strokeWidth = 2;
39
+ }
40
+ break;
41
+ }
42
+ }
43
+ return {
44
+ fontSize: fontSize,
45
+ strokeWidth: strokeWidth
46
+ };
47
+ };
48
+ var Icon = /*#__PURE__*/memo(function (_ref) {
12
49
  var icon = _ref.icon,
13
50
  size = _ref.size,
14
51
  color = _ref.color,
15
- _ref$fill = _ref.fill,
16
- fill = _ref$fill === void 0 ? 'transparent' : _ref$fill,
52
+ fill = _ref.fill,
17
53
  className = _ref.className,
18
- focusable = _ref.focusable,
19
54
  spin = _ref.spin,
20
- fillRule = _ref.fillRule,
21
- fillOpacity = _ref.fillOpacity,
22
55
  rest = _objectWithoutProperties(_ref, _excluded);
23
56
  var _useStyles = useStyles(),
24
57
  styles = _useStyles.styles,
@@ -28,22 +61,20 @@ var Icon = /*#__PURE__*/forwardRef(function (_ref, ref) {
28
61
  return calcSize(size);
29
62
  }, [size]),
30
63
  fontSize = _useMemo.fontSize,
31
- restSize = _objectWithoutProperties(_useMemo, _excluded2);
64
+ strokeWidth = _useMemo.strokeWidth;
32
65
  return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
33
66
  className: cx('anticon', spin && styles.spin, className),
34
67
  role: "img"
35
68
  }, rest), {}, {
36
- children: /*#__PURE__*/_jsx(SvgIcon, _objectSpread({
69
+ children: /*#__PURE__*/_jsx(SvgIcon, {
37
70
  color: color,
38
- fill: fill,
39
- fillOpacity: fillOpacity,
40
- fillRule: fillRule,
41
- focusable: focusable,
71
+ fill: fill !== null && fill !== void 0 ? fill : 'transparent',
72
+ focusable: false,
42
73
  height: fontSize,
43
- ref: ref,
44
74
  size: fontSize,
75
+ strokeWidth: strokeWidth,
45
76
  width: fontSize
46
- }, restSize))
77
+ })
47
78
  }));
48
79
  });
49
80
  export default Icon;
@@ -5,17 +5,15 @@ var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChan
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import { Search } from 'lucide-react';
8
- import { Suspense, lazy, memo, useEffect, useRef, useState } from 'react';
8
+ import { memo, useEffect, useRef, useState } from 'react';
9
9
  import useControlledState from 'use-merge-value';
10
10
  import Icon from "../Icon";
11
11
  import { Input } from "../Input";
12
+ import Spotlight from "../Spotlight";
12
13
  import Tag from "../Tag";
13
14
  import { useStyles } from "./style";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
- var Spotlight = /*#__PURE__*/lazy(function () {
17
- return import("../Spotlight");
18
- });
19
17
  var SearchBar = /*#__PURE__*/memo(function (_ref) {
20
18
  var defaultValue = _ref.defaultValue,
21
19
  spotlight = _ref.spotlight,
@@ -68,10 +66,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
68
66
  }, []);
69
67
  return /*#__PURE__*/_jsxs("div", {
70
68
  className: cx(styles.search, className),
71
- children: [/*#__PURE__*/_jsx(Suspense, {
72
- fallback: null,
73
- children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
74
- }), /*#__PURE__*/_jsx(Input, _objectSpread({
69
+ children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(Input, _objectSpread({
75
70
  allowClear: true,
76
71
  className: styles.input,
77
72
  onBlur: function onBlur() {
@@ -3,15 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight", "className"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { Suspense, lazy, memo } from 'react';
6
+ import { memo } from 'react';
7
7
  import CopyButton from "../CopyButton";
8
8
  import SyntaxHighlighter from "../Highlighter/SyntaxHighlighter";
9
+ import Spotlight from "../Spotlight";
9
10
  import { useStyles } from "./style";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- var Spotlight = /*#__PURE__*/lazy(function () {
13
- return import("../Spotlight");
14
- });
15
13
  var Snippet = /*#__PURE__*/memo(function (_ref) {
16
14
  var symbol = _ref.symbol,
17
15
  _ref$language = _ref.language,
@@ -30,10 +28,7 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
30
28
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
31
29
  className: cx(styles.container, className)
32
30
  }, rest), {}, {
33
- children: [/*#__PURE__*/_jsx(Suspense, {
34
- fallback: null,
35
- children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
36
- }), /*#__PURE__*/_jsx(SyntaxHighlighter, {
31
+ children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
37
32
  language: language,
38
33
  children: [symbol, children].filter(Boolean).join(' ')
39
34
  }), copyable && /*#__PURE__*/_jsx(CopyButton, {
@@ -1,4 +1,3 @@
1
- import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
2
1
  import { ErrorType } from './error';
3
2
  import { LLMRoleType } from './llm';
4
3
  import { BaseDataModel } from './meta';
@@ -29,7 +28,7 @@ export interface ChatMessage extends BaseDataModel {
29
28
  function_call?: OpenAIFunctionCall;
30
29
  name?: string;
31
30
  parentId?: string;
32
- plugin?: PluginRequestPayload;
31
+ plugin?: any;
33
32
  quotaId?: string;
34
33
  /**
35
34
  * 角色
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.116.2",
3
+ "version": "1.116.3",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -77,7 +77,6 @@
77
77
  "@emoji-mart/react": "^1",
78
78
  "@floating-ui/react": "^0",
79
79
  "@giscus/react": "^2",
80
- "@lobehub/chat-plugin-sdk": "latest",
81
80
  "@lobehub/emojilib": "latest",
82
81
  "@react-spring/web": "^9",
83
82
  "@splinetool/react-spline": "^2.2.6",
@@ -1,5 +0,0 @@
1
- import { ActionIconSize } from "./index";
2
- export declare const calcSize: (size?: ActionIconSize) => {
3
- blockSize: number;
4
- borderRadius: number;
5
- };
@@ -1,40 +0,0 @@
1
- export var calcSize = function calcSize(size) {
2
- var blockSize;
3
- var borderRadius;
4
- switch (size) {
5
- case 'large':
6
- {
7
- blockSize = 44;
8
- borderRadius = 8;
9
- break;
10
- }
11
- case 'normal':
12
- {
13
- blockSize = 36;
14
- borderRadius = 5;
15
- break;
16
- }
17
- case 'small':
18
- {
19
- blockSize = 24;
20
- borderRadius = 5;
21
- break;
22
- }
23
- case 'site':
24
- {
25
- blockSize = 34;
26
- borderRadius = 5;
27
- break;
28
- }
29
- default:
30
- {
31
- blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
32
- borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
33
- break;
34
- }
35
- }
36
- return {
37
- blockSize: blockSize,
38
- borderRadius: borderRadius
39
- };
40
- };
@@ -1,5 +0,0 @@
1
- import { IconSize } from "./index";
2
- export declare const calcSize: (size?: IconSize) => {
3
- fontSize: string | number;
4
- strokeWidth: string | number;
5
- };
@@ -1,39 +0,0 @@
1
- export var calcSize = function calcSize(size) {
2
- var fontSize;
3
- var strokeWidth;
4
- switch (size) {
5
- case 'large':
6
- {
7
- fontSize = 24;
8
- strokeWidth = 2;
9
- break;
10
- }
11
- case 'normal':
12
- {
13
- fontSize = 20;
14
- strokeWidth = 2;
15
- break;
16
- }
17
- case 'small':
18
- {
19
- fontSize = 14;
20
- strokeWidth = 1.5;
21
- break;
22
- }
23
- default:
24
- {
25
- if (size) {
26
- fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
27
- strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
28
- } else {
29
- fontSize = '1em';
30
- strokeWidth = 2;
31
- }
32
- break;
33
- }
34
- }
35
- return {
36
- fontSize: fontSize,
37
- strokeWidth: strokeWidth
38
- };
39
- };