@cypress-design/react-docmenu 0.6.0 → 0.7.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/DocMenuReact.cy.tsx +44 -73
- package/_DocLink.tsx +26 -1
- package/dist/_DocLink.d.ts.map +1 -1
- package/dist/index.es.mjs +22 -2
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +22 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -201,10 +201,30 @@ var DocLink = React__namespace.forwardRef(function (_a, ref) {
|
|
|
201
201
|
// on mount, if the item is active,
|
|
202
202
|
// send the top position to the parent
|
|
203
203
|
React__namespace.useEffect(setActiveMarkerPosition, [onActive, active]);
|
|
204
|
+
React__namespace.useEffect(function () {
|
|
205
|
+
// if active check if the item is visible in the
|
|
206
|
+
// viewport and scrollIntoView if not
|
|
207
|
+
setTimeout(function () {
|
|
208
|
+
// give it time tp render and expand
|
|
209
|
+
if (active && activeLIRef.current) {
|
|
210
|
+
var rect = activeLIRef.current.getBoundingClientRect();
|
|
211
|
+
if (rect.top > 0 &&
|
|
212
|
+
rect.bottom < window.innerHeight &&
|
|
213
|
+
rect.left > 0 &&
|
|
214
|
+
rect.right < window.innerWidth) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
activeLIRef.current.scrollIntoView({
|
|
218
|
+
block: 'nearest',
|
|
219
|
+
inline: 'nearest',
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}, 200);
|
|
223
|
+
}, [active]);
|
|
204
224
|
React__namespace.useImperativeHandle(ref, function () { return ({
|
|
205
225
|
setActiveMarkerPosition: setActiveMarkerPosition,
|
|
206
226
|
}); });
|
|
207
|
-
return (React__namespace.createElement("li", { ref: activeLIRef, className: "list-none p-0" },
|
|
227
|
+
return (React__namespace.createElement("li", { ref: activeLIRef, className: "list-none p-0 scroll-my-10" },
|
|
208
228
|
React__namespace.createElement(LinkComponent, __assign$1({}, itemRest, { className: clsx('group relative block w-full pl-[24px]', {
|
|
209
229
|
'text-indigo-500 dark:text-indigo-400': active,
|
|
210
230
|
'text-gray-700 dark:text-gray-500': !active,
|
|
@@ -427,4 +447,4 @@ var DocMenu = function (_a) {
|
|
|
427
447
|
module.exports = DocMenu;
|
|
428
448
|
//# sourceMappingURL=index.umd.js.map
|
|
429
449
|
|
|
430
|
-
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 dark:bg-indigo-400 ml-[6.5px] mt-[4px] transition ease-in-out text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 transition-all grid 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-indigo-400 text-gray-500 bg-indigo-400 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"> */
|
|
450
|
+
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 dark:bg-indigo-400 ml-[6.5px] mt-[4px] transition ease-in-out text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 transition-all grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden filter list-none p-0 visible block inline scroll-my-10 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-indigo-400 text-gray-500 bg-indigo-400 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"> */
|