@lobehub/ui 2.20.1 → 2.20.2
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.
|
@@ -6,7 +6,7 @@ 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
|
-
import {
|
|
9
|
+
import { LazyMotion, m } from 'framer-motion';
|
|
10
10
|
import { memo, useCallback, useMemo } from 'react';
|
|
11
11
|
import { Flexbox } from 'react-layout-kit';
|
|
12
12
|
import Block from "../Block";
|
|
@@ -114,7 +114,7 @@ var AccordionItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
114
114
|
return _objectSpread({
|
|
115
115
|
animate: isOpen ? 'enter' : 'exit',
|
|
116
116
|
exit: 'exit',
|
|
117
|
-
initial:
|
|
117
|
+
initial: false,
|
|
118
118
|
variants: {
|
|
119
119
|
enter: {
|
|
120
120
|
height: 'auto',
|
|
@@ -138,7 +138,7 @@ var AccordionItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
138
138
|
|
|
139
139
|
// Render content
|
|
140
140
|
var contentElement = useMemo(function () {
|
|
141
|
-
if (disableAnimation) {
|
|
141
|
+
if (disableAnimation || !keepContentMounted) {
|
|
142
142
|
if (keepContentMounted) {
|
|
143
143
|
return /*#__PURE__*/_jsx("div", {
|
|
144
144
|
className: cx('accordion-content', styles.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
|
|
@@ -162,7 +162,7 @@ var AccordionItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
162
162
|
})
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
return
|
|
165
|
+
return /*#__PURE__*/_jsx(LazyMotion, {
|
|
166
166
|
features: loadFeatures,
|
|
167
167
|
children: /*#__PURE__*/_jsx(m.div, _objectSpread(_objectSpread({}, motionProps), {}, {
|
|
168
168
|
style: {
|
|
@@ -178,25 +178,6 @@ var AccordionItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
178
178
|
})
|
|
179
179
|
})
|
|
180
180
|
}))
|
|
181
|
-
}) : /*#__PURE__*/_jsx(AnimatePresence, {
|
|
182
|
-
initial: false,
|
|
183
|
-
children: isOpen && /*#__PURE__*/_jsx(LazyMotion, {
|
|
184
|
-
features: loadFeatures,
|
|
185
|
-
children: /*#__PURE__*/_jsx(m.div, _objectSpread(_objectSpread({}, motionProps), {}, {
|
|
186
|
-
style: {
|
|
187
|
-
overflow: 'hidden'
|
|
188
|
-
},
|
|
189
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
190
|
-
className: cx('accordion-content', styles.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
|
|
191
|
-
role: "region",
|
|
192
|
-
style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.content,
|
|
193
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
194
|
-
className: styles.contentInner,
|
|
195
|
-
children: children
|
|
196
|
-
})
|
|
197
|
-
})
|
|
198
|
-
}))
|
|
199
|
-
})
|
|
200
181
|
});
|
|
201
182
|
}, [disableAnimation, keepContentMounted, isOpen, cx, styles, classNames, customStyles, children, motionProps]);
|
|
202
183
|
var titleNode = useMemo(function () {
|
package/es/Accordion/type.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
|
|
107
107
|
indicatorPlacement?: 'end' | 'start';
|
|
108
108
|
/**
|
|
109
109
|
* Keep content mounted when collapsed
|
|
110
|
-
* @default
|
|
110
|
+
* @default true
|
|
111
111
|
*/
|
|
112
112
|
keepContentMounted?: boolean;
|
|
113
113
|
/**
|