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.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
- containerStyle: r = {}
41264
+ rootMargin: r = 80,
41265
+ containerStyle: i = {}
41265
41266
  }) => {
41266
- const [i, o] = Ne.useState(0), a = Ne.useRef(!1), s = Ne.useRef(null), l = (u) => {
41267
- a.current = !0, s.current && clearTimeout(s.current), s.current = setTimeout(() => {
41268
- a.current = !1;
41269
- }, u);
41270
- }, c = (u) => {
41271
- var h, p;
41272
- o(u), l(800);
41273
- const d = (p = (h = e == null ? void 0 : e[u]) == null ? void 0 : h.href) == null ? void 0 : p.current;
41274
- if (!d) return;
41275
- const f = d.getBoundingClientRect().top + window.pageYOffset - n;
41276
- window.scrollTo({ top: f, 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" });
41277
41278
  };
41278
41279
  return Ne.useEffect(() => {
41279
- const u = (e || []).map((f, h) => {
41280
- var p;
41281
- return { key: h, el: (p = f.href) == null ? void 0 : p.current };
41282
- }).filter((f) => f.el);
41283
- if (!u.length) return;
41284
- const d = new IntersectionObserver(
41285
- (f) => {
41286
- if (a.current) return;
41287
- const h = f.filter((g) => g.isIntersecting).sort((g, v) => g.boundingClientRect.top - v.boundingClientRect.top)[0];
41288
- if (!h) return;
41289
- const p = u.find((g) => g.el === h.target);
41290
- p && p.key !== void 0 && o(p.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);
41291
41292
  },
41292
41293
  {
41293
41294
  root: null,
41294
41295
  threshold: [0.1, 0.2, 0.3],
41295
- rootMargin: `-${n}px 0px -80% 0px`
41296
+ rootMargin: `-${n}px 0px -{rootMargin}% 0px`
41296
41297
  }
41297
41298
  );
41298
- return u.forEach(({ el: f }) => d.observe(f)), () => {
41299
- d.disconnect(), s.current && clearTimeout(s.current);
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
- ...r
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((u, d) => {
41322
- const f = d === i;
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: () => c(d),
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: f ? "#F0F6FF" : "transparent",
41333
+ background: h ? "#F0F6FF" : "transparent",
41333
41334
  transition: "background 150ms ease"
41334
41335
  },
41335
- children: /* @__PURE__ */ m.jsx(P7e, { children: u == null ? void 0 : u.name })
41336
+ children: /* @__PURE__ */ m.jsx(P7e, { children: d == null ? void 0 : d.name })
41336
41337
  },
41337
- d
41338
+ f
41338
41339
  );
41339
41340
  })
41340
41341
  ]