@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.
- package/es/Accordion/AccordionItem.js +1 -7
- package/es/ActionIcon/type.d.ts +1 -1
- package/es/Alert/Alert.js +10 -11
- package/es/Alert/style.js +1 -1
- package/es/Avatar/type.d.ts +1 -1
- package/es/Image/components/usePreview.js +26 -20
- package/es/Image/components/usePreviewGroup.js +13 -7
- package/es/Image/type.d.ts +2 -2
- package/es/Mermaid/SyntaxMermaid/index.js +1 -8
- package/es/Tabs/Tabs.js +12 -6
- package/es/Toc/TocMobile.js +1 -1
- package/es/Tooltip/Tooltip.d.ts +2 -2
- package/es/Tooltip/Tooltip.js +240 -33
- package/es/Tooltip/TooltipFloating.d.ts +30 -0
- package/es/Tooltip/TooltipFloating.js +135 -0
- package/es/Tooltip/TooltipGroup.d.ts +6 -0
- package/es/Tooltip/TooltipGroup.js +159 -0
- package/es/Tooltip/TooltipPortal.d.ts +7 -0
- package/es/Tooltip/TooltipPortal.js +46 -0
- package/es/Tooltip/antdPlacementToFloating.d.ts +9 -0
- package/es/Tooltip/antdPlacementToFloating.js +51 -0
- package/es/Tooltip/groupContext.d.ts +10 -0
- package/es/Tooltip/groupContext.js +2 -0
- package/es/Tooltip/index.d.ts +1 -0
- package/es/Tooltip/index.js +2 -1
- package/es/Tooltip/style.d.ts +2 -0
- package/es/Tooltip/style.js +5 -4
- package/es/Tooltip/type.d.ts +93 -5
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/mdx/Mdx/index.js +1 -1
- package/es/motion/LazyMotion.d.ts +15 -0
- package/es/motion/LazyMotion.js +26 -0
- package/es/motion/index.d.ts +3 -0
- package/es/motion/index.js +3 -0
- package/es/motion/loadFeatures.d.ts +9 -0
- package/es/motion/loadFeatures.js +10 -0
- package/es/utils/composeEventHandlers.d.ts +19 -0
- package/es/utils/composeEventHandlers.js +26 -0
- 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,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
|
+
};
|