@lobehub/ui 2.0.10 → 2.0.12
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/Img/index.d.ts +6 -5
- package/es/SliderWithInput/SliderWithInput.js +6 -3
- package/es/SliderWithInput/type.d.ts +1 -0
- package/es/brand/Logo3d/index.d.ts +4 -3
- package/es/chat/EditableMessage/EditableMessage.js +4 -0
- package/es/chat/EditableMessage/type.d.ts +1 -0
- package/es/chat/MessageInput/MessageInput.js +22 -3
- package/es/chat/MessageInput/type.d.ts +1 -0
- package/es/chat/MessageModal/MessageModal.js +24 -2
- package/es/chat/MessageModal/type.d.ts +1 -0
- package/es/hooks/useMermaid.js +0 -1
- package/package.json +1 -1
package/es/Img/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ImageProps } from 'antd';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import type { ImgProps } from "../types";
|
|
4
|
-
|
|
5
|
-
ref?: Ref<HTMLImageElement
|
|
6
|
-
unoptimized?: boolean
|
|
7
|
-
}
|
|
3
|
+
import type { ImgProps as HtmlImgeProps } from "../types";
|
|
4
|
+
type ImgProps = HtmlImgeProps & ImageProps & {
|
|
5
|
+
ref?: Ref<HTMLImageElement>;
|
|
6
|
+
unoptimized?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const Img: import("react").NamedExoticComponent<ImgProps>;
|
|
8
9
|
export default Img;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["step", "value", "onChange", "max", "min", "defaultValue", "size", "controls", "gap", "style", "className", "classNames", "styles", "disabled"],
|
|
4
|
+
var _excluded = ["step", "value", "onChange", "max", "min", "defaultValue", "size", "controls", "gap", "style", "className", "classNames", "styles", "disabled", "unlimitedInput"],
|
|
5
5
|
_excluded2 = ["slider", "input"],
|
|
6
6
|
_excluded3 = ["slider", "input"];
|
|
7
7
|
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; }
|
|
@@ -22,7 +22,8 @@ var SliderWithInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
22
22
|
var step = _ref.step,
|
|
23
23
|
value = _ref.value,
|
|
24
24
|
onChange = _ref.onChange,
|
|
25
|
-
max = _ref.max,
|
|
25
|
+
_ref$max = _ref.max,
|
|
26
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
26
27
|
min = _ref.min,
|
|
27
28
|
defaultValue = _ref.defaultValue,
|
|
28
29
|
size = _ref.size,
|
|
@@ -34,6 +35,8 @@ var SliderWithInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
34
35
|
classNames = _ref.classNames,
|
|
35
36
|
styles = _ref.styles,
|
|
36
37
|
disabled = _ref.disabled,
|
|
38
|
+
_ref$unlimitedInput = _ref.unlimitedInput,
|
|
39
|
+
unlimitedInput = _ref$unlimitedInput === void 0 ? false : _ref$unlimitedInput,
|
|
37
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
41
|
var handleOnchange = function handleOnchange(value) {
|
|
39
42
|
if (Number.isNaN(value) || isNull(value)) return;
|
|
@@ -76,7 +79,7 @@ var SliderWithInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
76
79
|
controls: size !== 'small' || controls,
|
|
77
80
|
defaultValue: defaultValue,
|
|
78
81
|
disabled: disabled,
|
|
79
|
-
max: max,
|
|
82
|
+
max: unlimitedInput ? undefined : max,
|
|
80
83
|
min: min,
|
|
81
84
|
onChange: function onChange(v) {
|
|
82
85
|
return handleOnchange(Number(v));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ImageProps } from 'antd';
|
|
3
3
|
import { ImgProps } from "../../types";
|
|
4
|
-
|
|
5
|
-
size?:
|
|
6
|
-
}
|
|
4
|
+
type Logo3dProps = Omit<ImgProps & ImageProps, 'width' | 'height' | 'src'> & {
|
|
5
|
+
size?: number | string;
|
|
6
|
+
};
|
|
7
|
+
declare const Logo3d: import("react").NamedExoticComponent<Logo3dProps>;
|
|
7
8
|
export default Logo3d;
|
|
@@ -43,6 +43,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
|
|
44
44
|
model = _ref.model,
|
|
45
45
|
fontSize = _ref.fontSize,
|
|
46
|
+
_ref$language = _ref.language,
|
|
47
|
+
language = _ref$language === void 0 ? 'markdown' : _ref$language,
|
|
46
48
|
markdownProps = _ref.markdownProps;
|
|
47
49
|
var _useControlledState = useControlledState(false, {
|
|
48
50
|
onChange: onEditingChange,
|
|
@@ -65,6 +67,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
65
67
|
defaultValue: value,
|
|
66
68
|
editButtonSize: editButtonSize,
|
|
67
69
|
height: height,
|
|
70
|
+
language: language,
|
|
68
71
|
onCancel: function onCancel() {
|
|
69
72
|
return setTyping(false);
|
|
70
73
|
},
|
|
@@ -96,6 +99,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
96
99
|
extra: model === null || model === void 0 ? void 0 : model.extra,
|
|
97
100
|
footer: model === null || model === void 0 ? void 0 : model.footer,
|
|
98
101
|
height: height,
|
|
102
|
+
language: language,
|
|
99
103
|
onChange: onChange,
|
|
100
104
|
onEditingChange: setTyping,
|
|
101
105
|
onOpenChange: function onOpenChange(e) {
|
|
@@ -14,6 +14,7 @@ export interface EditableMessageProps {
|
|
|
14
14
|
fontSize?: number;
|
|
15
15
|
fullFeaturedCodeBlock?: boolean;
|
|
16
16
|
height?: MessageInputProps['height'];
|
|
17
|
+
language?: MessageInputProps['language'];
|
|
17
18
|
markdownProps?: Omit<MarkdownProps, 'className' | 'style' | 'children'>;
|
|
18
19
|
model?: {
|
|
19
20
|
extra?: MessageModalProps['extra'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["text", "variant", "onCancel", "defaultValue", "onConfirm", "renderButtons", "placeholder", "styles", "style", "editButtonSize", "classNames", "shortcut"];
|
|
4
|
+
var _excluded = ["text", "variant", "onCancel", "defaultValue", "onConfirm", "renderButtons", "placeholder", "styles", "style", "editButtonSize", "classNames", "shortcut", "language"];
|
|
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
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -15,6 +15,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
17
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import { useResponsive } from 'antd-style';
|
|
18
19
|
import { memo, useState } from 'react';
|
|
19
20
|
import { useHotkeys } from 'react-hotkeys-hook';
|
|
20
21
|
import { Flexbox } from 'react-layout-kit';
|
|
@@ -22,6 +23,7 @@ import Button from "../../Button";
|
|
|
22
23
|
import CodeEditor from "../../CodeEditor";
|
|
23
24
|
import { KeyMapEnum } from "../../Hotkey/const";
|
|
24
25
|
import { combineKeys } from "../../Hotkey/utils";
|
|
26
|
+
import TextArea from "../../Input/TextArea";
|
|
25
27
|
import Tooltip from "../../Tooltip";
|
|
26
28
|
import { useStyles } from "./style";
|
|
27
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -42,7 +44,11 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
44
|
editButtonSize = _ref$editButtonSize === void 0 ? 'middle' : _ref$editButtonSize,
|
|
43
45
|
classNames = _ref.classNames,
|
|
44
46
|
shortcut = _ref.shortcut,
|
|
47
|
+
_ref$language = _ref.language,
|
|
48
|
+
language = _ref$language === void 0 ? 'markdown' : _ref$language,
|
|
45
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var _useResponsive = useResponsive(),
|
|
51
|
+
mobile = _useResponsive.mobile;
|
|
46
52
|
var _useState = useState(defaultValue || ''),
|
|
47
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
54
|
temporaryValue = _useState2[0],
|
|
@@ -84,10 +90,23 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
84
90
|
width: '100%'
|
|
85
91
|
}, style)
|
|
86
92
|
}, rest), {}, {
|
|
87
|
-
children: [/*#__PURE__*/_jsx(
|
|
93
|
+
children: [mobile ? /*#__PURE__*/_jsx(TextArea, {
|
|
94
|
+
autoSize: true,
|
|
95
|
+
className: cx(styles, classNames === null || classNames === void 0 ? void 0 : classNames.editor),
|
|
96
|
+
onBlur: function onBlur(e) {
|
|
97
|
+
return setValue(e.target.value);
|
|
98
|
+
},
|
|
99
|
+
onChange: function onChange(e) {
|
|
100
|
+
return setValue(e.target.value);
|
|
101
|
+
},
|
|
102
|
+
placeholder: placeholder,
|
|
103
|
+
style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.editor,
|
|
104
|
+
value: temporaryValue,
|
|
105
|
+
variant: variant
|
|
106
|
+
}) : /*#__PURE__*/_jsx(CodeEditor, {
|
|
88
107
|
className: cx(styles, classNames === null || classNames === void 0 ? void 0 : classNames.editor),
|
|
89
108
|
classNames: classNames,
|
|
90
|
-
language:
|
|
109
|
+
language: language,
|
|
91
110
|
onBlur: function onBlur(e) {
|
|
92
111
|
return setValue(e.target.value);
|
|
93
112
|
},
|
|
@@ -6,11 +6,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
6
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
import { useResponsive } from 'antd-style';
|
|
9
10
|
import { memo, useState } from 'react';
|
|
10
11
|
import { Flexbox } from 'react-layout-kit';
|
|
11
12
|
import useControlledState from 'use-merge-value';
|
|
12
13
|
import Button from "../../Button";
|
|
13
14
|
import CodeEditor from "../../CodeEditor";
|
|
15
|
+
import TextArea from "../../Input/TextArea";
|
|
14
16
|
import Markdown from "../../Markdown";
|
|
15
17
|
import Modal from "../../Modal";
|
|
16
18
|
import { useStyles as useTextStyles } from "../MessageInput/style";
|
|
@@ -27,10 +29,14 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
29
|
onEditingChange = _ref.onEditingChange,
|
|
28
30
|
placeholder = _ref.placeholder,
|
|
29
31
|
value = _ref.value,
|
|
32
|
+
_ref$language = _ref.language,
|
|
33
|
+
language = _ref$language === void 0 ? 'markdown' : _ref$language,
|
|
30
34
|
onChange = _ref.onChange,
|
|
31
35
|
text = _ref.text,
|
|
32
36
|
footer = _ref.footer,
|
|
33
37
|
extra = _ref.extra;
|
|
38
|
+
var _useResponsive = useResponsive(),
|
|
39
|
+
mobile = _useResponsive.mobile;
|
|
34
40
|
var _useTextStyles = useTextStyles(),
|
|
35
41
|
textStyles = _useTextStyles.styles;
|
|
36
42
|
var _useControlledState = useControlledState(false, {
|
|
@@ -88,10 +94,26 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
88
94
|
open: showModal,
|
|
89
95
|
panelRef: panelRef,
|
|
90
96
|
title: text === null || text === void 0 ? void 0 : text.title,
|
|
91
|
-
children: isEdit ? /*#__PURE__*/_jsx(
|
|
97
|
+
children: isEdit ? mobile ? /*#__PURE__*/_jsx(TextArea, {
|
|
98
|
+
autoSize: true,
|
|
92
99
|
className: textStyles,
|
|
93
100
|
defaultValue: temporaryValue,
|
|
94
|
-
|
|
101
|
+
onBlur: function onBlur(e) {
|
|
102
|
+
return setMessage(e.target.value);
|
|
103
|
+
},
|
|
104
|
+
onChange: function onChange(value) {
|
|
105
|
+
return setMessage(value.target.value);
|
|
106
|
+
},
|
|
107
|
+
placeholder: placeholder,
|
|
108
|
+
value: temporaryValue,
|
|
109
|
+
variant: 'borderless'
|
|
110
|
+
}) : /*#__PURE__*/_jsx(CodeEditor, {
|
|
111
|
+
className: textStyles,
|
|
112
|
+
defaultValue: temporaryValue,
|
|
113
|
+
language: language,
|
|
114
|
+
onBlur: function onBlur(e) {
|
|
115
|
+
return setMessage(e.target.value);
|
|
116
|
+
},
|
|
95
117
|
onValueChange: function onValueChange(value) {
|
|
96
118
|
return setMessage(value);
|
|
97
119
|
},
|
|
@@ -5,6 +5,7 @@ export interface MessageModalProps extends Pick<ModalProps, 'open' | 'footer' |
|
|
|
5
5
|
editing?: boolean;
|
|
6
6
|
extra?: ReactNode;
|
|
7
7
|
height?: MessageInputProps['height'];
|
|
8
|
+
language?: MessageInputProps['language'];
|
|
8
9
|
onChange?: (text: string) => void;
|
|
9
10
|
onEditingChange?: (editing: boolean) => void;
|
|
10
11
|
onOpenChange?: (open: boolean) => void;
|
package/es/hooks/useMermaid.js
CHANGED
|
@@ -54,7 +54,6 @@ export var useMermaid = function useMermaid(content, _ref) {
|
|
|
54
54
|
errorBkgColor: theme.colorTextDescription,
|
|
55
55
|
errorTextColor: theme.colorTextDescription,
|
|
56
56
|
fontFamily: theme.fontFamily,
|
|
57
|
-
fontSize: 14,
|
|
58
57
|
lineColor: theme.colorTextSecondary,
|
|
59
58
|
mainBkg: theme.colorBgContainer,
|
|
60
59
|
noteBkgColor: theme.colorInfoBg,
|