@lobehub/ui 3.1.2 → 3.3.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.
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import type { CenterProps } from './type';
3
+ declare const Center: FC<CenterProps>;
4
+ export default Center;
@@ -0,0 +1,23 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["children", "ref"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import FlexBasic from "./FlexBasic";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var Center = function Center(_ref) {
13
+ var children = _ref.children,
14
+ ref = _ref.ref,
15
+ props = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/_jsx(FlexBasic, _objectSpread(_objectSpread({}, props), {}, {
17
+ align: "center",
18
+ justify: "center",
19
+ ref: ref,
20
+ children: children
21
+ }));
22
+ };
23
+ export default Center;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import './style.css';
3
+ import type { FlexBasicProps } from './type';
4
+ declare const _default: import("react").NamedExoticComponent<FlexBasicProps>;
5
+ export default _default;
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _excluded = ["visible", "flex", "gap", "direction", "horizontal", "align", "justify", "distribution", "height", "width", "padding", "paddingInline", "paddingBlock", "prefixCls", "as", "className", "style", "children", "wrap", "ref"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
+ import { memo } from 'react';
13
+ import "./style.css";
14
+ import { getCssValue, getFlexDirection, isHorizontal, isSpaceDistribution } from "./utils";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ var FlexBasic = function FlexBasic(_ref) {
17
+ var visible = _ref.visible,
18
+ flex = _ref.flex,
19
+ gap = _ref.gap,
20
+ direction = _ref.direction,
21
+ horizontal = _ref.horizontal,
22
+ align = _ref.align,
23
+ justify = _ref.justify,
24
+ distribution = _ref.distribution,
25
+ height = _ref.height,
26
+ width = _ref.width,
27
+ padding = _ref.padding,
28
+ paddingInline = _ref.paddingInline,
29
+ paddingBlock = _ref.paddingBlock,
30
+ prefixCls = _ref.prefixCls,
31
+ _ref$as = _ref.as,
32
+ Container = _ref$as === void 0 ? 'div' : _ref$as,
33
+ className = _ref.className,
34
+ style = _ref.style,
35
+ children = _ref.children,
36
+ wrap = _ref.wrap,
37
+ ref = _ref.ref,
38
+ props = _objectWithoutProperties(_ref, _excluded);
39
+ var justifyContent = justify || distribution;
40
+ var calcWidth = function calcWidth() {
41
+ if (isHorizontal(direction, horizontal) && !width && isSpaceDistribution(justifyContent)) return '100%';
42
+ return getCssValue(width);
43
+ };
44
+ var finalWidth = calcWidth();
45
+ var cssVars = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, flex !== undefined ? {
46
+ '--lobe-flex': String(flex)
47
+ } : {}), direction || horizontal ? {
48
+ '--lobe-flex-direction': getFlexDirection(direction, horizontal)
49
+ } : {}), wrap !== undefined ? {
50
+ '--lobe-flex-wrap': wrap
51
+ } : {}), justifyContent !== undefined ? {
52
+ '--lobe-flex-justify': justifyContent
53
+ } : {}), align !== undefined ? {
54
+ '--lobe-flex-align': align
55
+ } : {}), finalWidth !== undefined ? {
56
+ '--lobe-flex-width': finalWidth
57
+ } : {}), height !== undefined ? {
58
+ '--lobe-flex-height': getCssValue(height)
59
+ } : {}), padding !== undefined ? {
60
+ '--lobe-flex-padding': getCssValue(padding)
61
+ } : {}), paddingInline !== undefined ? {
62
+ '--lobe-flex-padding-inline': getCssValue(paddingInline)
63
+ } : {}), paddingBlock !== undefined ? {
64
+ '--lobe-flex-padding-block': getCssValue(paddingBlock)
65
+ } : {}), gap !== undefined ? {
66
+ '--lobe-flex-gap': getCssValue(gap)
67
+ } : {});
68
+ var mergedStyle = _objectSpread(_objectSpread({}, cssVars), style);
69
+ var baseClassName = 'lobe-flex';
70
+ var mergedClassName = [baseClassName, visible === false ? "".concat(baseClassName, "--hidden") : undefined, prefixCls ? "".concat(prefixCls, "-flex") : undefined, className].filter(Boolean).join(' ');
71
+ return /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
72
+ ref: ref
73
+ }, props), {}, {
74
+ className: mergedClassName,
75
+ style: mergedStyle,
76
+ children: children
77
+ }));
78
+ };
79
+ export default /*#__PURE__*/memo(FlexBasic);
@@ -0,0 +1,2 @@
1
+ export { default } from './FlexBasic';
2
+ export { default as Flexbox } from './FlexBasic';
@@ -0,0 +1,2 @@
1
+ export { default } from "./FlexBasic";
2
+ export { default as Flexbox } from "./FlexBasic";
@@ -0,0 +1,4 @@
1
+ export { default as Center } from './Center';
2
+ export { default as FlexBasic } from './FlexBasic';
3
+ export { default as Flexbox } from './Flexbox';
4
+ export type { CenterProps, ContentPosition, FlexBasicProps, FlexboxProps, FlexDirection, } from './type';
@@ -0,0 +1,3 @@
1
+ export { default as Center } from "./Center";
2
+ export { default as FlexBasic } from "./FlexBasic";
3
+ export { default as Flexbox } from "./Flexbox";
@@ -0,0 +1,20 @@
1
+ .lobe-flex {
2
+ display: flex;
3
+ flex: var(--lobe-flex, 0 1 auto);
4
+ flex-direction: var(--lobe-flex-direction, column);
5
+ flex-wrap: var(--lobe-flex-wrap, nowrap);
6
+ justify-content: var(--lobe-flex-justify, flex-start);
7
+ align-items: var(--lobe-flex-align, stretch);
8
+ width: var(--lobe-flex-width, auto);
9
+ height: var(--lobe-flex-height, auto);
10
+ padding: var(--lobe-flex-padding, 0);
11
+ padding-inline: var(--lobe-flex-padding-inline, initial);
12
+ padding-block: var(--lobe-flex-padding-block, initial);
13
+ gap: var(--lobe-flex-gap, 0);
14
+ }
15
+
16
+ .lobe-flex--hidden {
17
+ display: none;
18
+ }
19
+
20
+
@@ -0,0 +1,105 @@
1
+ import type { CSSProperties, ElementType, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { DOMAttributes } from 'react';
3
+ export type ContentPosition = 'center' | 'end' | 'flex-end' | 'flex-start' | 'start' | 'stretch' | 'baseline';
4
+ export type FlexDirection = 'vertical' | 'vertical-reverse' | 'horizontal' | 'horizontal-reverse';
5
+ export type DivProps = DOMAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>;
6
+ export type CommonSpaceNumber = 2 | 4 | 8 | 12 | 16 | 24;
7
+ /**
8
+ * Flexbox 布局组件的接口
9
+ */
10
+ export interface IFlexbox {
11
+ /**
12
+ * 交叉轴对齐方式
13
+ * @default "stretch"
14
+ */
15
+ align?: ContentPosition;
16
+ /**
17
+ * 渲染的 HTML 元素类型
18
+ * @default "div"
19
+ */
20
+ as?: ElementType;
21
+ /**
22
+ * 子元素
23
+ */
24
+ children?: ReactNode;
25
+ /**
26
+ * 自定义类名
27
+ */
28
+ className?: string;
29
+ /**
30
+ * 主轴方向
31
+ * @default "horizontal"
32
+ */
33
+ direction?: FlexDirection;
34
+ /**
35
+ * 内容分布
36
+ */
37
+ distribution?: CSSProperties['justifyContent'];
38
+ /**
39
+ * flex 值
40
+ * @default "0 1 auto"
41
+ */
42
+ flex?: number | string;
43
+ /**
44
+ * 主轴方向上的间距
45
+ * @default 0
46
+ */
47
+ gap?: CommonSpaceNumber | number | string;
48
+ /**
49
+ * 高度
50
+ * @default "auto"
51
+ */
52
+ height?: number | string;
53
+ /**
54
+ * 是否横向
55
+ * @default false
56
+ */
57
+ horizontal?: boolean;
58
+ /**
59
+ * 主轴对齐方式
60
+ */
61
+ justify?: CSSProperties['justifyContent'];
62
+ /**
63
+ * 内边距
64
+ * @default 0
65
+ */
66
+ padding?: string | number | CommonSpaceNumber;
67
+ /**
68
+ * 块内边距
69
+ */
70
+ paddingBlock?: string | number;
71
+ /**
72
+ * 内联内边距
73
+ */
74
+ paddingInline?: string | number;
75
+ /**
76
+ * 类名前缀
77
+ */
78
+ prefixCls?: string;
79
+ /**
80
+ * ref 引用
81
+ */
82
+ ref?: Ref<HTMLElement>;
83
+ /**
84
+ * 自定义样式
85
+ */
86
+ style?: CSSProperties;
87
+ /**
88
+ * 是否显示
89
+ * @default true
90
+ */
91
+ visible?: boolean;
92
+ /**
93
+ * 宽度
94
+ * @default "auto"
95
+ */
96
+ width?: number | string;
97
+ /**
98
+ * 换行方式
99
+ */
100
+ wrap?: CSSProperties['flexWrap'];
101
+ }
102
+ export interface FlexBasicProps extends IFlexbox, DivProps {
103
+ }
104
+ export type FlexboxProps = FlexBasicProps;
105
+ export type CenterProps = Omit<FlexBasicProps, 'distribution' | 'direction' | 'align'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { FlexDirection } from './type';
2
+ export declare const getPrefix: (prefixCls?: string) => string;
3
+ export declare const getFlexDirection: (direction?: FlexDirection, isHorizontal?: boolean) => "column" | "column-reverse" | "row" | "row-reverse";
4
+ export declare const isSpaceDistribution: (distribution?: string) => boolean | undefined;
5
+ export declare const isHorizontal: (direction?: FlexDirection, isHorizontal?: boolean) => boolean;
6
+ export declare const isVertical: (direction?: FlexDirection, isHorizontal?: boolean) => boolean;
7
+ export declare const getCssValue: (value: string | number | undefined) => string | undefined;
@@ -0,0 +1,39 @@
1
+ export var getPrefix = function getPrefix(prefixCls) {
2
+ if (prefixCls) return prefixCls;
3
+ return 'lobe';
4
+ };
5
+ export var getFlexDirection = function getFlexDirection(direction, isHorizontal) {
6
+ if (isHorizontal) return 'row';
7
+ switch (direction) {
8
+ case 'horizontal':
9
+ {
10
+ return 'row';
11
+ }
12
+ case 'horizontal-reverse':
13
+ {
14
+ return 'row-reverse';
15
+ }
16
+ case 'vertical':
17
+ default:
18
+ {
19
+ return 'column';
20
+ }
21
+ case 'vertical-reverse':
22
+ {
23
+ return 'column-reverse';
24
+ }
25
+ }
26
+ };
27
+ export var isSpaceDistribution = function isSpaceDistribution(distribution) {
28
+ if (!distribution) return;
29
+ return ['space-between', 'space-around', 'space-evenly'].includes(distribution);
30
+ };
31
+ export var isHorizontal = function isHorizontal(direction, _isHorizontal) {
32
+ return getFlexDirection(direction, _isHorizontal) === 'row';
33
+ };
34
+ export var isVertical = function isVertical(direction, isHorizontal) {
35
+ return getFlexDirection(direction, isHorizontal) === 'column';
36
+ };
37
+ export var getCssValue = function getCssValue(value) {
38
+ return typeof value === 'number' ? "".concat(value, "px") : value;
39
+ };
@@ -11,11 +11,6 @@ type TooltipFloatingProps = {
11
11
  floatingStyles: CSSProperties;
12
12
  hotkey?: TooltipProps['hotkey'];
13
13
  hotkeyProps?: TooltipProps['hotkeyProps'];
14
- /**
15
- * Enable Framer Motion layout/position tweening when provided.
16
- * Useful for TooltipGroup where the floating position changes frequently.
17
- */
18
- layoutId?: string;
19
14
  open: boolean;
20
15
  placement?: Placement;
21
16
  setFloating: (node: HTMLElement | null) => void;
@@ -23,8 +18,5 @@ type TooltipFloatingProps = {
23
18
  title?: ReactNode;
24
19
  zIndex?: TooltipProps['zIndex'];
25
20
  };
26
- declare const TooltipFloating: {
27
- ({ open, title, placement, floatingStyles, setFloating, floatingProps, arrow, arrowRef, context, hotkey, hotkeyProps, layoutId, className, classNames, styles: styleProps, zIndex, }: TooltipFloatingProps): import("react/jsx-runtime").JSX.Element;
28
- displayName: string;
29
- };
21
+ declare const TooltipFloating: ({ open, title, placement, floatingStyles, setFloating, floatingProps, arrow, arrowRef, context, hotkey, hotkeyProps, className, classNames, styles: styleProps, zIndex, }: TooltipFloatingProps) => import("react/jsx-runtime").JSX.Element;
30
22
  export default TooltipFloating;
@@ -6,8 +6,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
8
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ 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); }
12
+ 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; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
15
  import { FloatingArrow } from '@floating-ui/react';
10
- import { useMemo } from 'react';
16
+ import React, { useLayoutEffect, useMemo, useState } from 'react';
11
17
  import { Flexbox } from 'react-layout-kit';
12
18
  import Hotkey from "../Hotkey";
13
19
  import { AnimatePresence, LazyMotion, m } from "../motion";
@@ -26,7 +32,6 @@ var TooltipFloating = function TooltipFloating(_ref) {
26
32
  context = _ref.context,
27
33
  hotkey = _ref.hotkey,
28
34
  hotkeyProps = _ref.hotkeyProps,
29
- layoutId = _ref.layoutId,
30
35
  className = _ref.className,
31
36
  classNames = _ref.classNames,
32
37
  styleProps = _ref.styles,
@@ -59,43 +64,47 @@ var TooltipFloating = function TooltipFloating(_ref) {
59
64
  }
60
65
  }
61
66
  }, [placement]);
67
+ var _useState = useState(false),
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ openNextTick = _useState2[0],
70
+ setOpenNextTick = _useState2[1];
71
+ useLayoutEffect(function () {
72
+ if (!open) {
73
+ setOpenNextTick(false);
74
+ return;
75
+ }
76
+ var rafId = requestAnimationFrame(function () {
77
+ setOpenNextTick(true);
78
+ });
79
+ return function () {
80
+ cancelAnimationFrame(rafId);
81
+ };
82
+ }, [open]);
62
83
  return /*#__PURE__*/_jsx(LazyMotion, {
63
84
  children: /*#__PURE__*/_jsx(AnimatePresence, {
64
- children: open && title && /*#__PURE__*/_jsx(m.div, _objectSpread(_objectSpread({
65
- animate: {
66
- opacity: 1
67
- },
68
- className: cx(styles.tooltip, classNames === null || classNames === void 0 ? void 0 : classNames.container, classNames === null || classNames === void 0 ? void 0 : classNames.root, className),
69
- exit: {
70
- opacity: 0
71
- },
72
- initial: {
73
- opacity: 0
74
- },
85
+ children: open && title && /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
86
+ className: cx(styles.tooltip, openNextTick && styles.tooltipLayout, classNames === null || classNames === void 0 ? void 0 : classNames.container, classNames === null || classNames === void 0 ? void 0 : classNames.root, className),
75
87
  ref: setFloating,
76
88
  role: "tooltip",
77
89
  style: styleProps !== null && styleProps !== void 0 && styleProps.root ? _objectSpread(_objectSpread(_objectSpread({}, floatingStyles), {}, {
78
90
  zIndex: zIndex
79
91
  }, styleProps.container), styleProps.root) : _objectSpread(_objectSpread({}, floatingStyles), {}, {
80
92
  zIndex: zIndex
81
- }, styleProps === null || styleProps === void 0 ? void 0 : styleProps.container),
82
- transition: {
83
- duration: 0.12,
84
- ease: [0.4, 0, 0.2, 1]
85
- }
93
+ }, styleProps === null || styleProps === void 0 ? void 0 : styleProps.container)
86
94
  }, floatingProps), {}, {
87
95
  children: /*#__PURE__*/_jsxs(m.div, {
88
96
  animate: {
97
+ opacity: 1,
89
98
  scale: 1
90
99
  },
91
100
  exit: {
101
+ opacity: 0,
92
102
  scale: 0.98
93
103
  },
94
104
  initial: {
105
+ opacity: 0,
95
106
  scale: 0.96
96
107
  },
97
- layout: layoutId ? 'position' : undefined,
98
- layoutId: layoutId,
99
108
  style: {
100
109
  transformOrigin: transformOrigin
101
110
  },
@@ -131,5 +140,4 @@ var TooltipFloating = function TooltipFloating(_ref) {
131
140
  })
132
141
  });
133
142
  };
134
- TooltipFloating.displayName = 'TooltipFloating';
135
143
  export default TooltipFloating;
@@ -1,6 +1,6 @@
1
- import { type ReactNode } from 'react';
1
+ import { type FC, type ReactNode } from 'react';
2
2
  type TooltipGroupProps = {
3
3
  children: ReactNode;
4
4
  };
5
- declare const TooltipGroup: import("react").NamedExoticComponent<TooltipGroupProps>;
5
+ declare const TooltipGroup: FC<TooltipGroupProps>;
6
6
  export default TooltipGroup;
@@ -7,23 +7,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7
7
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  import { arrow as arrowMiddleware, autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/react';
10
- import { memo, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
10
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
11
  import { antdPlacementToFloating } from "./antdPlacementToFloating";
12
12
  import TooltipFloating from "./TooltipFloating";
13
13
  import TooltipPortal from "./TooltipPortal";
14
14
  import { TooltipGroupContext } from "./groupContext";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
- var TooltipGroup = /*#__PURE__*/memo(function (_ref) {
17
+ var TooltipGroup = function TooltipGroup(_ref) {
18
18
  var _active$item$portalle;
19
19
  var children = _ref.children;
20
20
  var arrowRef = useRef(null);
21
21
  var openTimerRef = useRef(null);
22
22
  var closeTimerRef = useRef(null);
23
- var internalGroupId = useId();
24
- var motionLayoutId = useMemo(function () {
25
- return "lobe-ui-tooltip-group:".concat(internalGroupId);
26
- }, [internalGroupId]);
27
23
  var _useState = useState(null),
28
24
  _useState2 = _slicedToArray(_useState, 2),
29
25
  active = _useState2[0],
@@ -139,7 +135,6 @@ var TooltipGroup = /*#__PURE__*/memo(function (_ref) {
139
135
  floatingStyles: floatingStyles,
140
136
  hotkey: active === null || active === void 0 ? void 0 : active.item.hotkey,
141
137
  hotkeyProps: active === null || active === void 0 ? void 0 : active.item.hotkeyProps,
142
- layoutId: motionLayoutId,
143
138
  open: open,
144
139
  placement: floatingPlacement,
145
140
  setFloating: refs.setFloating,
@@ -154,6 +149,5 @@ var TooltipGroup = /*#__PURE__*/memo(function (_ref) {
154
149
  children: floatingNode
155
150
  }) : floatingNode)]
156
151
  });
157
- });
158
- TooltipGroup.displayName = 'TooltipGroup';
152
+ };
159
153
  export default TooltipGroup;
@@ -2,4 +2,5 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
2
2
  arrow: import("antd-style").SerializedStyles;
3
3
  content: import("antd-style").SerializedStyles;
4
4
  tooltip: import("antd-style").SerializedStyles;
5
+ tooltipLayout: import("antd-style").SerializedStyles;
5
6
  }>;
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref) {
@@ -7,6 +7,7 @@ export var useStyles = createStyles(function (_ref) {
7
7
  return {
8
8
  arrow: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), token.colorText),
9
9
  content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 8px;\n border-radius: ", "px;\n\n color: ", ";\n word-break: normal;\n\n background-color: ", ";\n "])), token.borderRadiusSM, token.colorBgLayout, token.colorText),
10
- tooltip: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n /* Keep the class name for backwards compatibility and user overrides */\n position: relative;\n z-index: 114514;\n filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 12%));\n "])))
10
+ tooltip: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n /* Keep the class name for backwards compatibility and user overrides */\n position: relative;\n z-index: 114514;\n filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 12%));\n "]))),
11
+ tooltipLayout: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: all 0.2s ease-in-out;\n "])))
11
12
  };
12
13
  });
package/es/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export { default as EditableText, type EditableTextProps } from './EditableText'
22
22
  export { default as EmojiPicker, type EmojiPickerProps } from './EmojiPicker';
23
23
  export { default as Empty, type EmptyProps } from './Empty';
24
24
  export { default as FileTypeIcon, type FileTypeIconProps } from './FileTypeIcon';
25
+ export { Center, type CenterProps, FlexBasic, type FlexBasicProps, Flexbox, type FlexboxProps, } from './Flex';
25
26
  export { default as FluentEmoji, type FluentEmojiProps } from './FluentEmoji';
26
27
  export { default as FontLoader, type FontLoaderProps } from './FontLoader';
27
28
  export { default as Footer, type FooterProps } from './Footer';
package/es/index.js CHANGED
@@ -22,6 +22,7 @@ export { default as EditableText } from "./EditableText";
22
22
  export { default as EmojiPicker } from "./EmojiPicker";
23
23
  export { default as Empty } from "./Empty";
24
24
  export { default as FileTypeIcon } from "./FileTypeIcon";
25
+ export { Center, FlexBasic, Flexbox } from "./Flex";
25
26
  export { default as FluentEmoji } from "./FluentEmoji";
26
27
  export { default as FontLoader } from "./FontLoader";
27
28
  export { default as Footer } from "./Footer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",