@lobehub/ui 1.90.0 → 1.92.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.
@@ -4,7 +4,7 @@ var _excluded = ["className", "avatar", "title", "animation", "size", "shape", "
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 { Avatar as AntAvatar } from 'antd';
7
- import { memo } from 'react';
7
+ import { memo, useMemo } from 'react';
8
8
  import FluentEmoji from "../FluentEmoji";
9
9
  import { getEmoji } from "../utils/getEmojiByCharacter";
10
10
  import { useStyles } from "./style";
@@ -24,7 +24,9 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
24
24
  var isImage = Boolean(avatar && ['/', 'http', 'data:'].some(function (index) {
25
25
  return avatar.startsWith(index);
26
26
  }));
27
- var emoji = avatar && !isImage && getEmoji(avatar);
27
+ var emoji = useMemo(function () {
28
+ return avatar && !isImage && getEmoji(avatar);
29
+ }, [avatar]);
28
30
  var _useStyles = useStyles({
29
31
  background: background,
30
32
  isEmoji: Boolean(emoji),
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "..";
3
+ export interface EmptyCardProps extends DivProps {
4
+ alt?: string;
5
+ cover?: string;
6
+ defaultVisible?: boolean;
7
+ desc: string;
8
+ height?: number;
9
+ onVisibleChange?: (visible: boolean) => void;
10
+ title: string;
11
+ visible?: boolean;
12
+ width?: number;
13
+ }
14
+ declare const EmptyCard: import("react").NamedExoticComponent<EmptyCardProps>;
15
+ export default EmptyCard;
@@ -0,0 +1,67 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["cover", "visible", "defaultVisible", "onVisibleChange", "alt", "title", "desc", "width", "height"];
5
+ 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; }
6
+ 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; }
7
+ import { ActionIcon } from "./..";
8
+ import { X } from 'lucide-react';
9
+ import { memo } from 'react';
10
+ import { Flexbox } from 'react-layout-kit';
11
+ import useMergeState from 'use-merge-value';
12
+ import { useStyles } from "./style";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ var EmptyCard = /*#__PURE__*/memo(function (_ref) {
16
+ var cover = _ref.cover,
17
+ visible = _ref.visible,
18
+ defaultVisible = _ref.defaultVisible,
19
+ onVisibleChange = _ref.onVisibleChange,
20
+ alt = _ref.alt,
21
+ title = _ref.title,
22
+ desc = _ref.desc,
23
+ width = _ref.width,
24
+ height = _ref.height,
25
+ props = _objectWithoutProperties(_ref, _excluded);
26
+ var _useMergeState = useMergeState(true, {
27
+ defaultValue: defaultVisible,
28
+ onChange: onVisibleChange,
29
+ value: visible
30
+ }),
31
+ _useMergeState2 = _slicedToArray(_useMergeState, 2),
32
+ value = _useMergeState2[0],
33
+ setValue = _useMergeState2[1];
34
+ var _useStyles = useStyles(),
35
+ styles = _useStyles.styles;
36
+ if (!value) return null;
37
+ return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
38
+ className: styles.container
39
+ }, props), {}, {
40
+ children: [/*#__PURE__*/_jsx(ActionIcon, {
41
+ className: styles.close,
42
+ icon: X,
43
+ onClick: function onClick() {
44
+ return setValue(false);
45
+ },
46
+ size: {
47
+ blockSize: 24,
48
+ fontSize: 16
49
+ }
50
+ }), cover && /*#__PURE__*/_jsx("img", {
51
+ alt: alt,
52
+ className: styles.image,
53
+ height: height,
54
+ src: cover,
55
+ width: width
56
+ }), /*#__PURE__*/_jsxs("div", {
57
+ className: styles.content,
58
+ children: [title && /*#__PURE__*/_jsx("h3", {
59
+ children: title
60
+ }), desc && /*#__PURE__*/_jsx("p", {
61
+ className: styles.desc,
62
+ children: desc
63
+ })]
64
+ })]
65
+ }));
66
+ });
67
+ export default EmptyCard;
@@ -0,0 +1,7 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ close: import("antd-style").SerializedStyles;
3
+ container: import("antd-style").SerializedStyles;
4
+ content: import("antd-style").SerializedStyles;
5
+ desc: import("antd-style").SerializedStyles;
6
+ image: import("antd-style").SerializedStyles;
7
+ }>;
@@ -0,0 +1,15 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token,
7
+ isDarkMode = _ref.isDarkMode;
8
+ return {
9
+ close: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 8px;\n right: 8px;\n "]))),
10
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n background: linear-gradient(\n to bottom,\n ", ",\n ", "\n );\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), isDarkMode ? token.colorBgElevated : token.colorBgLayout, token.colorBgContainer, token.colorBorderSecondary, token.borderRadius),
11
+ content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0 16px 16px;\n "]))),
12
+ desc: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextDescription),
13
+ image: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n align-self: center;\n "])))
14
+ };
15
+ });
@@ -56,10 +56,7 @@ var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
56
56
  }
57
57
  }
58
58
  }, [type, emoji]);
59
- var isFallback = useMemo(function () {
60
- return type === 'pure' || !emojiUrl || loadingFail;
61
- }, []);
62
- if (isFallback) return /*#__PURE__*/_jsx("div", {
59
+ if (type === 'pure' || !emojiUrl || loadingFail) return /*#__PURE__*/_jsx("div", {
63
60
  className: cx(styles.container, className),
64
61
  style: _objectSpread({
65
62
  fontSize: size * 0.9,
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { type InputProps } from "../Input";
3
3
  export interface SearchBarProps extends InputProps {
4
+ defaultValue?: string;
4
5
  /**
5
6
  * @description Whether to enable the shortcut key to focus on the input
6
7
  * @default false
7
8
  */
8
9
  enableShortKey?: boolean;
10
+ onInputChange?: (value: string) => void;
9
11
  /**
10
12
  * @description The shortcut key to focus on the input. Only works if `enableShortKey` is true
11
13
  * @default 'f'
@@ -16,6 +18,7 @@ export interface SearchBarProps extends InputProps {
16
18
  * @default false
17
19
  */
18
20
  spotlight?: boolean;
21
+ value?: string;
19
22
  }
20
23
  declare const SearchBar: import("react").NamedExoticComponent<SearchBarProps>;
21
24
  export default SearchBar;
@@ -1,11 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["spotlight", "className", "value", "onChange", "placeholder", "enableShortKey", "shortKey"];
4
+ var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChange", "placeholder", "enableShortKey", "shortKey"];
5
5
  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; }
6
6
  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; }
7
7
  import { Search } from 'lucide-react';
8
8
  import { memo, useEffect, useRef, useState } from 'react';
9
+ import useControlledState from 'use-merge-value';
9
10
  import Icon from "../Icon";
10
11
  import { Input } from "../Input";
11
12
  import Spotlight from "../Spotlight";
@@ -14,15 +15,24 @@ import { useStyles } from "./style";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
17
  var SearchBar = /*#__PURE__*/memo(function (_ref) {
17
- var spotlight = _ref.spotlight,
18
+ var defaultValue = _ref.defaultValue,
19
+ spotlight = _ref.spotlight,
18
20
  className = _ref.className,
19
21
  value = _ref.value,
20
- _onChange = _ref.onChange,
22
+ onInputChange = _ref.onInputChange,
21
23
  placeholder = _ref.placeholder,
22
24
  enableShortKey = _ref.enableShortKey,
23
25
  _ref$shortKey = _ref.shortKey,
24
26
  shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
25
27
  properties = _objectWithoutProperties(_ref, _excluded);
28
+ var _useControlledState = useControlledState(defaultValue, {
29
+ defaultValue: defaultValue,
30
+ onChange: onInputChange,
31
+ value: value
32
+ }),
33
+ _useControlledState2 = _slicedToArray(_useControlledState, 2),
34
+ inputValue = _useControlledState2[0],
35
+ setInputValue = _useControlledState2[1];
26
36
  var _useState = useState('Ctrl'),
27
37
  _useState2 = _slicedToArray(_useState, 2),
28
38
  symbol = _useState2[0],
@@ -31,10 +41,6 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
31
41
  _useState4 = _slicedToArray(_useState3, 2),
32
42
  showTag = _useState4[0],
33
43
  setShowTag = _useState4[1];
34
- var _useState5 = useState(value),
35
- _useState6 = _slicedToArray(_useState5, 2),
36
- inputValue = _useState6[0],
37
- setInputValue = _useState6[1];
38
44
  var _useStyles = useStyles(),
39
45
  styles = _useStyles.styles,
40
46
  cx = _useStyles.cx;
@@ -69,7 +75,6 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
69
75
  onChange: function onChange(e) {
70
76
  setInputValue(e.target.value);
71
77
  setShowTag(!e.target.value);
72
- if (_onChange) _onChange(e);
73
78
  },
74
79
  onFocus: function onFocus() {
75
80
  return setShowTag(false);
@@ -0,0 +1,27 @@
1
+ import { IconProps } from "..";
2
+ import { SelectProps } from 'antd';
3
+ import { type CSSProperties, ReactNode } from 'react';
4
+ export interface SelectWithImgOptionItem {
5
+ icon?: IconProps['icon'];
6
+ img: string;
7
+ label: ReactNode;
8
+ value: string;
9
+ }
10
+ export interface SelectWithImgProps {
11
+ className?: string;
12
+ classNames?: {
13
+ img?: string;
14
+ };
15
+ defaultValue?: SelectProps['defaultValue'];
16
+ height?: number;
17
+ onChange?: (value: this['value']) => void;
18
+ options?: SelectWithImgOptionItem[];
19
+ style?: CSSProperties;
20
+ styles?: {
21
+ img?: CSSProperties;
22
+ };
23
+ value?: SelectProps['value'];
24
+ width?: number;
25
+ }
26
+ declare const SelectWithImg: import("react").NamedExoticComponent<SelectWithImgProps>;
27
+ export default SelectWithImg;
@@ -0,0 +1,78 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ 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; }
4
+ 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; }
5
+ import { Icon } from "./..";
6
+ import { memo } from 'react';
7
+ import { Flexbox } from 'react-layout-kit';
8
+ import useControlledState from 'use-merge-value';
9
+ import { useStyles } from "./styles";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var SelectWithImg = /*#__PURE__*/memo(function (_ref) {
13
+ var className = _ref.className,
14
+ style = _ref.style,
15
+ value = _ref.value,
16
+ defaultValue = _ref.defaultValue,
17
+ onChange = _ref.onChange,
18
+ options = _ref.options,
19
+ _ref$width = _ref.width,
20
+ width = _ref$width === void 0 ? 144 : _ref$width,
21
+ _ref$height = _ref.height,
22
+ height = _ref$height === void 0 ? 86 : _ref$height,
23
+ _ref$styles = _ref.styles,
24
+ outStyles = _ref$styles === void 0 ? {} : _ref$styles,
25
+ _ref$classNames = _ref.classNames,
26
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames;
27
+ var _useControlledState = useControlledState(defaultValue, {
28
+ defaultValue: defaultValue,
29
+ onChange: onChange,
30
+ value: value
31
+ }),
32
+ _useControlledState2 = _slicedToArray(_useControlledState, 2),
33
+ currentValue = _useControlledState2[0],
34
+ setCurrentValue = _useControlledState2[1];
35
+ var _useStyles = useStyles(),
36
+ styles = _useStyles.styles,
37
+ cx = _useStyles.cx;
38
+ return /*#__PURE__*/_jsx(Flexbox, {
39
+ className: className,
40
+ gap: 16,
41
+ horizontal: true,
42
+ style: style,
43
+ children: options === null || options === void 0 ? void 0 : options.map(function (item) {
44
+ var isActive = item.value === currentValue;
45
+ return /*#__PURE__*/_jsxs(Flexbox, {
46
+ align: 'center',
47
+ className: cx(styles.container, isActive && styles.active),
48
+ gap: 4,
49
+ onClick: function onClick() {
50
+ return setCurrentValue(item.value);
51
+ },
52
+ children: [/*#__PURE__*/_jsx("div", {
53
+ className: cx(styles.imgCtn, isActive && styles.imgActive, classNames.img),
54
+ style: _objectSpread(_objectSpread({}, outStyles.img), {}, {
55
+ height: height,
56
+ width: width
57
+ }),
58
+ children: /*#__PURE__*/_jsx("div", {
59
+ className: styles.img,
60
+ style: {
61
+ backgroundImage: "url(".concat(item.img, ")"),
62
+ height: height,
63
+ width: width
64
+ }
65
+ })
66
+ }), /*#__PURE__*/_jsxs(Flexbox, {
67
+ align: 'center',
68
+ gap: 4,
69
+ horizontal: true,
70
+ children: [item.icon && /*#__PURE__*/_jsx(Icon, {
71
+ icon: item.icon
72
+ }), item.label]
73
+ })]
74
+ }, item.value);
75
+ })
76
+ });
77
+ });
78
+ export default SelectWithImg;
@@ -0,0 +1,7 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ active: import("antd-style").SerializedStyles;
3
+ container: import("antd-style").SerializedStyles;
4
+ img: string;
5
+ imgActive: import("antd-style").SerializedStyles;
6
+ imgCtn: import("antd-style").SerializedStyles;
7
+ }>;
@@ -0,0 +1,17 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token,
7
+ cx = _ref.cx;
8
+ var hover = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:hover {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n "])), token.colorText, token.colorText);
9
+ var img = cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-repeat: no-repeat;\n background-position: center center;\n background-size: cover;\n border-radius: ", "px;\n box-shadow: inset 0 0 0 2px ", ";\n\n transition: all 100ms ", ";\n "])), token.borderRadius, token.colorSplit, token.motionEaseOut), hover);
10
+ return {
11
+ active: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorText),
12
+ container: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n "])), token.colorTextDescription),
13
+ img: img,
14
+ imgActive: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n box-shadow: 0 0 0 2px ", ";\n\n .", " {\n box-shadow: none;\n }\n "])), token.colorTextTertiary, img),
15
+ imgCtn: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n\n ", "\n "])), token.colorFillTertiary, token.borderRadius, hover)
16
+ };
17
+ });
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { DivProps } from "../types";
3
- declare const SpotlightCardItem: import("react").NamedExoticComponent<DivProps>;
3
+ export interface SpotlightCardItemProps extends DivProps {
4
+ borderRadius: number;
5
+ size: number;
6
+ }
7
+ declare const SpotlightCardItem: import("react").NamedExoticComponent<SpotlightCardItemProps>;
4
8
  export default SpotlightCardItem;
@@ -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 = ["children", "className"];
3
+ var _excluded = ["children", "className", "style", "borderRadius", "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 { memo } from 'react';
@@ -10,12 +10,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  var SpotlightCardItem = /*#__PURE__*/memo(function (_ref) {
11
11
  var children = _ref.children,
12
12
  className = _ref.className,
13
+ style = _ref.style,
14
+ borderRadius = _ref.borderRadius,
15
+ size = _ref.size,
13
16
  props = _objectWithoutProperties(_ref, _excluded);
14
- var _useStyles = useStyles(),
17
+ var _useStyles = useStyles({
18
+ borderRadius: borderRadius,
19
+ size: size
20
+ }),
15
21
  styles = _useStyles.styles,
16
22
  cx = _useStyles.cx;
17
23
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
18
- className: cx(className, styles.itemContainer)
24
+ className: cx(className, styles.itemContainer),
25
+ style: _objectSpread({
26
+ borderRadius: borderRadius
27
+ }, style)
19
28
  }, props), {}, {
20
29
  children: /*#__PURE__*/_jsx(Flexbox, {
21
30
  className: styles.content,
@@ -1,10 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DivProps } from "../types";
3
3
  export interface SpotlightCardProps<T = any> extends DivProps {
4
- columns?: string;
4
+ borderRadius?: number;
5
+ columns?: string | number;
5
6
  gap?: number;
6
7
  items: T[];
7
8
  renderItem: (item: T) => ReactNode;
9
+ size?: number;
8
10
  }
9
11
  declare const SpotlightCard: import("react").NamedExoticComponent<SpotlightCardProps<any>>;
10
12
  export default SpotlightCard;
@@ -1,12 +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 = ["items", "renderItem", "className", "columns", "gap", "style"];
3
+ var _excluded = ["items", "renderItem", "className", "columns", "gap", "style", "size", "borderRadius"];
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
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
7
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
8
  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; }
9
- import { memo, useEffect, useRef } from 'react';
9
+ import { isNumber } from 'lodash-es';
10
+ import { memo, useEffect, useMemo, useRef } from 'react';
10
11
  import SpotlightCardItem from "./SpotlightCardItem";
11
12
  import { CHILDREN_CLASSNAME, useStyles } from "./style";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -15,15 +16,27 @@ var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
15
16
  renderItem = _ref.renderItem,
16
17
  className = _ref.className,
17
18
  _ref$columns = _ref.columns,
18
- columns = _ref$columns === void 0 ? '1fr 1fr 1fr' : _ref$columns,
19
+ columns = _ref$columns === void 0 ? 3 : _ref$columns,
19
20
  _ref$gap = _ref.gap,
20
21
  gap = _ref$gap === void 0 ? 12 : _ref$gap,
21
22
  style = _ref.style,
23
+ _ref$size = _ref.size,
24
+ size = _ref$size === void 0 ? 800 : _ref$size,
25
+ _ref$borderRadius = _ref.borderRadius,
26
+ borderRadius = _ref$borderRadius === void 0 ? 12 : _ref$borderRadius,
22
27
  props = _objectWithoutProperties(_ref, _excluded);
23
- var _useStyles = useStyles(),
28
+ var _useStyles = useStyles({
29
+ borderRadius: borderRadius,
30
+ size: size
31
+ }),
24
32
  styles = _useStyles.styles,
25
33
  cx = _useStyles.cx;
26
34
  var ref = useRef(null);
35
+ var gridColumns = useMemo(function () {
36
+ return isNumber(columns) ? Array.from({
37
+ length: columns
38
+ }).fill('1fr').join(' ') : columns;
39
+ }, [columns]);
27
40
  useEffect(function () {
28
41
  if (!ref.current) return;
29
42
  var fn = function fn(e) {
@@ -55,13 +68,15 @@ var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
55
68
  ref: ref,
56
69
  style: _objectSpread({
57
70
  gap: gap,
58
- gridTemplateColumns: columns
71
+ gridTemplateColumns: gridColumns
59
72
  }, style)
60
73
  }, props), {}, {
61
74
  children: items.map(function (item, index) {
62
75
  var children = renderItem(item);
63
76
  return /*#__PURE__*/_jsx(SpotlightCardItem, {
77
+ borderRadius: borderRadius,
64
78
  className: CHILDREN_CLASSNAME,
79
+ size: size,
65
80
  children: children
66
81
  }, index);
67
82
  })
@@ -1,5 +1,8 @@
1
1
  export declare const CHILDREN_CLASSNAME = "hover-card";
2
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ export declare const useStyles: (props?: {
3
+ borderRadius: number;
4
+ size: number;
5
+ } | undefined) => import("antd-style").ReturnStyles<{
3
6
  container: import("antd-style").SerializedStyles;
4
7
  content: import("antd-style").SerializedStyles;
5
8
  grid: import("antd-style").SerializedStyles;
@@ -2,17 +2,18 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
3
  import { createStyles } from 'antd-style';
4
4
  import { rgba } from 'polished';
5
- var BORDER_RADIUS = 12;
6
5
  export var CHILDREN_CLASSNAME = 'hover-card';
7
- export var useStyles = createStyles(function (_ref) {
6
+ export var useStyles = createStyles(function (_ref, _ref2) {
8
7
  var css = _ref.css,
9
8
  responsive = _ref.responsive,
10
9
  token = _ref.token,
11
10
  isDarkMode = _ref.isDarkMode;
11
+ var size = _ref2.size,
12
+ borderRadius = _ref2.borderRadius;
12
13
  return {
13
- container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:hover > .", "::after {\n opacity: 1;\n }\n "])), CHILDREN_CLASSNAME),
14
- content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 2;\n\n flex-grow: 1;\n\n height: 100%;\n margin: 1px;\n\n background: ", ";\n border-radius: ", "px;\n "])), token.colorBgContainer, BORDER_RADIUS - 1),
15
- grid: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: grid;\n\n ", " {\n display: flex;\n flex-direction: column;\n }\n "])), responsive.mobile),
16
- itemContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n\n background: ", ";\n border-radius: ", "px;\n\n &::before,\n &::after {\n content: '';\n\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n\n opacity: 0;\n border-radius: inherit;\n\n transition: opacity 500ms;\n }\n\n &::before {\n pointer-events: none;\n user-select: none;\n z-index: 3;\n background: radial-gradient(\n 800px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n &::after {\n z-index: 1;\n background: radial-gradient(\n 600px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n :hover::before {\n opacity: 1;\n }\n "])), rgba(token.colorBorder, 0.5), BORDER_RADIUS, rgba(token.colorTextBase, isDarkMode ? 0.06 : 0.02), rgba(token.colorTextBase, isDarkMode ? 0.4 : 0.2))
14
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:hover > .", "::after {\n opacity: 1;\n }\n "])), CHILDREN_CLASSNAME),
15
+ content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 2;\n\n flex-grow: 1;\n\n height: 100%;\n margin: 1px;\n\n background: ", ";\n border-radius: ", "px;\n "])), token.colorBgContainer, borderRadius - 1),
16
+ grid: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: grid;\n\n ", " {\n display: flex;\n flex-direction: column;\n }\n "])), responsive.mobile),
17
+ itemContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n\n background: ", ";\n border-radius: ", "px;\n\n &::before,\n &::after {\n content: '';\n\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 100%;\n\n opacity: 0;\n border-radius: inherit;\n\n transition: opacity 500ms;\n }\n\n &::before {\n pointer-events: none;\n user-select: none;\n z-index: 3;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n &::after {\n z-index: 1;\n background: radial-gradient(\n ", "px circle at var(--mouse-x) var(--mouse-y),\n ", ",\n transparent 40%\n );\n }\n\n :hover::before {\n opacity: 1;\n }\n "])), rgba(token.colorBorder, 0.5), borderRadius, size, rgba(token.colorTextBase, isDarkMode ? 0.06 : 0.02), size * 0.75, rgba(token.colorTextBase, isDarkMode ? 0.4 : 0.2))
17
18
  };
18
19
  });
package/es/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { default as DraggablePanelHeader, type DraggablePanelHeaderProps, } from
21
21
  export { default as EditableMessage, type EditableMessageProps } from './EditableMessage';
22
22
  export { default as EditableMessageList, type EditableMessageListProps, } from './EditableMessageList';
23
23
  export { default as EditableText, type EditableTextProps } from './EditableText';
24
+ export { default as EmptyCard, type EmptyCardProps } from './EmptyCard';
24
25
  export { type FeatureItem, default as Features, type FeaturesProps } from './Features';
25
26
  export { default as FluentEmoji, type FluentEmojiProps } from './FluentEmoji';
26
27
  export { default as FontLoader, type FontLoaderProps } from './FontLoader';
@@ -53,6 +54,7 @@ export { default as MobileNavBarTitle, type MobileNavBarTitleProps, } from './Mo
53
54
  export { default as MobileSafeArea, type MobileSafeAreaProps } from './MobileSafeArea';
54
55
  export { default as MobileTabBar, type MobileTabBarItemProps, type MobileTabBarProps, } from './MobileTabBar';
55
56
  export { default as SearchBar, type SearchBarProps } from './SearchBar';
57
+ export { default as SelectWithImg, type SelectWithImgOptionItem, type SelectWithImgProps, } from './SelectWithImg';
56
58
  export { default as SideNav, type SideNavProps } from './SideNav';
57
59
  export { default as SliderWithInput, type SliderWithInputProps } from './SliderWithInput';
58
60
  export { default as Snippet, type SnippetProps } from './Snippet';
package/es/index.js CHANGED
@@ -20,6 +20,7 @@ export { default as DraggablePanelHeader } from "./DraggablePanel/components/Dra
20
20
  export { default as EditableMessage } from "./EditableMessage";
21
21
  export { default as EditableMessageList } from "./EditableMessageList";
22
22
  export { default as EditableText } from "./EditableText";
23
+ export { default as EmptyCard } from "./EmptyCard";
23
24
  export { default as Features } from "./Features";
24
25
  export { default as FluentEmoji } from "./FluentEmoji";
25
26
  export { default as FontLoader } from "./FontLoader";
@@ -52,6 +53,7 @@ export { default as MobileNavBarTitle } from "./MobileNavBar/MobileNavBarTitle";
52
53
  export { default as MobileSafeArea } from "./MobileSafeArea";
53
54
  export { default as MobileTabBar } from "./MobileTabBar";
54
55
  export { default as SearchBar } from "./SearchBar";
56
+ export { default as SelectWithImg } from "./SelectWithImg";
55
57
  export { default as SideNav } from "./SideNav";
56
58
  export { default as SliderWithInput } from "./SliderWithInput";
57
59
  export { default as Snippet } from "./Snippet";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.90.0",
3
+ "version": "1.92.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",