@lobehub/ui 1.5.0 → 1.6.1
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/ActionIcon/index.d.ts +17 -1
- package/es/ActionIcon/index.js +14 -3
- package/es/CopyButton/index.d.ts +1 -9
- package/es/CopyButton/index.js +5 -19
- package/es/Snippet/style.js +1 -1
- package/lib/ActionIcon/index.d.ts +17 -1
- package/lib/ActionIcon/index.js +16 -2
- package/lib/CopyButton/index.d.ts +1 -9
- package/lib/CopyButton/index.js +3 -7
- package/lib/Snippet/style.js +1 -1
- package/package.json +1 -1
package/es/ActionIcon/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { TooltipProps } from "../index";
|
|
3
3
|
import { DivProps } from "../types";
|
|
4
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
5
|
export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
|
|
5
6
|
blockSize?: number;
|
|
6
7
|
fontSize?: number;
|
|
@@ -28,6 +29,21 @@ export interface ActionIconProps extends DivProps {
|
|
|
28
29
|
* @default 'false'
|
|
29
30
|
*/
|
|
30
31
|
glass?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description The text shown in the tooltip
|
|
34
|
+
*/
|
|
35
|
+
title?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description The position of the tooltip relative to the target
|
|
38
|
+
* @enum ["top","left","right","bottom","topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]
|
|
39
|
+
* @default "top"
|
|
40
|
+
*/
|
|
41
|
+
placement?: TooltipProps['placement'];
|
|
42
|
+
/**
|
|
43
|
+
* @description Change arrow's visible state and change whether the arrow is pointed at the center of target.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
arrow?: boolean;
|
|
31
47
|
}
|
|
32
48
|
declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
|
|
33
49
|
export default ActionIcon;
|
package/es/ActionIcon/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "active", "icon", "size", "style", "glass"];
|
|
3
|
+
var _excluded = ["className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow"];
|
|
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
|
-
import { Icon } from "./..";
|
|
6
|
+
import { Icon, Tooltip } from "./..";
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { useStyles } from "./style";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -15,6 +15,10 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
15
15
|
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
16
16
|
style = _ref.style,
|
|
17
17
|
glass = _ref.glass,
|
|
18
|
+
title = _ref.title,
|
|
19
|
+
placement = _ref.placement,
|
|
20
|
+
_ref$arrow = _ref.arrow,
|
|
21
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
18
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
23
|
var _useStyles = useStyles({
|
|
20
24
|
active: Boolean(active),
|
|
@@ -46,7 +50,7 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
46
50
|
borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
|
|
47
51
|
break;
|
|
48
52
|
}
|
|
49
|
-
|
|
53
|
+
var actionIconBlock = /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
50
54
|
className: cx(styles.block, className),
|
|
51
55
|
style: _objectSpread({
|
|
52
56
|
width: blockSize,
|
|
@@ -59,5 +63,12 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
59
63
|
icon: icon
|
|
60
64
|
})
|
|
61
65
|
}));
|
|
66
|
+
if (!title) return actionIconBlock;
|
|
67
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
68
|
+
arrow: arrow,
|
|
69
|
+
title: title,
|
|
70
|
+
placement: placement,
|
|
71
|
+
children: actionIconBlock
|
|
72
|
+
});
|
|
62
73
|
});
|
|
63
74
|
export default ActionIcon;
|
package/es/CopyButton/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ActionIconSize, TooltipProps } from "../index";
|
|
2
2
|
import { DivProps } from "../types";
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
3
|
export interface CopyButtonProps extends DivProps {
|
|
5
4
|
/**
|
|
6
5
|
* @description The text content to be copied
|
|
@@ -22,13 +21,6 @@ export interface CopyButtonProps extends DivProps {
|
|
|
22
21
|
* @default 'right'
|
|
23
22
|
*/
|
|
24
23
|
placement?: TooltipProps['placement'];
|
|
25
|
-
/**
|
|
26
|
-
* @description A function that returns the children to be rendered
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
render?: (props: {
|
|
30
|
-
handleCopy: () => void;
|
|
31
|
-
}) => ReactNode;
|
|
32
24
|
}
|
|
33
|
-
declare const CopyButton: ({ content, className, placement, size,
|
|
25
|
+
declare const CopyButton: ({ content, className, placement, size, ...props }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
26
|
export default CopyButton;
|
package/es/CopyButton/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["content", "className", "placement", "size"
|
|
3
|
+
var _excluded = ["content", "className", "placement", "size"];
|
|
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 { useCopied } from "../hooks/useCopied";
|
|
7
|
-
import { ActionIcon
|
|
7
|
+
import { ActionIcon } from "./..";
|
|
8
8
|
import copy from 'copy-to-clipboard';
|
|
9
9
|
import { Copy } from 'lucide-react';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
11
|
var CopyButton = function CopyButton(_ref) {
|
|
13
12
|
var content = _ref.content,
|
|
14
13
|
className = _ref.className,
|
|
@@ -16,18 +15,13 @@ var CopyButton = function CopyButton(_ref) {
|
|
|
16
15
|
placement = _ref$placement === void 0 ? 'right' : _ref$placement,
|
|
17
16
|
_ref$size = _ref.size,
|
|
18
17
|
size = _ref$size === void 0 ? 'site' : _ref$size,
|
|
19
|
-
render = _ref.render,
|
|
20
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
19
|
var _useCopied = useCopied(),
|
|
22
20
|
copied = _useCopied.copied,
|
|
23
21
|
setCopied = _useCopied.setCopied;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
var children = render ? render({
|
|
29
|
-
handleCopy: handleCopy
|
|
30
|
-
}) : /*#__PURE__*/_jsx(ActionIcon, _objectSpread(_objectSpread({}, props), {}, {
|
|
22
|
+
return /*#__PURE__*/_jsx(ActionIcon, _objectSpread(_objectSpread({}, props), {}, {
|
|
23
|
+
placement: placement,
|
|
24
|
+
title: copied ? '✅ Success' : 'Copy',
|
|
31
25
|
icon: Copy,
|
|
32
26
|
className: className,
|
|
33
27
|
size: size,
|
|
@@ -37,13 +31,5 @@ var CopyButton = function CopyButton(_ref) {
|
|
|
37
31
|
setCopied();
|
|
38
32
|
}
|
|
39
33
|
}));
|
|
40
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
|
41
|
-
arrow: false,
|
|
42
|
-
placement: placement,
|
|
43
|
-
title: copied ? /*#__PURE__*/_jsx(_Fragment, {
|
|
44
|
-
children: "\u2705 Success"
|
|
45
|
-
}) : 'Copy',
|
|
46
|
-
children: children
|
|
47
|
-
});
|
|
48
34
|
};
|
|
49
35
|
export default CopyButton;
|
package/es/Snippet/style.js
CHANGED
|
@@ -5,5 +5,5 @@ import { rgba } from 'polished';
|
|
|
5
5
|
export var useStyles = createStyles(function (_ref, type) {
|
|
6
6
|
var css = _ref.css,
|
|
7
7
|
token = _ref.token;
|
|
8
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n max-width: 100%;\n position: relative;\n align-items: center;\n border-radius: ", "px;\n gap: 8px;\n padding: 0 8px;\n height: 36px;\n transition: background-color 100ms ", ";\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n background: none !important;\n padding-top: 6px; !important;\n margin: 0 !important;\n line-height: 1;\n }\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), rgba(token.colorBgElevated, 0.6)) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), token.colorFillTertiary);
|
|
8
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n max-width: 100%;\n position: relative;\n align-items: center;\n border-radius: ", "px;\n gap: 8px;\n padding: 0 8px 0 12px;\n height: 36px;\n transition: background-color 100ms ", ";\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n background: none !important;\n padding-top: 6px; !important;\n margin: 0 !important;\n line-height: 1;\n }\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), rgba(token.colorBgElevated, 0.6)) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), token.colorFillTertiary);
|
|
9
9
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { TooltipProps } from "../index";
|
|
3
3
|
import { DivProps } from "../types";
|
|
4
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
5
|
export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
|
|
5
6
|
blockSize?: number;
|
|
6
7
|
fontSize?: number;
|
|
@@ -28,6 +29,21 @@ export interface ActionIconProps extends DivProps {
|
|
|
28
29
|
* @default 'false'
|
|
29
30
|
*/
|
|
30
31
|
glass?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description The text shown in the tooltip
|
|
34
|
+
*/
|
|
35
|
+
title?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description The position of the tooltip relative to the target
|
|
38
|
+
* @enum ["top","left","right","bottom","topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]
|
|
39
|
+
* @default "top"
|
|
40
|
+
*/
|
|
41
|
+
placement?: TooltipProps['placement'];
|
|
42
|
+
/**
|
|
43
|
+
* @description Change arrow's visible state and change whether the arrow is pointed at the center of target.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
arrow?: boolean;
|
|
31
47
|
}
|
|
32
48
|
declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
|
|
33
49
|
export default ActionIcon;
|
package/lib/ActionIcon/index.js
CHANGED
|
@@ -26,7 +26,18 @@ var import__ = require("../index");
|
|
|
26
26
|
var import_react = require("react");
|
|
27
27
|
var import_style = require("./style");
|
|
28
28
|
var ActionIcon = (0, import_react.memo)(
|
|
29
|
-
({
|
|
29
|
+
({
|
|
30
|
+
className,
|
|
31
|
+
active,
|
|
32
|
+
icon,
|
|
33
|
+
size = "normal",
|
|
34
|
+
style,
|
|
35
|
+
glass,
|
|
36
|
+
title,
|
|
37
|
+
placement,
|
|
38
|
+
arrow = false,
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
30
41
|
const { styles, cx } = (0, import_style.useStyles)({ active: Boolean(active), glass: Boolean(glass) });
|
|
31
42
|
let blockSize;
|
|
32
43
|
let borderRadius;
|
|
@@ -52,7 +63,7 @@ var ActionIcon = (0, import_react.memo)(
|
|
|
52
63
|
borderRadius = (size == null ? void 0 : size.borderRadius) || 5;
|
|
53
64
|
break;
|
|
54
65
|
}
|
|
55
|
-
|
|
66
|
+
const actionIconBlock = /* @__PURE__ */ React.createElement(
|
|
56
67
|
"div",
|
|
57
68
|
{
|
|
58
69
|
className: cx(styles.block, className),
|
|
@@ -61,6 +72,9 @@ var ActionIcon = (0, import_react.memo)(
|
|
|
61
72
|
},
|
|
62
73
|
/* @__PURE__ */ React.createElement(import__.Icon, { size: size === "site" ? "small" : size, icon })
|
|
63
74
|
);
|
|
75
|
+
if (!title)
|
|
76
|
+
return actionIconBlock;
|
|
77
|
+
return /* @__PURE__ */ React.createElement(import__.Tooltip, { arrow, title, placement }, actionIconBlock);
|
|
64
78
|
}
|
|
65
79
|
);
|
|
66
80
|
var ActionIcon_default = ActionIcon;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ActionIconSize, TooltipProps } from "../index";
|
|
2
2
|
import { DivProps } from "../types";
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
3
|
export interface CopyButtonProps extends DivProps {
|
|
5
4
|
/**
|
|
6
5
|
* @description The text content to be copied
|
|
@@ -22,13 +21,6 @@ export interface CopyButtonProps extends DivProps {
|
|
|
22
21
|
* @default 'right'
|
|
23
22
|
*/
|
|
24
23
|
placement?: TooltipProps['placement'];
|
|
25
|
-
/**
|
|
26
|
-
* @description A function that returns the children to be rendered
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
render?: (props: {
|
|
30
|
-
handleCopy: () => void;
|
|
31
|
-
}) => ReactNode;
|
|
32
24
|
}
|
|
33
|
-
declare const CopyButton: ({ content, className, placement, size,
|
|
25
|
+
declare const CopyButton: ({ content, className, placement, size, ...props }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
26
|
export default CopyButton;
|
package/lib/CopyButton/index.js
CHANGED
|
@@ -41,18 +41,15 @@ var CopyButton = ({
|
|
|
41
41
|
className,
|
|
42
42
|
placement = "right",
|
|
43
43
|
size = "site",
|
|
44
|
-
render,
|
|
45
44
|
...props
|
|
46
45
|
}) => {
|
|
47
46
|
const { copied, setCopied } = (0, import_useCopied.useCopied)();
|
|
48
|
-
|
|
49
|
-
(0, import_copy_to_clipboard.default)(content);
|
|
50
|
-
setCopied();
|
|
51
|
-
};
|
|
52
|
-
const children = render ? render({ handleCopy }) : /* @__PURE__ */ React.createElement(
|
|
47
|
+
return /* @__PURE__ */ React.createElement(
|
|
53
48
|
import__.ActionIcon,
|
|
54
49
|
{
|
|
55
50
|
...props,
|
|
51
|
+
placement,
|
|
52
|
+
title: copied ? "✅ Success" : "Copy",
|
|
56
53
|
icon: import_lucide_react.Copy,
|
|
57
54
|
className,
|
|
58
55
|
size,
|
|
@@ -63,7 +60,6 @@ var CopyButton = ({
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
);
|
|
66
|
-
return /* @__PURE__ */ React.createElement(import__.Tooltip, { arrow: false, placement, title: copied ? /* @__PURE__ */ React.createElement(React.Fragment, null, "✅ Success") : "Copy" }, children);
|
|
67
63
|
};
|
|
68
64
|
var CopyButton_default = CopyButton;
|
|
69
65
|
// Annotate the CommonJS export names for ESM import in node:
|
package/lib/Snippet/style.js
CHANGED