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