@lobehub/ui 1.19.0 → 1.20.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/ActionIcon/index.d.ts +5 -1
- package/es/ActionIcon/index.js +18 -6
- package/es/Icon/index.d.ts +9 -4
- package/es/Icon/index.js +24 -9
- package/es/Icon/style.d.ts +3 -0
- package/es/Icon/style.js +10 -0
- package/es/Spotlight/index.d.ts +4 -0
- package/es/types/index.d.ts +6 -6
- package/package.json +1 -1
package/es/ActionIcon/index.d.ts
CHANGED
|
@@ -28,7 +28,11 @@ export interface ActionIconProps extends DivProps {
|
|
|
28
28
|
* @description The icon element to be rendered
|
|
29
29
|
* @type LucideIcon
|
|
30
30
|
*/
|
|
31
|
-
icon
|
|
31
|
+
icon?: LucideIcon;
|
|
32
|
+
/**
|
|
33
|
+
* @description Set the loading status of ActionIcon
|
|
34
|
+
*/
|
|
35
|
+
loading?: boolean;
|
|
32
36
|
/**
|
|
33
37
|
* @description Handle click action
|
|
34
38
|
*/
|
package/es/ActionIcon/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
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", "title", "placement", "arrow", "spotlight", "onClick"];
|
|
3
|
+
var _excluded = ["className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading"];
|
|
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 { Loader2 } from 'lucide-react';
|
|
6
7
|
import { memo } from 'react';
|
|
7
8
|
import { Icon, Spotlight, Tooltip } from "./..";
|
|
8
9
|
import { useStyles } from "./style";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
13
|
var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
12
14
|
var className = _ref.className,
|
|
@@ -22,6 +24,8 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
22
24
|
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
23
25
|
spotlight = _ref.spotlight,
|
|
24
26
|
onClick = _ref.onClick,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
loading = _ref.loading,
|
|
25
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
30
|
var _useStyles = useStyles({
|
|
27
31
|
active: Boolean(active),
|
|
@@ -53,19 +57,27 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
53
57
|
borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
|
|
54
58
|
break;
|
|
55
59
|
}
|
|
60
|
+
var content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
61
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
62
|
+
icon: icon,
|
|
63
|
+
size: size === 'site' ? 'normal' : size
|
|
64
|
+
}), children]
|
|
65
|
+
});
|
|
66
|
+
var spin = /*#__PURE__*/_jsx(Icon, {
|
|
67
|
+
icon: Loader2,
|
|
68
|
+
size: size === 'site' ? 'normal' : size,
|
|
69
|
+
spin: true
|
|
70
|
+
});
|
|
56
71
|
var actionIconBlock = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
57
72
|
className: cx(styles.block, className),
|
|
58
|
-
onClick: onClick,
|
|
73
|
+
onClick: loading ? undefined : onClick,
|
|
59
74
|
style: _objectSpread({
|
|
60
75
|
width: blockSize,
|
|
61
76
|
height: blockSize,
|
|
62
77
|
borderRadius: borderRadius
|
|
63
78
|
}, style)
|
|
64
79
|
}, props), {}, {
|
|
65
|
-
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}),
|
|
66
|
-
icon: icon,
|
|
67
|
-
size: size === 'site' ? 'normal' : size
|
|
68
|
-
})]
|
|
80
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), loading ? spin : content]
|
|
69
81
|
}));
|
|
70
82
|
if (!title) return actionIconBlock;
|
|
71
83
|
return /*#__PURE__*/_jsx(Tooltip, {
|
package/es/Icon/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LucideIcon } from 'lucide-react';
|
|
3
|
-
import {
|
|
3
|
+
import { DivProps } from "../types";
|
|
4
4
|
export declare type IconSize = 'large' | 'normal' | 'small' | {
|
|
5
5
|
fontSize?: number;
|
|
6
6
|
strokeWidth?: number;
|
|
7
7
|
};
|
|
8
|
-
export interface IconProps extends
|
|
8
|
+
export interface IconProps extends DivProps {
|
|
9
9
|
/**
|
|
10
10
|
* @description The icon element to be rendered
|
|
11
11
|
* @type LucideIcon
|
|
@@ -16,6 +16,11 @@ export interface IconProps extends SvgProps {
|
|
|
16
16
|
* @default 'normal'
|
|
17
17
|
*/
|
|
18
18
|
size?: IconSize;
|
|
19
|
+
/**
|
|
20
|
+
* @description Rotate icon with animation
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
spin?: boolean;
|
|
19
24
|
}
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
25
|
+
declare const Icon: import("react").NamedExoticComponent<IconProps>;
|
|
26
|
+
export default Icon;
|
package/es/Icon/index.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
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"];
|
|
3
|
+
var _excluded = ["icon", "size", "style", "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 } from 'react';
|
|
7
|
+
import { useStyles } from "./style";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
var Icon = function
|
|
9
|
+
var Icon = /*#__PURE__*/memo(function (_ref) {
|
|
9
10
|
var icon = _ref.icon,
|
|
10
11
|
size = _ref.size,
|
|
12
|
+
style = _ref.style,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
spin = _ref.spin,
|
|
11
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var _useStyles = useStyles(),
|
|
17
|
+
styles = _useStyles.styles,
|
|
18
|
+
cx = _useStyles.cx;
|
|
19
|
+
var SvgIcon = icon;
|
|
12
20
|
var fontSize;
|
|
13
21
|
var strokeWidth;
|
|
14
|
-
var SvgIcon = icon;
|
|
15
22
|
switch (size) {
|
|
16
23
|
case 'large':
|
|
17
24
|
fontSize = 24;
|
|
@@ -35,9 +42,17 @@ var Icon = function Icon(_ref) {
|
|
|
35
42
|
}
|
|
36
43
|
break;
|
|
37
44
|
}
|
|
38
|
-
return /*#__PURE__*/_jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
46
|
+
className: cx(spin && styles.spin, className),
|
|
47
|
+
style: _objectSpread({
|
|
48
|
+
width: fontSize,
|
|
49
|
+
height: fontSize
|
|
50
|
+
}, style)
|
|
51
|
+
}, props), {}, {
|
|
52
|
+
children: /*#__PURE__*/_jsx(SvgIcon, {
|
|
53
|
+
size: fontSize,
|
|
54
|
+
strokeWidth: strokeWidth
|
|
55
|
+
})
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
export default Icon;
|
package/es/Icon/style.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
import { createStyles, keyframes } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
var spin = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n "])));
|
|
7
|
+
return {
|
|
8
|
+
spin: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: ", " 1s linear infinite;\n "])), spin)
|
|
9
|
+
};
|
|
10
|
+
});
|
package/es/Spotlight/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DivProps } from "../types";
|
|
3
3
|
export interface SpotlightProps extends DivProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description The size of the spotlight circle
|
|
6
|
+
* @default 64
|
|
7
|
+
*/
|
|
4
8
|
size?: number;
|
|
5
9
|
}
|
|
6
10
|
declare const Spotlight: import("react").NamedExoticComponent<SpotlightProps>;
|
package/es/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare type DivProps =
|
|
3
|
-
export declare type SvgProps =
|
|
4
|
-
export declare type ImgProps =
|
|
5
|
-
export declare type InputProps =
|
|
6
|
-
export declare type TextAreaProps =
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export declare type DivProps = HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
export declare type SvgProps = HTMLAttributes<SVGSVGElement>;
|
|
4
|
+
export declare type ImgProps = HTMLAttributes<HTMLImageElement>;
|
|
5
|
+
export declare type InputProps = HTMLAttributes<HTMLInputElement>;
|
|
6
|
+
export declare type TextAreaProps = HTMLAttributes<HTMLTextAreaElement>;
|