@lobehub/ui 1.28.0 → 1.29.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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/es/ActionIconGroup/index.d.ts +13 -2
  3. package/es/Avatar/index.js +9 -4
  4. package/es/Burger/index.d.ts +19 -0
  5. package/es/Burger/style.js +1 -1
  6. package/es/ChatInputArea/index.d.ts +41 -0
  7. package/es/ColorScales/index.d.ts +9 -0
  8. package/es/Features/Item.d.ts +36 -2
  9. package/es/Features/index.d.ts +13 -0
  10. package/es/FluentEmoji/index.d.ts +20 -0
  11. package/es/FluentEmoji/index.js +84 -0
  12. package/es/FluentEmoji/style.d.ts +4 -0
  13. package/es/FluentEmoji/style.js +11 -0
  14. package/es/FontLoader/index.d.ts +3 -0
  15. package/es/Footer/index.d.ts +18 -4
  16. package/es/GradientButton/index.d.ts +4 -0
  17. package/es/Header/index.d.ts +27 -0
  18. package/es/Hero/index.d.ts +27 -0
  19. package/es/Input/index.d.ts +23 -4
  20. package/es/Layout/index.d.ts +31 -0
  21. package/es/Logo/index.js +9 -8
  22. package/es/Logo/style.d.ts +2 -0
  23. package/es/Logo/style.js +2 -0
  24. package/es/MessageInput/index.d.ts +15 -15
  25. package/es/MessageInput/index.js +0 -6
  26. package/es/ThemeProvider/GlobalStyle.js +1 -1
  27. package/es/ThemeProvider/index.d.ts +4 -0
  28. package/es/ThemeProvider/index.js +28 -25
  29. package/es/Toc/TocMobile.d.ts +30 -0
  30. package/es/Toc/index.d.ts +4 -0
  31. package/es/TokenTag/index.d.ts +6 -0
  32. package/es/TokenTag/index.js +5 -4
  33. package/es/TokenTag/style.d.ts +1 -1
  34. package/es/TokenTag/style.js +3 -4
  35. package/es/components/ControlInput.d.ts +12 -0
  36. package/es/hooks/useHighlight.d.ts +8 -8
  37. package/es/index.d.ts +1 -0
  38. package/es/index.js +1 -0
  39. package/es/styles/theme/base.js +1 -1
  40. package/es/utils/getEmojiByCharacter.d.ts +2 -0
  41. package/es/utils/getEmojiByCharacter.js +15 -0
  42. package/package.json +3 -1
  43. package/es/Logo/LogoFlat.d.ts +0 -3
  44. package/es/Logo/LogoFlat.js +0 -105
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- <img width="160" src="https://npm.elemecdn.com/@lobehub/assets/logo/logo-3d.webp">
5
+ <img width="160" src="https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp">
6
6
 
7
7
  <h1>Lobe UI</h1>
8
8
 
@@ -3,8 +3,19 @@ import { ActionIconProps } from "..";
3
3
  import { type MenuProps } from 'antd';
4
4
  import { DivProps } from "../types";
5
5
  export interface ActionIconGroupProps extends DivProps {
6
+ /**
7
+ * @description The direction of the icons
8
+ * @default "row"
9
+ */
6
10
  direction?: 'row' | 'column';
11
+ /**
12
+ * @description The menu items for the dropdown
13
+ */
7
14
  dropdownMenu?: MenuProps['items'];
15
+ /**
16
+ * @description The items to be rendered
17
+ * @default []
18
+ */
8
19
  items?: ActionIconProps[];
9
20
  /**
10
21
  * @description The position of the tooltip relative to the target
@@ -12,13 +23,13 @@ export interface ActionIconGroupProps extends DivProps {
12
23
  */
13
24
  placement?: ActionIconProps['placement'];
14
25
  /**
15
- * @description Whether add spotlight background
26
+ * @description Whether to add a spotlight background
16
27
  * @default true
17
28
  */
18
29
  spotlight?: boolean;
19
30
  /**
20
31
  * @description The type of the group
21
- * @default 'block'
32
+ * @default "block"
22
33
  */
23
34
  type?: 'ghost' | 'block' | 'pure';
24
35
  }
@@ -5,6 +5,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
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
7
  import { memo } from 'react';
8
+ import FluentEmoji from "../FluentEmoji";
9
+ import { getEmoji } from "../utils/getEmojiByCharacter";
8
10
  import { useStyles } from "./style";
9
11
  import { jsx as _jsx } from "react/jsx-runtime";
10
12
  var Avatar = /*#__PURE__*/memo(function (_ref) {
@@ -20,15 +22,15 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
20
22
  var isImage = Boolean(avatar && ['/', 'http', 'data:'].some(function (index) {
21
23
  return avatar.startsWith(index);
22
24
  }));
23
- var isEmoji = Boolean(avatar && !isImage && /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g.test(avatar));
25
+ var emoji = avatar && !isImage && getEmoji(avatar);
24
26
  var _useStyles = useStyles({
25
27
  background: background,
26
- isEmoji: isEmoji,
28
+ isEmoji: Boolean(emoji),
27
29
  size: size
28
30
  }),
29
31
  styles = _useStyles.styles,
30
32
  cx = _useStyles.cx;
31
- var text = isImage ? title : avatar;
33
+ var text = String(isImage ? title : avatar);
32
34
  return isImage ? /*#__PURE__*/_jsx(AntAvatar, _objectSpread({
33
35
  className: cx(styles.avatar, className),
34
36
  shape: shape,
@@ -39,7 +41,10 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
39
41
  shape: shape,
40
42
  size: size
41
43
  }, props), {}, {
42
- children: isEmoji ? text : text === null || text === void 0 ? void 0 : text.toUpperCase().slice(0, 2)
44
+ children: emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
45
+ emoji: emoji,
46
+ size: size
47
+ }) : text === null || text === void 0 ? void 0 : text.toUpperCase().slice(0, 2)
43
48
  }));
44
49
  });
45
50
  export default Avatar;
@@ -2,11 +2,30 @@
2
2
  import { MenuProps } from 'antd';
3
3
  import { DivProps } from "../types";
4
4
  export interface BurgerProps extends DivProps {
5
+ /**
6
+ * @description The height of the header component
7
+ * @default 64
8
+ */
5
9
  headerHeight?: number;
10
+ /**
11
+ * @description The items to be displayed in the menu
12
+ */
6
13
  items: MenuProps['items'];
14
+ /**
15
+ * @description The keys of the currently open sub-menus
16
+ */
7
17
  openKeys?: MenuProps['openKeys'];
18
+ /**
19
+ * @description Whether the menu is currently open or not
20
+ */
8
21
  opened: boolean;
22
+ /**
23
+ * @description The keys of the currently selected menu items
24
+ */
9
25
  selectedKeys?: MenuProps['selectedKeys'];
26
+ /**
27
+ * @description A callback function to set the opened state
28
+ */
10
29
  setOpened: (state: boolean) => void;
11
30
  }
12
31
  declare const Burger: import("react").NamedExoticComponent<BurgerProps>;
@@ -11,6 +11,6 @@ export var useStyles = createStyles(function (_ref, headerHeight) {
11
11
  drawer: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.ant-drawer-content {\n background: transparent;\n }\n\n .ant-drawer-body {\n display: flex;\n flex-direction: column;\n }\n "]))),
12
12
  drawerRoot: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n top: ", "px;\n\n :focus-visible {\n outline: none;\n }\n\n .ant-drawer {\n &-mask {\n ", ";\n background-color: ", ";\n }\n\n &-content-wrapper {\n box-shadow: none;\n }\n }\n "])), headerHeight + 1, stylish.blur, rgba(token.colorBgLayout, 0.5)),
13
13
  fillRect: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 1;\n width: 100%;\n border-top: none;\n "]))),
14
- menu: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: transparent;\n border-inline-end: transparent !important;\n\n > .ant-menu-item-only-child,\n .ant-menu-submenu-title {\n width: 100%;\n margin: 0 !important;\n border-top: none;\n border-radius: 0;\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n }\n\n .ant-menu-item-only-child:first-child {\n border-top: none;\n }\n\n .ant-menu-submenu-title[aria-expanded='true'] {\n a {\n font-weight: 600;\n color: ", " !important;\n }\n }\n\n .ant-menu-item-group-title {\n padding-top: 4px;\n padding-bottom: 4px;\n\n font-size: 12px;\n font-weight: 500;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n\n background: ", ";\n }\n\n .ant-menu-item {\n width: calc(100% - 16px) !important;\n margin: 8px !important;\n border-radius: ", "px;\n\n &:hover,\n &:active {\n color: ", " !important;\n background: ", " !important;\n }\n }\n\n .ant-menu-item-active {\n width: calc(100% - 16px) !important;\n margin: 8px !important;\n background: ", ";\n border-radius: ", "px;\n }\n\n .ant-menu-item-selected {\n font-weight: 600;\n color: ", ";\n background: ", ";\n\n &:hover,\n &:active {\n color: ", " !important;\n background: ", " !important;\n }\n }\n "])), token.colorText, token.colorFill, token.colorText, token.colorFillSecondary, token.borderRadius, token.colorText, token.colorFillSecondary, token.colorFillSecondary, token.borderRadius, token.colorBgLayout, token.colorText, token.colorBgLayout, token.colorText)
14
+ menu: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: transparent;\n border-inline-end: transparent !important;\n\n > .ant-menu-item-only-child,\n .ant-menu-submenu-title {\n width: 100%;\n margin: 0 !important;\n border-top: none;\n border-radius: 0;\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n }\n\n .ant-menu-item-only-child:first-child {\n border-top: none;\n }\n\n .ant-menu-submenu-title[aria-expanded='true'] {\n a {\n font-weight: 600;\n color: ", " !important;\n }\n }\n\n .ant-menu-item-group-title {\n padding-top: 8px;\n padding-bottom: 8px;\n\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n\n background: ", ";\n }\n\n .ant-menu-item {\n width: calc(100% - 16px) !important;\n margin: 8px !important;\n border-radius: ", "px;\n\n &:hover,\n &:active {\n color: ", " !important;\n background: ", " !important;\n }\n }\n\n .ant-menu-item-active {\n width: calc(100% - 16px) !important;\n margin: 8px !important;\n background: ", ";\n border-radius: ", "px;\n }\n\n .ant-menu-item-selected {\n font-weight: 600;\n color: ", ";\n background: ", ";\n\n &:hover,\n &:active {\n color: ", " !important;\n background: ", " !important;\n }\n }\n "])), token.colorText, token.colorFill, token.colorText, token.colorFillSecondary, token.borderRadius, token.colorText, token.colorFillSecondary, token.colorFillSecondary, token.borderRadius, token.colorBgLayout, token.colorText, token.colorBgLayout, token.colorText)
15
15
  };
16
16
  });
@@ -1,16 +1,57 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { DivProps } from "../types";
3
3
  export interface ChatInputAreaProps extends DivProps {
4
+ /**
5
+ * @description Actions to be displayed in the left of actions bar
6
+ */
4
7
  actions?: ReactNode;
8
+ /**
9
+ * @description Default value of the input
10
+ */
5
11
  defaultValue?: string;
12
+ /**
13
+ * @description Whether the input is disabled or not
14
+ * @default false
15
+ */
6
16
  disabled?: boolean;
17
+ /**
18
+ * @description Whether the input is expanded or not
19
+ * @default false
20
+ */
7
21
  expand?: boolean;
22
+ /**
23
+ * @description Footer to be displayed below input area
24
+ */
8
25
  footer?: ReactNode;
26
+ /**
27
+ * @description Whether the input is in loading state or not
28
+ * @default false
29
+ */
9
30
  loading?: boolean;
31
+ /**
32
+ * @description Minimum height of the input area
33
+ * @default 200
34
+ */
10
35
  minHeight?: number;
36
+ /**
37
+ * @description Callback function when the expand state changes
38
+ * @param expand - Whether the input is expanded or not
39
+ */
11
40
  onExpandChange?: (expand: boolean) => void;
41
+ /**
42
+ * @description Callback function when the input value changes
43
+ * @param value - The current value of the input
44
+ */
12
45
  onInputChange?: (value: string) => void;
46
+ /**
47
+ * @description Callback function when the send button is clicked
48
+ * @param value - The current value of the input
49
+ */
13
50
  onSend?: (value: string) => void;
51
+ /**
52
+ * @description Placeholder text of the input
53
+ * @default 'Type something to chat...'
54
+ */
14
55
  placeholder?: string;
15
56
  }
16
57
  declare const ChatInputArea: import("react").NamedExoticComponent<ChatInputAreaProps>;
@@ -1,8 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorScaleItem } from "../styles/colors";
3
3
  export interface ColorScalesProps {
4
+ /**
5
+ * @description Index of the mid highlight color in the scale
6
+ */
4
7
  midHighLight: number;
8
+ /**
9
+ * @description Name of the color scale
10
+ */
5
11
  name: string;
12
+ /**
13
+ * @description Color scale item object
14
+ */
6
15
  scale: ColorScaleItem;
7
16
  }
8
17
  declare const ColorScales: import("react").NamedExoticComponent<ColorScalesProps>;
@@ -1,17 +1,51 @@
1
- import { ImageContainerType } from 'dumi-theme-lobehub/src';
2
1
  import { CSSProperties } from 'react';
3
2
  import type { DivProps } from "../types";
4
3
  export interface FeatureItem {
4
+ /**
5
+ * @description The number of columns the item spans.
6
+ */
5
7
  column?: number;
8
+ /**
9
+ * @description The description of the feature item.
10
+ */
6
11
  description?: string;
12
+ /**
13
+ * @description Whether this item is a hero item.
14
+ */
7
15
  hero?: boolean;
16
+ /**
17
+ * @description The name of the icon to display on the feature item.
18
+ */
8
19
  icon?: string;
20
+ /**
21
+ * @description The URL of the image to display on the feature item.
22
+ */
9
23
  image?: string;
24
+ /**
25
+ * @description The CSS style of the image to display on the feature item.
26
+ */
10
27
  imageStyle?: CSSProperties;
11
- imageType?: ImageContainerType;
28
+ /**
29
+ * @description The type of the image to display on the feature item.
30
+ * @default 'normal'
31
+ */
32
+ imageType?: 'light' | 'primary' | 'soon';
33
+ /**
34
+ * @description The link to navigate to when clicking on the feature item.
35
+ */
12
36
  link?: string;
37
+ /**
38
+ * @description Whether to open the link in a new tab when clicking on the feature item.
39
+ * @default false
40
+ */
13
41
  openExternal?: boolean;
42
+ /**
43
+ * @description The number of rows the item spans.
44
+ */
14
45
  row?: number;
46
+ /**
47
+ * @description The title of the feature item.
48
+ */
15
49
  title: string;
16
50
  }
17
51
  export interface FeatureItemProps extends FeatureItem, DivProps {
@@ -3,9 +3,22 @@ import { DivProps } from "../types";
3
3
  import { type FeatureItem } from './Item';
4
4
  export type { FeatureItem } from './Item';
5
5
  export interface FeaturesProps extends DivProps {
6
+ /**
7
+ * @description The maximum width of the content
8
+ * @default 960
9
+ */
6
10
  contentMaxWidth?: number;
11
+ /**
12
+ * @description The class name of the item
13
+ */
7
14
  itemClassName?: string;
15
+ /**
16
+ * @description The style of the item
17
+ */
8
18
  itemStyle?: CSSProperties;
19
+ /**
20
+ * @description The array of feature items
21
+ */
9
22
  items: FeatureItem[];
10
23
  }
11
24
  declare const Features: import("react").NamedExoticComponent<FeaturesProps>;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ export interface FluentEmojiProps extends DivProps {
4
+ /**
5
+ * @description The emoji character to be rendered
6
+ */
7
+ emoji: string;
8
+ /**
9
+ * @description Size of the emoji
10
+ * @default 40
11
+ */
12
+ size?: number;
13
+ /**
14
+ * @description The type of the FluentUI emoji set to be used
15
+ * @default 'modern'
16
+ */
17
+ type?: 'modern' | 'flat' | 'high-contrast';
18
+ }
19
+ declare const FluentEmoji: import("react").NamedExoticComponent<FluentEmojiProps>;
20
+ export default FluentEmoji;
@@ -0,0 +1,84 @@
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 = ["emoji", "className", "style", "type", "size"];
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 { kebabCase } from 'lodash-es';
8
+ import { Loader2 } from 'lucide-react';
9
+ import { memo, useEffect, useMemo, useState } from 'react';
10
+ import Icon from "../Icon";
11
+ import { getEmojiNameByCharacter } from "../utils/getEmojiByCharacter";
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 FluentEmoji = /*#__PURE__*/memo(function (_ref) {
16
+ var emoji = _ref.emoji,
17
+ className = _ref.className,
18
+ style = _ref.style,
19
+ _ref$type = _ref.type,
20
+ type = _ref$type === void 0 ? 'modern' : _ref$type,
21
+ _ref$size = _ref.size,
22
+ size = _ref$size === void 0 ? 40 : _ref$size,
23
+ props = _objectWithoutProperties(_ref, _excluded);
24
+ var _useState = useState(true),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ loading = _useState2[0],
27
+ setLoading = _useState2[1];
28
+ var _useState3 = useState(false),
29
+ _useState4 = _slicedToArray(_useState3, 2),
30
+ loadingFail = _useState4[0],
31
+ setLoadingFail = _useState4[1];
32
+ var _useStyles = useStyles(),
33
+ cx = _useStyles.cx,
34
+ styles = _useStyles.styles;
35
+ useEffect(function () {
36
+ setLoading(true);
37
+ }, [emoji]);
38
+ var emojiName = useMemo(function () {
39
+ return getEmojiNameByCharacter(emoji);
40
+ }, [emoji]);
41
+ if (!emojiName || loadingFail) return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
42
+ className: cx(styles.container, className),
43
+ style: _objectSpread({
44
+ fontSize: size,
45
+ height: size,
46
+ width: size
47
+ }, style)
48
+ }, props), {}, {
49
+ children: emoji
50
+ }));
51
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
52
+ className: cx(styles.container, className),
53
+ style: _objectSpread({
54
+ height: size,
55
+ width: size
56
+ }, style)
57
+ }, props), {}, {
58
+ children: [loading && /*#__PURE__*/_jsx("div", {
59
+ className: styles.loading,
60
+ children: /*#__PURE__*/_jsx(Icon, {
61
+ icon: Loader2,
62
+ size: {
63
+ fontSize: size * 0.75
64
+ },
65
+ spin: true
66
+ })
67
+ }), /*#__PURE__*/_jsx("img", {
68
+ alt: emojiName,
69
+ height: "100%",
70
+ onError: function onError() {
71
+ return setLoadingFail(true);
72
+ },
73
+ onLoad: function onLoad() {
74
+ return setLoading(false);
75
+ },
76
+ src: "https://npm.elemecdn.com/fluentui-emoji/icons/".concat(type, "/").concat(kebabCase(emojiName), ".svg"),
77
+ style: {
78
+ opacity: loading ? 0 : 1
79
+ },
80
+ width: "100%"
81
+ })]
82
+ }));
83
+ });
84
+ export default FluentEmoji;
@@ -0,0 +1,4 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ container: import("antd-style").SerializedStyles;
3
+ loading: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,11 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n line-height: 1;\n text-align: center;\n "]))),
9
+ loading: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n\n color: ", ";\n "])), token.colorText)
10
+ };
11
+ });
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  export interface FontLoaderProps {
3
+ /**
4
+ * @description The URL of the font to load
5
+ */
3
6
  url: string;
4
7
  }
5
8
  declare const FontLoader: import("react").NamedExoticComponent<FontLoaderProps>;
@@ -1,10 +1,24 @@
1
- /// <reference types="react" />
2
- import { FooterProps as RcProps } from 'rc-footer';
1
+ import { type FooterProps as RcProps } from 'rc-footer';
2
+ import { type ReactNode } from 'react';
3
3
  export interface FooterProps {
4
- bottom?: RcProps['bottom'];
4
+ /**
5
+ * @description The bottom content of the footer
6
+ */
7
+ bottom?: ReactNode;
8
+ /**
9
+ * @description The columns of the footer
10
+ */
5
11
  columns: RcProps['columns'];
12
+ /**
13
+ * @description The maximum width of the content in the footer
14
+ * @type number
15
+ * @default 960
16
+ */
6
17
  contentMaxWidth?: number;
7
- theme?: RcProps['theme'];
18
+ /**
19
+ * @description The theme of the footer
20
+ */
21
+ theme?: 'light' | 'dark';
8
22
  }
9
23
  declare const Footer: import("react").NamedExoticComponent<FooterProps>;
10
24
  export default Footer;
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from 'antd';
3
3
  export interface GradientButtonProps extends ButtonProps {
4
+ /**
5
+ * @description Whether the button should spin or not
6
+ * @default false
7
+ */
4
8
  spin?: boolean;
5
9
  }
6
10
  declare const GradientButton: import("react").NamedExoticComponent<GradientButtonProps>;
@@ -1,14 +1,41 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  import { DivProps } from "../types";
3
3
  export interface HeaderProps extends DivProps {
4
+ /**
5
+ * @description Actions to be displayed on the right side of the header
6
+ */
4
7
  actions?: ReactNode;
8
+ /**
9
+ * @description Class name for actions container
10
+ */
5
11
  actionsClassName?: string;
12
+ /**
13
+ * @description Style for actions container
14
+ */
6
15
  actionsStyle?: CSSProperties;
16
+ /**
17
+ * @description Logo to be displayed on the left side of the header
18
+ */
7
19
  logo?: ReactNode;
20
+ /**
21
+ * @description Class name for logo container
22
+ */
8
23
  logoClassName?: string;
24
+ /**
25
+ * @description Style for logo container
26
+ */
9
27
  logoStyle?: CSSProperties;
28
+ /**
29
+ * @description Navigation to be displayed on the right side of the logo
30
+ */
10
31
  nav?: ReactNode;
32
+ /**
33
+ * @description Class name for navigation container
34
+ */
11
35
  navClassName?: string;
36
+ /**
37
+ * @description Style for navigation container
38
+ */
12
39
  navStyle?: CSSProperties;
13
40
  }
14
41
  declare const Header: import("react").NamedExoticComponent<HeaderProps>;
@@ -1,14 +1,41 @@
1
1
  /// <reference types="react" />
2
2
  export interface HeroAction {
3
+ /**
4
+ * @description Icon name from LucideIcon package
5
+ */
3
6
  icon?: string;
7
+ /**
8
+ * @description Link to be redirected to on button click
9
+ */
4
10
  link: string;
11
+ /**
12
+ * @description Whether to open the link in a new tab
13
+ * @default false
14
+ */
5
15
  openExternal?: boolean;
16
+ /**
17
+ * @description Text to be displayed on the button
18
+ */
6
19
  text: string;
20
+ /**
21
+ * @description Type of button
22
+ * @default 'default'
23
+ */
7
24
  type?: 'primary' | 'default';
8
25
  }
9
26
  export interface HeroProps {
27
+ /**
28
+ * @description Array of action buttons to be displayed
29
+ * @default []
30
+ */
10
31
  actions?: HeroAction[];
32
+ /**
33
+ * @description Short description to be displayed
34
+ */
11
35
  description?: string;
36
+ /**
37
+ * @description Title to be displayed
38
+ */
12
39
  title?: string;
13
40
  }
14
41
  declare const Hero: import("react").NamedExoticComponent<HeroProps>;
@@ -1,14 +1,33 @@
1
- /// <reference types="react" />
2
- import { InputProps as AntdInputProps } from 'antd';
1
+ import { type InputProps as AntdInputProps, type InputRef } from 'antd';
3
2
  import { TextAreaProps as AntdTextAreaProps } from 'antd/es/input/TextArea';
3
+ import { type Ref } from 'react';
4
4
  export interface InputProps extends AntdInputProps {
5
- ref?: any;
5
+ /**
6
+ * @description Ref of the component
7
+ */
8
+ ref?: Ref<InputRef>;
9
+ /**
10
+ * @description Type of the input
11
+ * @default 'ghost'
12
+ */
6
13
  type?: 'ghost' | 'block' | 'pure';
7
14
  }
8
15
  export declare const Input: import("react").NamedExoticComponent<InputProps>;
9
16
  export interface TextAreaProps extends AntdTextAreaProps {
10
- ref?: any;
17
+ /**
18
+ * @description Ref of the component
19
+ * @default undefined
20
+ */
21
+ ref?: Ref<InputRef>;
22
+ /**
23
+ * @description Whether to enable resizing of the textarea
24
+ * @default true
25
+ */
11
26
  resize?: boolean;
27
+ /**
28
+ * @description Type of the textarea
29
+ * @default 'ghost'
30
+ */
12
31
  type?: 'ghost' | 'block' | 'pure';
13
32
  }
14
33
  export declare const TextArea: import("react").NamedExoticComponent<TextAreaProps>;
@@ -21,15 +21,46 @@ export declare const LayoutToc: import("react").NamedExoticComponent<LayoutTocPr
21
21
  export declare type LayoutFooterProps = DivProps;
22
22
  export declare const LayoutFooter: import("react").NamedExoticComponent<DivProps>;
23
23
  export interface LayoutProps {
24
+ /**
25
+ * @description Width of the sidebar
26
+ */
24
27
  asideWidth?: number;
28
+ /**
29
+ * @description Children of the layout
30
+ */
25
31
  children?: ReactNode;
32
+ /**
33
+ * @description Content of the layout
34
+ */
26
35
  content?: ReactNode;
36
+ /**
37
+ * @description Footer of the layout
38
+ */
27
39
  footer?: ReactNode;
40
+ /**
41
+ * @description Header of the layout
42
+ */
28
43
  header?: ReactNode;
44
+ /**
45
+ * @description Height of the header
46
+ * @default 64
47
+ */
29
48
  headerHeight?: number;
49
+ /**
50
+ * @description Helmet of the layout
51
+ */
30
52
  helmet?: ReactNode;
53
+ /**
54
+ * @description Sidebar of the layout
55
+ */
31
56
  sidebar?: ReactNode;
57
+ /**
58
+ * @description Table of contents of the layout
59
+ */
32
60
  toc?: ReactNode;
61
+ /**
62
+ * @description Width of the table of contents
63
+ */
33
64
  tocWidth?: number;
34
65
  }
35
66
  declare const Layout: import("react").NamedExoticComponent<LayoutProps>;
package/es/Logo/index.js CHANGED
@@ -6,10 +6,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
  import { useTheme } from 'antd-style';
7
7
  import { memo } from 'react';
8
8
  import Divider from "./Divider";
9
- import LogoFlat from "./LogoFlat";
10
9
  import LogoHighContrast from "./LogoHighContrast";
11
10
  import LogoText from "./LogoText";
12
- import { useStyles } from "./style";
11
+ import { LOGO_3D, LOGO_FLAT, useStyles } from "./style";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -32,7 +31,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
32
31
  {
33
32
  return /*#__PURE__*/_jsx("img", _objectSpread({
34
33
  alt: "lobehub",
35
- src: "https://npm.elemecdn.com/@lobehub/assets/logo/logo-3d.webp",
34
+ src: LOGO_3D,
36
35
  style: _objectSpread({
37
36
  height: size,
38
37
  width: size
@@ -41,12 +40,14 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
41
40
  }
42
41
  case 'flat':
43
42
  {
44
- return /*#__PURE__*/_jsx(LogoFlat, _objectSpread({
43
+ return /*#__PURE__*/_jsx("img", {
44
+ alt: "lobehub",
45
+ src: LOGO_FLAT,
45
46
  style: _objectSpread({
46
47
  height: size,
47
48
  width: size
48
49
  }, style)
49
- }, props));
50
+ });
50
51
  }
51
52
  case 'high-contrast':
52
53
  {
@@ -71,11 +72,11 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
71
72
  logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
72
73
  children: [/*#__PURE__*/_jsx("img", {
73
74
  alt: "lobehub",
74
- src: "https://npm.elemecdn.com/@lobehub/assets/logo/logo-3d.webp",
75
- style: _objectSpread({
75
+ src: LOGO_3D,
76
+ style: {
76
77
  height: size,
77
78
  width: size
78
- }, style)
79
+ }
79
80
  }), /*#__PURE__*/_jsx(LogoText, {
80
81
  style: {
81
82
  height: size,
@@ -1,3 +1,5 @@
1
+ export declare const LOGO_3D = "https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp";
2
+ export declare const LOGO_FLAT = "https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-flat.svg";
1
3
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
4
  extraTitle: import("antd-style").SerializedStyles;
3
5
  flexCenter: import("antd-style").SerializedStyles;
package/es/Logo/style.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2;
3
3
  import { createStyles } from 'antd-style';
4
+ export var LOGO_3D = 'https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp';
5
+ export var LOGO_FLAT = 'https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-flat.svg';
4
6
  export var useStyles = createStyles(function (_ref) {
5
7
  var css = _ref.css;
6
8
  return {
@@ -1,36 +1,36 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from 'antd';
3
3
  import { type TextAreaProps } from "../Input";
4
- /**
5
- * @title MessageInputProps
6
- * @category Props
7
- * @description MessageInput 组件的 Props
8
- */
9
4
  export interface MessageInputProps {
5
+ /**
6
+ * @description Additional className to apply to the component.
7
+ */
10
8
  className?: string;
11
9
  /**
12
- * @title 默认值
13
- * @description 输入框的默认值
10
+ * @description The default value of the input box.
14
11
  */
15
12
  defaultValue?: string;
13
+ /**
14
+ * @description The height of the input box.
15
+ */
16
16
  height?: number;
17
17
  /**
18
- * @title 取消回调函数
19
- * @description 用户点击取消按钮后的回调函数
18
+ * @description Callback function triggered when user clicks on the cancel button.
20
19
  */
21
20
  onCancel?: () => void;
22
21
  /**
23
- * @title 确认回调函数
24
- * @description 用户点击确认按钮后的回调函数
25
- * @param text - 用户输入的文本
22
+ * @description Callback function triggered when user clicks on the confirm button.
23
+ * @param text - The text input by the user.
26
24
  */
27
25
  onConfirm?: (text: string) => void;
28
26
  /**
29
- * @title 渲染按钮
30
- * @description 自定义渲染底部按钮
31
- * @param text - 用户输入的文本
27
+ * @description Custom rendering of the bottom buttons.
28
+ * @param text - The text input by the user.
32
29
  */
33
30
  renderButtons?: (text: string) => ButtonProps[];
31
+ /**
32
+ * @description The type of the input box.
33
+ */
34
34
  type?: TextAreaProps['type'];
35
35
  }
36
36
  declare const MessageInput: import("react").NamedExoticComponent<MessageInputProps>;
@@ -7,12 +7,6 @@ import { cx } from 'antd-style';
7
7
  import { memo, useState } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
  import { TextArea } from "../Input";
10
-
11
- /**
12
- * @title MessageInputProps
13
- * @category Props
14
- * @description MessageInput 组件的 Props
15
- */
16
10
  import { jsx as _jsx } from "react/jsx-runtime";
17
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
18
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { createGlobalStyle } from 'antd-style';
4
- var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\", \"tnum\", \"kern\";\n --font-variations: \"opsz\" auto, tabular-nums;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-overflow-scrolling:touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n body {\n overflow-x: hidden;\n height: 100vh;\n }\n\n #root {\n min-height: 100vh;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n\n ::selection {\n color: #000;\n background: ", ";\n }\n\n * {\n\t box-sizing: border-box;\n\t vertical-align: baseline;\n }\n\n @media only screen and (min-width: 574px) {\n * {\n ::-webkit-scrollbar {\n cursor: pointer;\n width: 4px;\n height: 4px;\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n cursor: pointer;\n background-color: transparent;\n border-radius: 2px;\n transition: background-color 500ms ", ";\n\n &:hover {\n background-color: ", ";\n }\n }\n\n ::-webkit-scrollbar-corner {\n display: none;\n width: 0;\n height: 0;\n }\n\n &:hover {\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n }\n }\n }\n }\n"])), function (_ref) {
4
+ var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\", \"tnum\", \"kern\";\n --font-variations: \"opsz\" auto, tabular-nums;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-overflow-scrolling:touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n body {\n overflow-x: hidden;\n height: 100vh;\n }\n\n #root {\n min-height: 100vh;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n\n ::selection {\n color: #000;\n background: ", ";\n\n\t -webkit-text-fill-color: unset !important;\n }\n\n * {\n\t box-sizing: border-box;\n\t vertical-align: baseline;\n }\n\n @media only screen and (min-width: 574px) {\n * {\n ::-webkit-scrollbar {\n cursor: pointer;\n width: 4px;\n height: 4px;\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n cursor: pointer;\n background-color: transparent;\n border-radius: 2px;\n transition: background-color 500ms ", ";\n\n &:hover {\n background-color: ", ";\n }\n }\n\n ::-webkit-scrollbar-corner {\n display: none;\n width: 0;\n height: 0;\n }\n\n &:hover {\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n }\n }\n }\n }\n"])), function (_ref) {
5
5
  var theme = _ref.theme;
6
6
  return theme.fontFamily;
7
7
  }, function (_ref2) {
@@ -30,6 +30,10 @@ export interface ThemeProviderProps {
30
30
  * @description The mode of the theme (light or dark)
31
31
  */
32
32
  themeMode?: ThemeMode;
33
+ /**
34
+ * @description Webfont loader css strings
35
+ */
36
+ webfonts?: string[];
33
37
  }
34
38
  declare const ThemeProvider: import("react").NamedExoticComponent<ThemeProviderProps>;
35
39
  export default ThemeProvider;
@@ -10,6 +10,7 @@ import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
10
10
  import GlobalStyle from "./GlobalStyle";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
14
  var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
14
15
  var children = _ref.children,
15
16
  themeMode = _ref.themeMode,
@@ -20,35 +21,37 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
20
21
  _ref$customToken = _ref.customToken,
21
22
  _customToken = _ref$customToken === void 0 ? function () {
22
23
  return {};
23
- } : _ref$customToken;
24
+ } : _ref$customToken,
25
+ _ref$webfonts = _ref.webfonts,
26
+ webfonts = _ref$webfonts === void 0 ? ['https://npm.elemecdn.com/@lobehub/webfont-mono/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans-sc/css/index.css'] : _ref$webfonts;
24
27
  setupStyled({
25
28
  ThemeContext: ThemeContext
26
29
  });
27
- return /*#__PURE__*/_jsx(StyleProvider, {
28
- speedy: process.env.NODE_ENV === 'production',
29
- children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
30
- customStylish: function customStylish(theme) {
31
- return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), _customStylish(theme));
32
- },
33
- customToken: function customToken(theme) {
34
- return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
35
- },
36
- theme: lobeTheme,
37
- themeMode: themeMode,
38
- children: [/*#__PURE__*/_jsx(FontLoader, {
39
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/hack-nerd-font-mono.css"
40
- }), /*#__PURE__*/_jsx(FontLoader, {
41
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/harmonyos-sans.css"
42
- }), /*#__PURE__*/_jsx(FontLoader, {
43
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/harmonyos-sans-sc.css"
44
- }), /*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
45
- style: {
46
- minHeight: 'inherit',
47
- width: 'inherit'
30
+ return /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [webfonts && webfonts.map(function (webfont, index) {
32
+ return /*#__PURE__*/_jsx(FontLoader, {
33
+ url: webfont
34
+ }, index);
35
+ }), /*#__PURE__*/_jsx(StyleProvider, {
36
+ speedy: process.env.NODE_ENV === 'production',
37
+ children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
38
+ customStylish: function customStylish(theme) {
39
+ return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), _customStylish(theme));
48
40
  },
49
- children: children
50
- })]
51
- })
41
+ customToken: function customToken(theme) {
42
+ return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
43
+ },
44
+ theme: lobeTheme,
45
+ themeMode: themeMode,
46
+ children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
47
+ style: {
48
+ minHeight: 'inherit',
49
+ width: 'inherit'
50
+ },
51
+ children: children
52
+ })]
53
+ })
54
+ })]
52
55
  });
53
56
  });
54
57
  export default ThemeProvider;
@@ -1,16 +1,46 @@
1
1
  /// <reference types="react" />
2
2
  import { AnchorProps } from 'antd';
3
3
  export interface AnchorItem {
4
+ /**
5
+ * @description The children of the anchor item
6
+ */
4
7
  children?: AnchorItem[];
8
+ /**
9
+ * @description The ID of the anchor item
10
+ */
5
11
  id: string;
12
+ /**
13
+ * @description The title of the anchor item
14
+ */
6
15
  title: string;
7
16
  }
8
17
  export interface TocMobileProps {
18
+ /**
19
+ * @description The active key of the TocMobile component
20
+ * @default undefined
21
+ */
9
22
  activeKey?: string;
23
+ /**
24
+ * @description The function to get the container of the anchor
25
+ */
10
26
  getContainer?: AnchorProps['getContainer'];
27
+ /**
28
+ * @description The height of the header
29
+ * @default 64
30
+ */
11
31
  headerHeight?: number;
32
+ /**
33
+ * @description The array of anchor items to be displayed
34
+ */
12
35
  items: AnchorItem[];
36
+ /**
37
+ * @description The function to be called when the active key changes
38
+ */
13
39
  onChange?: (activeKey: string) => void;
40
+ /**
41
+ * @description The width of the toc
42
+ * @default 176
43
+ */
14
44
  tocWidth?: number;
15
45
  }
16
46
  export declare const mapItems: (items: AnchorItem[]) => {
package/es/Toc/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { type TocMobileProps } from './TocMobile';
3
3
  export interface TocProps extends TocMobileProps {
4
+ /**
5
+ * @description Whether the component is being rendered on a mobile device or not
6
+ * @default false
7
+ */
4
8
  isMobile?: boolean;
5
9
  }
6
10
  declare const Toc: import("react").NamedExoticComponent<TocProps>;
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { DivProps } from "../types";
3
3
  export interface TokenTagProps extends DivProps {
4
+ /**
5
+ * @description Maximum value for the token
6
+ */
4
7
  maxValue: number;
8
+ /**
9
+ * @description Current value of the token
10
+ */
5
11
  value: number;
6
12
  }
7
13
  declare const TokenTag: import("react").NamedExoticComponent<TokenTagProps>;
@@ -4,7 +4,8 @@ var _excluded = ["className", "maxValue", "value"];
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
+ import FluentEmoji from "../FluentEmoji";
8
+ import { ICON_SIZE, useStyles } from "./style";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
11
  var TokenTag = /*#__PURE__*/memo(function (_ref) {
@@ -32,9 +33,9 @@ var TokenTag = /*#__PURE__*/memo(function (_ref) {
32
33
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
33
34
  className: cx(styles.container, className)
34
35
  }, props), {}, {
35
- children: [/*#__PURE__*/_jsx("span", {
36
- className: styles.emoji,
37
- children: emoji
36
+ children: [/*#__PURE__*/_jsx(FluentEmoji, {
37
+ emoji: emoji,
38
+ size: ICON_SIZE
38
39
  }), valueLeft > 0 ? "Tokens ".concat(valueLeft) : "Overload"]
39
40
  }));
40
41
  });
@@ -1,4 +1,4 @@
1
+ export declare const ICON_SIZE = 20;
1
2
  export declare const useStyles: (props?: "normal" | "low" | "overload" | undefined) => import("antd-style").ReturnStyles<{
2
3
  container: string;
3
- emoji: import("antd-style").SerializedStyles;
4
4
  }>;
@@ -1,8 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
3
  import { createStyles } from 'antd-style';
4
4
  var HEIGHT = 28;
5
- var ICON_SIZE = 20;
5
+ export var ICON_SIZE = 20;
6
6
  export var useStyles = createStyles(function (_ref, type) {
7
7
  var cx = _ref.cx,
8
8
  css = _ref.css,
@@ -26,7 +26,6 @@ export var useStyles = createStyles(function (_ref, type) {
26
26
  }
27
27
  }
28
28
  return {
29
- container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: flex;\n gap: 4px;\n align-items: center;\n\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, HEIGHT - ICON_SIZE, (HEIGHT - ICON_SIZE) / 2, token.colorFillSecondary, HEIGHT / 2)),
30
- emoji: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: ", "px;\n "])), ICON_SIZE)
29
+ container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 4px;\n align-items: center;\n\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n font-family: ", ";\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, (HEIGHT - ICON_SIZE) * 1.2, (HEIGHT - ICON_SIZE) / 2, token.fontFamilyCode, token.colorFillSecondary, HEIGHT / 2))
31
30
  };
32
31
  });
@@ -1,9 +1,21 @@
1
1
  /// <reference types="react" />
2
2
  import { InputProps } from "../Input";
3
3
  export interface ControlInputProps extends Omit<InputProps, 'onChange' | 'value' | 'onAbort'> {
4
+ /**
5
+ * @description Callback function that is triggered when the input value changes
6
+ */
4
7
  onChange?: (value: string) => void;
8
+ /**
9
+ * @description Callback function that is triggered when the input value has stopped changing
10
+ */
5
11
  onChangeEnd?: (value: string) => void;
12
+ /**
13
+ * @description Callback function that is triggered when the input value is changing
14
+ */
6
15
  onValueChanging?: (value: string) => void;
16
+ /**
17
+ * @description The initial value of the input
18
+ */
7
19
  value?: string;
8
20
  }
9
21
  export declare const ControlInput: import("react").NamedExoticComponent<ControlInputProps>;
@@ -5,20 +5,20 @@ export declare const languageMap: readonly ["javascript", "js", "jsx", "json", "
5
5
  */
6
6
  interface Store {
7
7
  /**
8
- * @title 将代码转化为 HTML 字符串
9
- * @param text - 代码文本
10
- * @param language - 代码语言
11
- * @param isDarkMode - 是否为暗黑模式
12
- * @returns HTML 字符串
8
+ * @title Convert code to HTML string
9
+ * @param text - The code text
10
+ * @param language - The language of the code
11
+ * @param isDarkMode - Whether it's in dark mode or not
12
+ * @returns HTML string
13
13
  */
14
14
  codeToHtml: (text: string, language: string, isDarkMode: boolean) => string;
15
15
  /**
16
- * @title 高亮器对象
16
+ * @title Highlighter object
17
17
  */
18
18
  highlighter?: Highlighter;
19
19
  /**
20
- * @title 初始化高亮器对象
21
- * @returns 初始化 Promise 对象
20
+ * @title Initialize the highlighter object
21
+ * @returns Initialization promise object
22
22
  */
23
23
  initHighlighter: () => Promise<void>;
24
24
  }
package/es/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { default as EditableMessage, type EditableMessageProps } from './Editabl
15
15
  export { default as EditableMessageList, type EditableMessageListProps, } from './EditableMessageList';
16
16
  export { default as EditableText, type EditableTextProps } from './EditableText';
17
17
  export { type FeatureItem, default as Features, type FeaturesProps } from './Features';
18
+ export { default as FluentEmoji, type FluentEmojiProps } from './FluentEmoji';
18
19
  export { default as FontLoader, type FontLoaderProps } from './FontLoader';
19
20
  export { default as Footer, type FooterProps } from './Footer';
20
21
  export { default as GradientButton, type GradientButtonProps } from './GradientButton';
package/es/index.js CHANGED
@@ -14,6 +14,7 @@ export { default as EditableMessage } from "./EditableMessage";
14
14
  export { default as EditableMessageList } from "./EditableMessageList";
15
15
  export { default as EditableText } from "./EditableText";
16
16
  export { default as Features } from "./Features";
17
+ export { default as FluentEmoji } from "./FluentEmoji";
17
18
  export { default as FontLoader } from "./FontLoader";
18
19
  export { default as Footer } from "./Footer";
19
20
  export { default as GradientButton } from "./GradientButton";
@@ -1,7 +1,7 @@
1
1
  var FONT_EMOJI = "\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Apple Color Emoji\",\"Twemoji Mozilla\",\"Noto Color Emoji\",\"Android Emoji\"";
2
2
  var FONT_EN = "\"HarmonyOS Sans\",\"Segoe UI\",\"SF Pro Display\",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,\"Open Sans\",\"Helvetica Neue\",sans-serif";
3
3
  var FONT_CN = "\"HarmonyOS Sans SC\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft Yahei UI\",\"Microsoft Yahei\",\"Source Han Sans CN\",sans-serif";
4
- var FONT_CODE = "\"Hack Nerd Font Mono\",ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace";
4
+ var FONT_CODE = "Hack,ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace";
5
5
  export var baseToken = {
6
6
  borderRadius: 5,
7
7
  borderRadiusLG: 8,
@@ -0,0 +1,2 @@
1
+ export declare const getEmoji: (emoji: string) => string | undefined;
2
+ export declare const getEmojiNameByCharacter: (emoji: string) => string | undefined;
@@ -0,0 +1,15 @@
1
+ import emojiRegex from 'emoji-regex';
2
+ import emojilib from 'emojilib';
3
+ export var getEmoji = function getEmoji(emoji) {
4
+ var _emoji$match;
5
+ var regex = emojiRegex();
6
+ var pureEmoji = (_emoji$match = emoji.match(regex)) === null || _emoji$match === void 0 ? void 0 : _emoji$match[0];
7
+ return pureEmoji;
8
+ };
9
+ export var getEmojiNameByCharacter = function getEmojiNameByCharacter(emoji) {
10
+ var _EmojiLab$pureEmoji;
11
+ var pureEmoji = getEmoji(emoji);
12
+ if (!pureEmoji) return;
13
+ var EmojiLab = emojilib;
14
+ return EmojiLab === null || EmojiLab === void 0 ? void 0 : (_EmojiLab$pureEmoji = EmojiLab[pureEmoji]) === null || _EmojiLab$pureEmoji === void 0 ? void 0 : _EmojiLab$pureEmoji[0];
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -81,6 +81,8 @@
81
81
  "chroma-js": "^2",
82
82
  "copy-to-clipboard": "^3",
83
83
  "dayjs": "^1",
84
+ "emoji-regex": "^10",
85
+ "emojilib": "^3",
84
86
  "fast-deep-equal": "^3",
85
87
  "immer": "^10",
86
88
  "leva": "^0",
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const LogoFlat: import("react").MemoExoticComponent<any>;
3
- export default LogoFlat;
@@ -1,105 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
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 { memo } from 'react';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- var LogoFlat = /*#__PURE__*/memo(function (_ref) {
9
- var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
10
- return /*#__PURE__*/_jsxs("svg", _objectSpread(_objectSpread({
11
- fill: "none",
12
- viewBox: "0 0 320 320"
13
- }, props), {}, {
14
- children: [/*#__PURE__*/_jsx("path", {
15
- d: "M294 172.516c0 75.655-59.442 128.5-134 128.5-74.558 0-134-53.845-134-129.5 0-22.501 5-32.142 31.5-35.672 47.5-6.329 72.542-3.828 102.5-3.828 29.959 0 72.556-1.271 102.5 3.828 24.5 4.171 30 8.671 31.5 36.672z",
16
- fill: "#FFB02E"
17
- }), /*#__PURE__*/_jsx("path", {
18
- d: "M159.75 242.516c-28.25 0-35.75 3.5-35.75 3.5s3.5 27 35.75 27 35.75-27 35.75-27-7.5-3.5-35.75-3.5z",
19
- fill: "#972021"
20
- }), /*#__PURE__*/_jsx("ellipse", {
21
- cx: "160.5",
22
- cy: "148.516",
23
- fill: "#FF6723",
24
- rx: "111.5",
25
- ry: "11.5"
26
- }), /*#__PURE__*/_jsx("path", {
27
- d: "M135.5 160.015c.633-14.972-.483-22.788-5.5-36.443 0 0 9.5-12.056 27-12.056s30 3.064 30 3.064c-3.028 16.793-3.182 26.921-2.5 45.435h-49z",
28
- fill: "#FEE064"
29
- }), /*#__PURE__*/_jsx("path", {
30
- d: "M119.189 234.289c14.742-7.076 24.811-21.51 24.811-39.273 0-25.405-20.595-48-46-48s-47 19.595-47 45c0 13.983 6.542 26.812 16.662 35.521 5.893-2.245 12.652-3.521 19.838-3.521 12.705 0 24.077 3.989 31.689 10.273zM200.811 234.289C186.069 227.213 176 212.779 176 195.016c0-25.405 20.595-48 46-48s47 19.595 47 45c0 13.983-6.542 26.812-16.662 35.521-5.893-2.245-12.652-3.521-19.838-3.521-12.705 0-24.077 3.989-31.689 10.273z",
31
- fill: "#fff"
32
- }), /*#__PURE__*/_jsx("circle", {
33
- cx: "28",
34
- cy: "28",
35
- fill: "#270C36",
36
- r: "28",
37
- transform: "matrix(-1 0 0 1 247 165.016)"
38
- }), /*#__PURE__*/_jsx("circle", {
39
- cx: "101",
40
- cy: "193.016",
41
- fill: "#270C36",
42
- r: "28"
43
- }), /*#__PURE__*/_jsx("path", {
44
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
45
- fill: "#F70A8D"
46
- }), /*#__PURE__*/_jsx("path", {
47
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
48
- fill: "#F70A8D"
49
- }), /*#__PURE__*/_jsx("path", {
50
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
51
- fill: "#20D45F",
52
- fillOpacity: ".42"
53
- }), /*#__PURE__*/_jsx("path", {
54
- d: "M173 19.016c-14.027 0-19.5-11.5-41-11-23.394 0-34 13-45.5 23-1.958 1.702-11.5 7-16 9-19.683 8.748-34.5 21.5-34.5 40.5 0 20.711 17.46 37.5 39 37.5 3.536 0 6.963-.453 10.22-1.301 8.7 10.539 22.179 16.658 37.28 17.301 23.5 1 31-15.25 44.5-8.5 9.259 4.629 13.83 8.5 28.5 8.5 17.108 0 25.057-5.233 30-11 9-10.5 22.879-4 31.5-4 18.778 0 34-14.551 34-32.5 0-17.95-15.222-32.5-34-32.5-5.15 0-14.856 1.27-17-7-3.5-13.5-20.148-29-44-29-9.318 0-17.691 1-23 1z",
55
- fill: "#A68AE2"
56
- }), /*#__PURE__*/_jsx("path", {
57
- d: "M157.32 14.32c4.969 2.458 9.492 4.696 15.68 4.696 2.284 0 5.134-.185 8.383-.396 4.304-.28 9.307-.604 14.617-.604 23.852 0 40.5 15.5 44 29 1.908 7.36 9.804 7.164 15.149 7.032a77.169 77.169 0 011.851-.032c16.664 0 30.528 11.46 33.438 26.583.137.71-1.083.88-1.354.208-.027-.07-.056-.139-.084-.208-4.719-11.431-17.265-19.605-32-19.605-.544 0-1.173.013-1.866.027-5.853.12-16.216.334-18.134-6.413-3.5-12.315-17.148-26.455-41-26.455-5.31 0-10.313.296-14.617.55-3.249.193-6.099.362-8.383.362-6.188 0-10.711-2.042-15.68-4.285-6.295-2.84-13.305-6.005-25.32-5.75-20.261 0-30.93 8.896-40.895 17.205a244.788 244.788 0 01-4.605 3.777c-1.958 1.553-11.5 6.386-16 8.21-15.7 6.366-28.304 15.055-32.762 27.107-.247.668-1.437.525-1.327-.178l.021-.135c2.572-16.004 16.348-27.125 34.068-35 4.5-2 14.042-7.298 16-9 1.54-1.34 3.064-2.732 4.605-4.14 9.965-9.109 20.634-18.86 40.895-18.86 12.015-.28 19.025 3.189 25.32 6.303z",
58
- fill: "#DBA6E9"
59
- }), /*#__PURE__*/_jsx("circle", {
60
- cx: "73.5",
61
- cy: "20.516",
62
- fill: "#7B61FF",
63
- r: "9.5"
64
- }), /*#__PURE__*/_jsx("circle", {
65
- cx: "55",
66
- cy: "108.016",
67
- fill: "#D9D9D9",
68
- r: "16"
69
- }), /*#__PURE__*/_jsx("circle", {
70
- cx: "55",
71
- cy: "108.016",
72
- fill: "#F2314D",
73
- r: "16"
74
- }), /*#__PURE__*/_jsx("circle", {
75
- cx: "266.5",
76
- cy: "49.516",
77
- fill: "#7CEE1D",
78
- r: "15.5"
79
- }), /*#__PURE__*/_jsx("path", {
80
- d: "M132.235 244.117c5.483-.823 14.191-1.601 27.515-1.601 12.211 0 20.546.654 26.073 1.396-1.542 5.86-12.963 8.104-26.823 8.104-13.698 0-25.013-2.191-26.765-7.899z",
81
- fill: "#fff"
82
- }), /*#__PURE__*/_jsx("path", {
83
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
84
- fill: "#F70A8D"
85
- }), /*#__PURE__*/_jsx("path", {
86
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
87
- fill: "#F70A8D"
88
- }), /*#__PURE__*/_jsx("path", {
89
- d: "M160.006 290.016c20.099 0 23.305-20.488 23.927-25.61.478-4.146-1.675-6.244-4.02-7.659-2.345-1.414-9.379-2.731-19.907-2.731-10.527 0-17.514 1.317-19.906 2.731-2.393 1.415-4.546 3.513-4.02 7.659.622 5.122 3.828 25.61 23.926 25.61z",
90
- fill: "#F24630"
91
- }), /*#__PURE__*/_jsx("path", {
92
- d: "M171.696 129.744c-5.721-3.89-13.954-4.248-19.786-.526-7.724 4.929-16.971 7.798-26.91 7.798-27.062 0-49-21.267-49-47.5 0-26.234 21.938-47.5 49-47.5 13.628 0 25.956 5.392 34.838 14.097 4.948 4.85 13.088 6.24 19.498 3.609a42.502 42.502 0 0116.164-3.166c22.92 0 41.5 18.012 41.5 40.23 0 22.218-18.58 40.23-41.5 40.23-8.856 0-17.065-2.69-23.804-7.272z",
93
- fill: "#F4B8CA"
94
- }), /*#__PURE__*/_jsx("path", {
95
- d: "M237 96.786c0 .752-1.081.808-1.271.08-4.558-17.42-20.841-30.31-40.229-30.31a42.503 42.503 0 00-16.164 3.166c-6.41 2.63-14.55 1.24-19.498-3.61-8.882-8.704-21.21-14.096-34.838-14.096-23.544 0-43.21 16.096-47.925 37.556-.139.632-1.075.59-1.075-.056 0-26.234 21.938-47.5 49-47.5 13.628 0 25.956 5.392 34.838 14.097 4.948 4.85 13.088 6.24 19.498 3.609a42.503 42.503 0 0116.164-3.166c22.92 0 41.5 18.012 41.5 40.23z",
96
- fill: "#FFD7D7"
97
- }), /*#__PURE__*/_jsx("circle", {
98
- cx: "205.5",
99
- cy: "106.516",
100
- fill: "#0C74FF",
101
- r: "13.5"
102
- })]
103
- }));
104
- });
105
- export default LogoFlat;