gf-components 0.1.161 → 0.1.162
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +35 -34
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/anchor/Anchor.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -41261,42 +41261,43 @@ const za = 12, d1 = 14, Rs = Bt.tspan`
|
|
|
41261
41261
|
items: e,
|
|
41262
41262
|
width: t = 226,
|
|
41263
41263
|
offset: n = 0,
|
|
41264
|
-
|
|
41264
|
+
rootMargin: r = 80,
|
|
41265
|
+
containerStyle: i = {}
|
|
41265
41266
|
}) => {
|
|
41266
|
-
const [
|
|
41267
|
-
|
|
41268
|
-
|
|
41269
|
-
},
|
|
41270
|
-
},
|
|
41271
|
-
var
|
|
41272
|
-
|
|
41273
|
-
const
|
|
41274
|
-
if (!
|
|
41275
|
-
const
|
|
41276
|
-
window.scrollTo({ top:
|
|
41267
|
+
const [o, a] = Ne.useState(0), s = Ne.useRef(!1), l = Ne.useRef(null), c = (d) => {
|
|
41268
|
+
s.current = !0, l.current && clearTimeout(l.current), l.current = setTimeout(() => {
|
|
41269
|
+
s.current = !1;
|
|
41270
|
+
}, d);
|
|
41271
|
+
}, u = (d) => {
|
|
41272
|
+
var p, g;
|
|
41273
|
+
a(d), c(800);
|
|
41274
|
+
const f = (g = (p = e == null ? void 0 : e[d]) == null ? void 0 : p.href) == null ? void 0 : g.current;
|
|
41275
|
+
if (!f) return;
|
|
41276
|
+
const h = f.getBoundingClientRect().top + window.pageYOffset - n;
|
|
41277
|
+
window.scrollTo({ top: h, behavior: "smooth" });
|
|
41277
41278
|
};
|
|
41278
41279
|
return Ne.useEffect(() => {
|
|
41279
|
-
const
|
|
41280
|
-
var
|
|
41281
|
-
return { key:
|
|
41282
|
-
}).filter((
|
|
41283
|
-
if (!
|
|
41284
|
-
const
|
|
41285
|
-
(
|
|
41286
|
-
if (
|
|
41287
|
-
const
|
|
41288
|
-
if (!
|
|
41289
|
-
const
|
|
41290
|
-
|
|
41280
|
+
const d = (e || []).map((h, p) => {
|
|
41281
|
+
var g;
|
|
41282
|
+
return { key: p, el: (g = h.href) == null ? void 0 : g.current };
|
|
41283
|
+
}).filter((h) => h.el);
|
|
41284
|
+
if (!d.length) return;
|
|
41285
|
+
const f = new IntersectionObserver(
|
|
41286
|
+
(h) => {
|
|
41287
|
+
if (s.current) return;
|
|
41288
|
+
const p = h.filter((v) => v.isIntersecting).sort((v, b) => v.boundingClientRect.top - b.boundingClientRect.top)[0];
|
|
41289
|
+
if (!p) return;
|
|
41290
|
+
const g = d.find((v) => v.el === p.target);
|
|
41291
|
+
g && g.key !== void 0 && a(g.key);
|
|
41291
41292
|
},
|
|
41292
41293
|
{
|
|
41293
41294
|
root: null,
|
|
41294
41295
|
threshold: [0.1, 0.2, 0.3],
|
|
41295
|
-
rootMargin: `-${n}px 0px -
|
|
41296
|
+
rootMargin: `-${n}px 0px -{rootMargin}% 0px`
|
|
41296
41297
|
}
|
|
41297
41298
|
);
|
|
41298
|
-
return
|
|
41299
|
-
|
|
41299
|
+
return d.forEach(({ el: h }) => f.observe(h)), () => {
|
|
41300
|
+
f.disconnect(), l.current && clearTimeout(l.current);
|
|
41300
41301
|
};
|
|
41301
41302
|
}, [e]), /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
41302
41303
|
/* @__PURE__ */ m.jsx($n, {}),
|
|
@@ -41314,27 +41315,27 @@ const za = 12, d1 = 14, Rs = Bt.tspan`
|
|
|
41314
41315
|
top: n,
|
|
41315
41316
|
position: "sticky",
|
|
41316
41317
|
paddingRight: 8,
|
|
41317
|
-
...
|
|
41318
|
+
...i
|
|
41318
41319
|
},
|
|
41319
41320
|
children: [
|
|
41320
41321
|
/* @__PURE__ */ m.jsx("span", { style: { fontSize: 12 }, children: "Inhoudsopgave".toUpperCase() }),
|
|
41321
|
-
e == null ? void 0 : e.map((
|
|
41322
|
-
const
|
|
41322
|
+
e == null ? void 0 : e.map((d, f) => {
|
|
41323
|
+
const h = f === o;
|
|
41323
41324
|
return /* @__PURE__ */ m.jsx(
|
|
41324
41325
|
"div",
|
|
41325
41326
|
{
|
|
41326
|
-
onClick: () =>
|
|
41327
|
+
onClick: () => u(f),
|
|
41327
41328
|
style: {
|
|
41328
41329
|
width: "100%",
|
|
41329
41330
|
boxSizing: "border-box",
|
|
41330
41331
|
padding: 8,
|
|
41331
41332
|
cursor: "pointer",
|
|
41332
|
-
background:
|
|
41333
|
+
background: h ? "#F0F6FF" : "transparent",
|
|
41333
41334
|
transition: "background 150ms ease"
|
|
41334
41335
|
},
|
|
41335
|
-
children: /* @__PURE__ */ m.jsx(P7e, { children:
|
|
41336
|
+
children: /* @__PURE__ */ m.jsx(P7e, { children: d == null ? void 0 : d.name })
|
|
41336
41337
|
},
|
|
41337
|
-
|
|
41338
|
+
f
|
|
41338
41339
|
);
|
|
41339
41340
|
})
|
|
41340
41341
|
]
|