@cypress-design/react-docmenu 0.5.1 → 0.5.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/DocMenu.tsx +19 -2
- package/_DocGroup.tsx +9 -8
- package/dist/DocMenu.d.ts.map +1 -1
- package/dist/_DocGroup.d.ts.map +1 -1
- package/dist/index.es.mjs +27 -11
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +27 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -230,12 +230,12 @@ var DocGroup = React__namespace.forwardRef(function (_a, ref) {
|
|
|
230
230
|
var _e = React__namespace.useState(group.collapsed !== true), open = _e[0], setOpen = _e[1];
|
|
231
231
|
var $groupElements = React__namespace.useRef(null);
|
|
232
232
|
var $listWrapper = React__namespace.useRef(null);
|
|
233
|
-
function toggleMenu(
|
|
233
|
+
function toggleMenu(localOpen) {
|
|
234
234
|
if (!collapsible)
|
|
235
235
|
return;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
readjustMarkerPosition();
|
|
236
|
+
hideShowAbsoluteMarker(localOpen);
|
|
237
|
+
setOpen(localOpen);
|
|
238
|
+
readjustMarkerPosition(localOpen);
|
|
239
239
|
}
|
|
240
240
|
var hasActiveItemRecursively = React__namespace.useCallback(function (items) {
|
|
241
241
|
if (items === void 0) { items = group.items; }
|
|
@@ -263,21 +263,21 @@ var DocGroup = React__namespace.forwardRef(function (_a, ref) {
|
|
|
263
263
|
* We replace the absolute marker by one in the link. After the transition, the
|
|
264
264
|
* marker is replaced by the absolute one again.
|
|
265
265
|
*/
|
|
266
|
-
function hideShowAbsoluteMarker() {
|
|
266
|
+
function hideShowAbsoluteMarker(localOpen) {
|
|
267
267
|
var _a, _b;
|
|
268
268
|
(_a = $listWrapper.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', function () {
|
|
269
269
|
setMarkerIsMoving(true);
|
|
270
270
|
}, { once: true });
|
|
271
271
|
(_b = $listWrapper.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', function () {
|
|
272
|
-
if (
|
|
272
|
+
if (localOpen || !hasActiveItemRecursively()) {
|
|
273
273
|
updateMarkerPosition === null || updateMarkerPosition === void 0 ? void 0 : updateMarkerPosition();
|
|
274
274
|
}
|
|
275
275
|
setMarkerIsMoving(false);
|
|
276
276
|
}, { once: true });
|
|
277
277
|
}
|
|
278
|
-
function readjustMarkerPosition() {
|
|
278
|
+
function readjustMarkerPosition(localOpen) {
|
|
279
279
|
if (hasActiveItemRecursively()) {
|
|
280
|
-
if (
|
|
280
|
+
if (localOpen) {
|
|
281
281
|
reTriggerSetActiveGroupParent();
|
|
282
282
|
}
|
|
283
283
|
else {
|
|
@@ -337,6 +337,7 @@ var DocGroupElements = React__namespace.forwardRef(function (_a, ref) {
|
|
|
337
337
|
item === null || item === void 0 ? void 0 : item.setActiveMarkerPosition();
|
|
338
338
|
});
|
|
339
339
|
// calculate the index of the calling group in the list of groups
|
|
340
|
+
// "index" is the index of the calling group in the list of items (groups and links)
|
|
340
341
|
var indexGroup = index -
|
|
341
342
|
// remove all the items that are not groups from the array and count them
|
|
342
343
|
items.slice(0, index).filter(function (item) { return !('items' in item); }).length;
|
|
@@ -375,7 +376,8 @@ var DocMenu = function (_a) {
|
|
|
375
376
|
var _e = React__namespace.useState(0), activeTop = _e[0], setActiveTop = _e[1];
|
|
376
377
|
var _f = React__namespace.useState(36), activeHeight = _f[0], setActiveHeight = _f[1];
|
|
377
378
|
var _g = React__namespace.useState(false), showMarker = _g[0], setShowMarker = _g[1];
|
|
378
|
-
var _h = React__namespace.useState(false), markerIsMoving = _h[0],
|
|
379
|
+
var _h = React__namespace.useState(false), markerIsMoving = _h[0], localSetMarkerIsMoving = _h[1];
|
|
380
|
+
var _j = React__namespace.useState(true), hasCSSTransition = _j[0], setHasCSSTransition = _j[1];
|
|
379
381
|
var container = React__namespace.useRef(null);
|
|
380
382
|
var setActivePosition = React__namespace.useCallback(function (opts) {
|
|
381
383
|
var _a;
|
|
@@ -385,11 +387,25 @@ var DocMenu = function (_a) {
|
|
|
385
387
|
setActiveHeight(opts.height);
|
|
386
388
|
}, []);
|
|
387
389
|
var setShowMarkerFalse = React__namespace.useCallback(function () { return setShowMarker(false); }, []);
|
|
390
|
+
var setMarkerIsMoving = React__namespace.useCallback(function (val) {
|
|
391
|
+
localSetMarkerIsMoving(val);
|
|
392
|
+
if (!val)
|
|
393
|
+
return;
|
|
394
|
+
// make sure the animation does not fire "after"
|
|
395
|
+
// the marker has reappeared at its right place
|
|
396
|
+
setHasCSSTransition(false);
|
|
397
|
+
setTimeout(function () {
|
|
398
|
+
setHasCSSTransition(true);
|
|
399
|
+
}, 300);
|
|
400
|
+
}, [localSetMarkerIsMoving]);
|
|
388
401
|
return (React__namespace.createElement(MarkerIsMovingContext.Provider, { value: { markerIsMoving: markerIsMoving, setMarkerIsMoving: setMarkerIsMoving } },
|
|
389
402
|
React__namespace.createElement("div", { ref: container, className: "relative" },
|
|
390
|
-
showMarker && !markerIsMoving && collapsible ? (React__namespace.createElement("div", { className: "absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500
|
|
403
|
+
showMarker && !markerIsMoving && collapsible ? (React__namespace.createElement("div", { className: "absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 ml-[6.5px] mt-[4px]", style: {
|
|
391
404
|
top: "".concat(activeTop, "px"),
|
|
392
405
|
height: "".concat(activeHeight - 8, "px"),
|
|
406
|
+
transition: hasCSSTransition
|
|
407
|
+
? 'height .3s ease-in-out, top .3s ease-in-out'
|
|
408
|
+
: 'none',
|
|
393
409
|
} })) : null,
|
|
394
410
|
React__namespace.createElement(DocGroupElements, __assign$1({}, rest, { items: items, activePath: activePath, collapsible: collapsible, depth: -1, onActivePosition: setActivePosition, LinkComponent: LinkComponent, hideMarker: setShowMarkerFalse })))));
|
|
395
411
|
};
|
|
@@ -397,4 +413,4 @@ var DocMenu = function (_a) {
|
|
|
397
413
|
module.exports = DocMenu;
|
|
398
414
|
//# sourceMappingURL=index.umd.js.map
|
|
399
415
|
|
|
400
|
-
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500
|
|
416
|
+
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 ml-[6.5px] mt-[4px] transition ease-in-out text-indigo-500 rotate-0 -rotate-90 ml-[28px] grid transition-all grid-rows-[0fr] grid-rows-[1fr] overflow-hidden filter list-none p-0 block w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-gray-500 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
|