@lobehub/ui 1.57.0 → 1.59.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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { LucideIcon } from 'lucide-react';
2
+ import { type IconProps } from "../Icon";
3
3
  import { type TooltipProps } from "../Tooltip";
4
4
  import { DivProps } from "../types";
5
5
  export type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
@@ -19,6 +19,8 @@ export interface ActionIconProps extends DivProps {
19
19
  * @default false
20
20
  */
21
21
  arrow?: boolean;
22
+ color?: IconProps['color'];
23
+ fill?: IconProps['fill'];
22
24
  /**
23
25
  * @description Glass blur style
24
26
  * @default 'false'
@@ -28,7 +30,7 @@ export interface ActionIconProps extends DivProps {
28
30
  * @description The icon element to be rendered
29
31
  * @type LucideIcon
30
32
  */
31
- icon?: LucideIcon;
33
+ icon?: IconProps['icon'];
32
34
  /**
33
35
  * @description Set the loading status of ActionIcon
34
36
  */
@@ -1,6 +1,6 @@
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", "children", "loading", "tooltipDelay"];
3
+ var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay"];
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 { Loader2 } from 'lucide-react';
@@ -53,7 +53,9 @@ var calcSize = function calcSize(size) {
53
53
  };
54
54
  };
55
55
  var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
56
- var className = _ref.className,
56
+ var color = _ref.color,
57
+ fill = _ref.fill,
58
+ className = _ref.className,
57
59
  active = _ref.active,
58
60
  icon = _ref.icon,
59
61
  _ref$size = _ref.size,
@@ -84,11 +86,14 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
84
86
  borderRadius = _useMemo.borderRadius;
85
87
  var content = /*#__PURE__*/_jsxs(_Fragment, {
86
88
  children: [icon && /*#__PURE__*/_jsx(Icon, {
89
+ color: color,
90
+ fill: fill,
87
91
  icon: icon,
88
92
  size: size === 'site' ? 'normal' : size
89
93
  }), children]
90
94
  });
91
95
  var spin = /*#__PURE__*/_jsx(Icon, {
96
+ color: color,
92
97
  icon: Loader2,
93
98
  size: size === 'site' ? 'normal' : size,
94
99
  spin: true
@@ -6,6 +6,8 @@ export type IconSize = 'large' | 'normal' | 'small' | {
6
6
  strokeWidth?: number;
7
7
  };
8
8
  export interface IconProps extends DivProps {
9
+ color?: string;
10
+ fill?: string;
9
11
  /**
10
12
  * @description The icon element to be rendered
11
13
  * @type LucideIcon
package/es/Icon/index.js CHANGED
@@ -1,6 +1,6 @@
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", "className", "spin"];
3
+ var _excluded = ["icon", "size", "color", "fill", "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, useMemo } from 'react';
@@ -48,6 +48,8 @@ var calcSize = function calcSize(size) {
48
48
  var Icon = /*#__PURE__*/memo(function (_ref) {
49
49
  var icon = _ref.icon,
50
50
  size = _ref.size,
51
+ color = _ref.color,
52
+ fill = _ref.fill,
51
53
  className = _ref.className,
52
54
  spin = _ref.spin,
53
55
  props = _objectWithoutProperties(_ref, _excluded);
@@ -65,6 +67,8 @@ var Icon = /*#__PURE__*/memo(function (_ref) {
65
67
  role: "img"
66
68
  }, props), {}, {
67
69
  children: /*#__PURE__*/_jsx(SvgIcon, {
70
+ color: color,
71
+ fill: fill !== null && fill !== void 0 ? fill : 'transparent',
68
72
  focusable: false,
69
73
  height: fontSize,
70
74
  size: fontSize,
@@ -33,14 +33,8 @@ var ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, refere
33
33
  var _useStyles = useStyles(),
34
34
  styles = _useStyles.styles,
35
35
  cx = _useStyles.cx;
36
- return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
37
- align: 'flex-start',
36
+ return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
38
37
  className: cx(styles.container, active && styles.active, className),
39
- distribution: 'space-between',
40
- gap: 8,
41
- horizontal: true,
42
- paddingBlock: 12,
43
- paddingInline: 16,
44
38
  ref: reference,
45
39
  style: style
46
40
  }, props), {}, {
@@ -50,41 +44,48 @@ var ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, refere
50
44
  onMouseLeave: function onMouseLeave() {
51
45
  onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(false);
52
46
  },
53
- children: [avatar !== null && avatar !== void 0 ? avatar : /*#__PURE__*/_jsx(MessageOutlined, {
54
- style: {
55
- marginTop: 4
56
- }
57
- }), /*#__PURE__*/_jsxs(Flexbox, {
58
- className: styles.content,
59
- children: [/*#__PURE__*/_jsx(Flexbox, {
60
- distribution: 'space-between',
61
- horizontal: true,
62
- children: /*#__PURE__*/_jsx("div", {
63
- className: styles.title,
64
- children: title
65
- })
66
- }), description && /*#__PURE__*/_jsx("div", {
67
- className: styles.desc,
68
- children: description
69
- }), /*#__PURE__*/_jsx("div", {
70
- className: styles.textOverlay
71
- })]
72
- }), loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
73
- spin: true
74
- }) : showAction ? /*#__PURE__*/_jsx(Flexbox, {
75
- gap: 4,
47
+ children: /*#__PURE__*/_jsxs(Flexbox, {
48
+ align: 'flex-start',
49
+ className: styles.inner,
50
+ distribution: 'space-between',
51
+ gap: 8,
76
52
  horizontal: true,
77
- onClick: function onClick(e) {
78
- e.stopPropagation();
79
- },
80
- style: {
81
- display: showAction ? undefined : 'none'
82
- },
83
- children: renderActions
84
- }) : date && /*#__PURE__*/_jsx("div", {
85
- className: cx(styles.time, classNames.time),
86
- children: getChatItemTime(date)
87
- }), children]
53
+ paddingBlock: 12,
54
+ paddingInline: 16,
55
+ children: [avatar !== null && avatar !== void 0 ? avatar : /*#__PURE__*/_jsx(MessageOutlined, {
56
+ style: {
57
+ marginTop: 4
58
+ }
59
+ }), /*#__PURE__*/_jsxs(Flexbox, {
60
+ className: styles.content,
61
+ children: [/*#__PURE__*/_jsx(Flexbox, {
62
+ distribution: 'space-between',
63
+ horizontal: true,
64
+ children: /*#__PURE__*/_jsx("div", {
65
+ className: styles.title,
66
+ children: title
67
+ })
68
+ }), description && /*#__PURE__*/_jsx("div", {
69
+ className: styles.desc,
70
+ children: description
71
+ })]
72
+ }), loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
73
+ spin: true
74
+ }) : showAction ? /*#__PURE__*/_jsx(Flexbox, {
75
+ gap: 4,
76
+ horizontal: true,
77
+ onClick: function onClick(e) {
78
+ e.stopPropagation();
79
+ },
80
+ style: {
81
+ display: showAction ? undefined : 'none'
82
+ },
83
+ children: renderActions
84
+ }) : date && /*#__PURE__*/_jsx("div", {
85
+ className: cx(styles.time, classNames.time),
86
+ children: getChatItemTime(date)
87
+ }), children]
88
+ })
88
89
  }));
89
90
  }));
90
91
  export default ListItem;
@@ -3,7 +3,7 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
3
3
  container: import("antd-style").SerializedStyles;
4
4
  content: import("antd-style").SerializedStyles;
5
5
  desc: import("antd-style").SerializedStyles;
6
- textOverlay: import("antd-style").SerializedStyles;
6
+ inner: import("antd-style").SerializedStyles;
7
7
  time: import("antd-style").SerializedStyles;
8
8
  title: import("antd-style").SerializedStyles;
9
9
  }>;
@@ -1,21 +1,16 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
3
  import { createStyles } from 'antd-style';
4
- import { convertAlphaToSolid } from "../../utils/colorUtils";
5
4
  export var useStyles = createStyles(function (_ref) {
6
5
  var css = _ref.css,
7
- cx = _ref.cx,
8
6
  token = _ref.token;
9
- var textOverlay = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --overlay-background: ", ";\n\n position: absolute;\n z-index: 10;\n top: 0;\n right: 0;\n\n width: 32px;\n height: 44px;\n\n background: linear-gradient(to right, transparent, var(--overlay-background));\n "])), token.colorBgContainer);
10
- var overlayColor = convertAlphaToSolid(token.colorFillContent, token.colorBgContainer);
11
- var hoverOverlay = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", " {\n --overlay-background: ", ";\n }\n "])), cx(textOverlay), overlayColor);
12
7
  return {
13
- active: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n background: ", ";\n\n ", "\n "])), token.colorText, token.colorFillContent, hoverOverlay),
14
- container: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n\n &:hover {\n background: ", ";\n ", "\n }\n "])), token.colorTextTertiary, token.colorFillContent, hoverOverlay),
15
- content: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: 1;\n "]))),
16
- desc: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n margin-top: 2px;\n\n font-size: 12px;\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorTextDescription),
17
- textOverlay: textOverlay,
18
- time: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n "])), token.colorTextPlaceholder),
19
- title: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n\n font-size: 16px;\n text-overflow: ellipsis;\n white-space: nowrap;\n "])))
8
+ active: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), token.colorText, token.colorFillTertiary, token.colorFill),
9
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n transition: background-color 200ms ", ";\n\n &:active {\n background-color: ", " !important;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), token.colorTextTertiary, token.motionEaseOut, token.colorFill, token.colorFillSecondary),
10
+ content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: 1;\n "]))),
11
+ desc: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n margin-top: 2px;\n\n font-size: 12px;\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorTextDescription),
12
+ inner: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n transition: scale 400ms ", ";\n\n &:active {\n scale: 0.95;\n }\n "])), token.motionEaseOut),
13
+ time: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n "])), token.colorTextPlaceholder),
14
+ title: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n\n font-size: 16px;\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorText)
20
15
  };
21
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.57.0",
3
+ "version": "1.59.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",