@faceless-ui/jumplist
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -17,2 +17,3 @@ export declare type JumplistNode = { | ||
clearJumplist: () => void; | ||
rootMargin?: string; | ||
} |
import React from 'react'; | ||
export declare const JumplistNode: React.FC<{ | ||
id?: string; | ||
id: string; | ||
className?: string; | ||
@@ -5,0 +5,0 @@ style?: React.CSSProperties; |
@@ -46,7 +46,9 @@ "use strict"; | ||
var id = props.id, className = props.className, style = props.style, _a = props.htmlElement, htmlElement = _a === void 0 ? 'div' : _a, htmlAttributes = props.htmlAttributes, classPrefix = props.classPrefix, children = props.children; | ||
var syncJumplistItem = (0, JumplistContext_1.useJumplist)().syncJumplistItem; | ||
var _b = (0, JumplistContext_1.useJumplist)(), syncJumplistItem = _b.syncJumplistItem, rootMargin = _b.rootMargin; | ||
var baseClass = "".concat(classPrefix, "__jumplist-node"); | ||
var Tag = htmlElement; | ||
var nodeRef = (0, react_1.useRef)(null); | ||
var isIntersecting = (0, useIntersection_1.default)(nodeRef).isIntersecting; | ||
var isIntersecting = (0, useIntersection_1.default)(nodeRef, { | ||
rootMargin: rootMargin | ||
}).isIntersecting; | ||
(0, react_1.useEffect)(function () { | ||
@@ -53,0 +55,0 @@ syncJumplistItem({ |
@@ -7,2 +7,3 @@ import React from 'react'; | ||
nodes?: JumplistNodes; | ||
rootMargin?: string; | ||
}>; |
@@ -42,3 +42,3 @@ "use strict"; | ||
var JumplistProvider = function (props) { | ||
var children = props.children, classPrefix = props.classPrefix, nodesFromProps = props.nodes; | ||
var children = props.children, classPrefix = props.classPrefix, nodesFromProps = props.nodes, rootMargin = props.rootMargin; | ||
var _a = (0, react_1.useReducer)(reducer_1.jumplistReducer, []), nodes = _a[0], dispatchNodes = _a[1]; | ||
@@ -98,3 +98,4 @@ var _b = (0, react_1.useState)(), currentJumplistIndex = _b[0], setCurrentJumplistIndex = _b[1]; // could be -1 if no nodes are intersecting | ||
setActiveJumplistIndex: setActiveJumplistIndex, | ||
clearJumplist: clearJumplist | ||
clearJumplist: clearJumplist, | ||
rootMargin: rootMargin | ||
}; | ||
@@ -101,0 +102,0 @@ return (react_1.default.createElement(JumplistContext_1.JumplistContext.Provider, { value: context }, (children && (typeof children === 'function' ? children(__assign({}, context)) : children)))); |
{ | ||
"name": "@faceless-ui/jumplist", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
754061
1238