@lobehub/ui 3.0.0 → 3.1.1

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 (40) hide show
  1. package/es/Accordion/AccordionItem.js +1 -7
  2. package/es/ActionIcon/type.d.ts +1 -1
  3. package/es/Alert/Alert.js +10 -11
  4. package/es/Alert/style.js +1 -1
  5. package/es/Avatar/type.d.ts +1 -1
  6. package/es/Image/components/usePreview.js +26 -20
  7. package/es/Image/components/usePreviewGroup.js +13 -7
  8. package/es/Image/type.d.ts +2 -2
  9. package/es/Mermaid/SyntaxMermaid/index.js +1 -8
  10. package/es/Tabs/Tabs.js +12 -6
  11. package/es/Toc/TocMobile.js +1 -1
  12. package/es/Tooltip/Tooltip.d.ts +2 -2
  13. package/es/Tooltip/Tooltip.js +240 -33
  14. package/es/Tooltip/TooltipFloating.d.ts +30 -0
  15. package/es/Tooltip/TooltipFloating.js +135 -0
  16. package/es/Tooltip/TooltipGroup.d.ts +6 -0
  17. package/es/Tooltip/TooltipGroup.js +159 -0
  18. package/es/Tooltip/TooltipPortal.d.ts +7 -0
  19. package/es/Tooltip/TooltipPortal.js +46 -0
  20. package/es/Tooltip/antdPlacementToFloating.d.ts +9 -0
  21. package/es/Tooltip/antdPlacementToFloating.js +51 -0
  22. package/es/Tooltip/groupContext.d.ts +10 -0
  23. package/es/Tooltip/groupContext.js +2 -0
  24. package/es/Tooltip/index.d.ts +1 -0
  25. package/es/Tooltip/index.js +2 -1
  26. package/es/Tooltip/style.d.ts +2 -0
  27. package/es/Tooltip/style.js +5 -4
  28. package/es/Tooltip/type.d.ts +93 -5
  29. package/es/index.d.ts +1 -1
  30. package/es/index.js +1 -1
  31. package/es/mdx/Mdx/index.js +1 -1
  32. package/es/motion/LazyMotion.d.ts +15 -0
  33. package/es/motion/LazyMotion.js +26 -0
  34. package/es/motion/index.d.ts +3 -0
  35. package/es/motion/index.js +3 -0
  36. package/es/motion/loadFeatures.d.ts +9 -0
  37. package/es/motion/loadFeatures.js +10 -0
  38. package/es/utils/composeEventHandlers.d.ts +19 -0
  39. package/es/utils/composeEventHandlers.js +26 -0
  40. package/package.json +1 -1
@@ -0,0 +1,26 @@
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 = ["features"];
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 { LazyMotion as MotionLazyMotion } from 'motion/react';
13
+ import { memo } from 'react';
14
+ import { loadFeatures } from "./loadFeatures";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ /**
17
+ * A project-wide `LazyMotion` wrapper that provides a shared default `features` loader.
18
+ */
19
+ export var LazyMotion = /*#__PURE__*/memo(function (_ref) {
20
+ var features = _ref.features,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ return /*#__PURE__*/_jsx(MotionLazyMotion, _objectSpread({
23
+ features: features !== null && features !== void 0 ? features : loadFeatures
24
+ }, props));
25
+ });
26
+ LazyMotion.displayName = 'LazyMotion';
@@ -0,0 +1,3 @@
1
+ export { LazyMotion, type LobeLazyMotionProps } from './LazyMotion';
2
+ export { loadFeatures } from './loadFeatures';
3
+ export { AnimatePresence, m } from 'motion/react';
@@ -0,0 +1,3 @@
1
+ export { LazyMotion } from "./LazyMotion";
2
+ export { loadFeatures } from "./loadFeatures";
3
+ export { AnimatePresence, m } from 'motion/react';
@@ -0,0 +1,9 @@
1
+ import { LazyMotion as MotionLazyMotion } from 'motion/react';
2
+ import type { ComponentProps } from 'react';
3
+ /**
4
+ * Shared lazy-loaded Motion features bundle.
5
+ * Using a dynamic import keeps the initial bundle lighter and avoids repeating this logic across components.
6
+ */
7
+ type MotionLazyMotionProps = ComponentProps<typeof MotionLazyMotion>;
8
+ export declare const loadFeatures: MotionLazyMotionProps['features'];
9
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared lazy-loaded Motion features bundle.
3
+ * Using a dynamic import keeps the initial bundle lighter and avoids repeating this logic across components.
4
+ */
5
+
6
+ export var loadFeatures = function loadFeatures() {
7
+ return import('motion/react').then(function (res) {
8
+ return res.domAnimation;
9
+ });
10
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Composes two event handlers together, calling the external handler first,
3
+ * then the internal handler if the event hasn't been prevented.
4
+ *
5
+ * @template E - The event type
6
+ * @param theirHandler - The external event handler (may be undefined)
7
+ * @param ourHandler - The internal event handler
8
+ * @returns A composed event handler that calls both handlers in sequence
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <button
13
+ * onClick={composeEventHandlers(externalOnClick, (e) => {
14
+ * // Internal handler logic
15
+ * })}
16
+ * />
17
+ * ```
18
+ */
19
+ export declare const composeEventHandlers: <E>(theirHandler: ((event: E) => void) | undefined, ourHandler: (event: E) => void) => (event: E) => void;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Composes two event handlers together, calling the external handler first,
3
+ * then the internal handler if the event hasn't been prevented.
4
+ *
5
+ * @template E - The event type
6
+ * @param theirHandler - The external event handler (may be undefined)
7
+ * @param ourHandler - The internal event handler
8
+ * @returns A composed event handler that calls both handlers in sequence
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <button
13
+ * onClick={composeEventHandlers(externalOnClick, (e) => {
14
+ * // Internal handler logic
15
+ * })}
16
+ * />
17
+ * ```
18
+ */
19
+ export var composeEventHandlers = function composeEventHandlers(theirHandler, ourHandler) {
20
+ return function (event) {
21
+ theirHandler === null || theirHandler === void 0 || theirHandler(event);
22
+ // @ts-ignore - compatible with React SyntheticEvent shape
23
+ if (event !== null && event !== void 0 && event.defaultPrevented) return;
24
+ ourHandler(event);
25
+ };
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",