@swan-io/lake 7.2.2 → 7.2.3
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/package.json
CHANGED
|
@@ -31,18 +31,10 @@ const Context = createContext((_) => { });
|
|
|
31
31
|
// using `offsetTop` and `offsetHeight` here to avoid calculations
|
|
32
32
|
// being wrong when ancestor has as CSS transform applied
|
|
33
33
|
const getCoordinates = (element, guide) => {
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
let offsetTop = 0;
|
|
40
|
-
let currentElement = element;
|
|
41
|
-
while (currentElement != null && currentElement != guideParent) {
|
|
42
|
-
offsetTop += currentElement.offsetTop;
|
|
43
|
-
currentElement = currentElement.offsetParent;
|
|
44
|
-
}
|
|
45
|
-
return { top: offsetTop, height: offsetHeight };
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const parentTop = (_b = (_a = guide.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().top) !== null && _b !== void 0 ? _b : 0;
|
|
36
|
+
const elementRect = element.getBoundingClientRect();
|
|
37
|
+
return { top: elementRect.top - parentTop, height: elementRect.height };
|
|
46
38
|
};
|
|
47
39
|
export const SidebarNavigationTracker = ({ style, contentContainerStyle, children }) => {
|
|
48
40
|
const [track, setTrackRaw] = useState(null);
|
|
@@ -72,7 +64,8 @@ export const SidebarNavigationTracker = ({ style, contentContainerStyle, childre
|
|
|
72
64
|
return (_jsx(Context.Provider, { value: setTrack, children: _jsxs(ScrollView, { scrollEventThrottle: 30, onLayout: onLayout, style: style, contentContainerStyle: contentContainerStyle, role: "banner", children: [children, _jsx(View, { style: styles.track, ref: trackRef, children: track != null ? (_jsx(View, { style: [
|
|
73
65
|
styles.trackIndicator,
|
|
74
66
|
{
|
|
75
|
-
transform: `translateY(${track.top}px)
|
|
67
|
+
transform: `translateY(${track.top}px)`,
|
|
68
|
+
height: track.height,
|
|
76
69
|
backgroundColor: track.color,
|
|
77
70
|
},
|
|
78
71
|
] })) : null })] }) }));
|
|
@@ -436,6 +436,6 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
436
436
|
}, onChange: onChange, tabs: collapsed, currentUrl: currentLocationURL, otherLabel: otherLabel, activeTabId: activeTabId })) : null, hasRendered && (_jsx(View, { style: [
|
|
437
437
|
styles.underline,
|
|
438
438
|
styles.animatedUnderline,
|
|
439
|
-
{ transform: `translateX(${left}px)
|
|
439
|
+
{ transform: `translateX(${left}px)`, width },
|
|
440
440
|
] }))] }));
|
|
441
441
|
};
|