@lobehub/ui 1.153.17 → 1.154.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/CopyButton/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
5
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["content", "placement", "size", "icon", "glass", "onClick"];
|
|
7
|
+
var _excluded = ["active", "content", "placement", "size", "icon", "glass", "onClick"];
|
|
8
8
|
import { Check, Copy } from 'lucide-react';
|
|
9
9
|
import { memo } from 'react';
|
|
10
10
|
import ActionIcon from "../ActionIcon";
|
|
@@ -12,7 +12,8 @@ import { useCopied } from "../hooks/useCopied";
|
|
|
12
12
|
import { copyToClipboard } from "../utils/copyToClipboard";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
var CopyButton = /*#__PURE__*/memo(function (_ref) {
|
|
15
|
-
var
|
|
15
|
+
var active = _ref.active,
|
|
16
|
+
content = _ref.content,
|
|
16
17
|
_ref$placement = _ref.placement,
|
|
17
18
|
placement = _ref$placement === void 0 ? 'right' : _ref$placement,
|
|
18
19
|
_ref$size = _ref.size,
|
|
@@ -27,9 +28,12 @@ var CopyButton = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
28
|
setCopied = _useCopied.setCopied;
|
|
28
29
|
var Icon = icon || Copy;
|
|
29
30
|
return /*#__PURE__*/_jsx(ActionIcon, _objectSpread(_objectSpread({
|
|
30
|
-
glass: glass
|
|
31
|
+
glass: glass,
|
|
32
|
+
placement: placement,
|
|
33
|
+
size: size,
|
|
34
|
+
title: 'Copy'
|
|
31
35
|
}, rest), {}, {
|
|
32
|
-
active: copied,
|
|
36
|
+
active: active || copied,
|
|
33
37
|
icon: copied ? Check : Icon,
|
|
34
38
|
onClick: ( /*#__PURE__*/function () {
|
|
35
39
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
@@ -50,10 +54,7 @@ var CopyButton = /*#__PURE__*/memo(function (_ref) {
|
|
|
50
54
|
return function (_x) {
|
|
51
55
|
return _ref2.apply(this, arguments);
|
|
52
56
|
};
|
|
53
|
-
}())
|
|
54
|
-
placement: placement,
|
|
55
|
-
size: size,
|
|
56
|
-
title: 'Copy'
|
|
57
|
+
}())
|
|
57
58
|
}));
|
|
58
59
|
});
|
|
59
60
|
export default CopyButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
var _excluded = ["children", "language", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "bodyRender", "actionsRender", "copyable", "type"];
|
|
4
|
+
var _excluded = ["children", "language", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "bodyRender", "actionsRender", "copyable", "type", "defalutExpand"];
|
|
5
5
|
import { Select } from 'antd';
|
|
6
6
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
7
7
|
import { memo, useState } from 'react';
|
|
@@ -33,8 +33,10 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
33
|
actionsRender = _ref.actionsRender,
|
|
34
34
|
copyable = _ref.copyable,
|
|
35
35
|
type = _ref.type,
|
|
36
|
+
_ref$defalutExpand = _ref.defalutExpand,
|
|
37
|
+
defalutExpand = _ref$defalutExpand === void 0 ? true : _ref$defalutExpand,
|
|
36
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
var _useState = useState(
|
|
39
|
+
var _useState = useState(defalutExpand),
|
|
38
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
41
|
expand = _useState2[0],
|
|
40
42
|
setExpand = _useState2[1];
|
package/es/Highlighter/type.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface HighlighterProps extends DivProps {
|
|
|
25
25
|
* @default true
|
|
26
26
|
*/
|
|
27
27
|
copyable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @description Whether to expand code blocks by default
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
defalutExpand?: boolean;
|
|
28
33
|
fileName?: string;
|
|
29
34
|
fullFeatured?: boolean;
|
|
30
35
|
icon?: ReactNode;
|