quirk-ui 0.1.72 → 0.1.73
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index12.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index12.css');const t=require("react/jsx-runtime"),a=require("react"),f=require("../../utils/mediaUtils.cjs"),$=require("../../utils/blockRenderers.cjs"),q=require("../../../core/context/ThemeContext.cjs"),C=require("../../hooks/useMediaQuery.cjs"),j=require("../../hooks/useStyleClasses.cjs"),I="_layout_1e5td_1",M="_container_1e5td_7",A="_heading_1e5td_23",B="_title_1e5td_28",E="_text_1e5td_28",O="_scroll_1e5td_43",U="_sidebar_1e5td_48",z="_number_1e5td_73",Q="_link_1e5td_91",P="_active_1e5td_106",V="_content_1e5td_118",D="_flex_1e5td_129",F="_item_1e5td_154",G="_image_1e5td_173",H="_eyebrow_1e5td_199",l={layout:I,container:M,heading:A,title:B,text:E,scroll:O,sidebar:U,number:z,link:Q,active:P,content:V,flex:D,item:F,image:G,eyebrow:H};function J({heading:i,items:r,showNumbers:b,styleOptions:N,id:p,renderImage:m,renderRichText:o}){const[y,k]=a.useState(null),{mode:v}=q.useTheme(),h=C.useMediaQuery("(max-width: 768px)"),S=j.useStyleClasses(N),u=a.useRef(!1),_=a.useRef(null),g=a.useRef([]),w=a.useCallback(e=>s=>{g.current[e]=s},[]);a.useEffect(()=>{const e=new IntersectionObserver(s=>{if(u.current)return;const n=s.filter(c=>c.isIntersecting).sort((c,d)=>d.intersectionRatio-c.intersectionRatio);if(n.length>0){const c=n[0].target.getAttribute("id");c&&k(c)}},{rootMargin:"-45% 0px -45% 0px",threshold:.1});return g.current.forEach(s=>{s&&e.observe(s)}),()=>{e.disconnect()}},[r]);const x=a.useCallback(e=>{var s;k(e),u.current=!0,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{u.current=!1},600),(s=document.getElementById(e))==null||s.scrollIntoView({behavior:"smooth",block:"start"})},[]);return t.jsx("section",{id:p,className:`${S} ${l.layout}`,children:t.jsxs("article",{className:l.container,children:[t.jsxs("div",{className:l.heading,children:[t.jsxs("div",{children:[i.eyebrow&&(o==null?void 0:o({blocks:i.eyebrow,className:l.eyebrow})),o==null?void 0:o({blocks:i.title,className:l.title})]}),i.description&&(o==null?void 0:o({blocks:i.description}))]}),t.jsxs("div",{className:l.scroll,children:[t.jsx("nav",{className:l.sidebar,"aria-label":"Section navigation",children:t.jsx("ul",{children:r.map((e,s)=>t.jsx("li",{children:t.jsxs("button",{type:"button",className:`${l.link} ${y===e._key?l.active:""}`,"aria-current":y===e._key?"true":void 0,onClick:()=>x(e._key),children:[b&&t.jsx("div",{className:l.number,"aria-hidden":"true",children:s+1}),e.title&&$.extractText(e.title)]})},e._key))})}),t.jsx("div",{className:l.content,children:r.map((e,s)=>{const n=f.resolveImageUrl(e.image,v),c=f.resolveAltText(e.image,v),d=j.useStyleClasses(e.styleOptions);return t.jsxs("section",{ref:w(s),id:e._key,className:l.item,"aria-labelledby":`${e._key}-heading`,children:[t.jsxs("div",{className:l.text,children:[t.jsxs("div",{className:l.flex,children:[h&&b&&t.jsx("div",{className:l.number,"aria-hidden":"true",children:s+1}),e.title&&(o==null?void 0:o({blocks:e.title,className:l.title}))]}),e.description&&(o==null?void 0:o({blocks:e.description}))]}),e.image&&n&&t.jsx("div",{className:` ${d} ${l.image}`,children:m?m({src:n,alt:c,width:600,height:400,priority:s===0,loading:s===0?"eager":"lazy"}):t.jsx("img",{src:n,alt:c,width:600,height:400,loading:s===0?"eager":"lazy"})})]},e._key)})})]})]})})}exports.StickyScrollBlock=J;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as a, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { useState as A, useRef as d, useCallback as
|
|
2
|
+
import { useState as A, useRef as d, useCallback as p, useEffect as E } from "react";
|
|
3
3
|
import { resolveImageUrl as M, resolveAltText as j } from "../../utils/mediaUtils.mjs";
|
|
4
4
|
import { extractText as z } from "../../utils/blockRenderers.mjs";
|
|
5
5
|
import { useTheme as B } from "../../../core/context/ThemeContext.mjs";
|
|
6
|
-
import { useMediaQuery as
|
|
7
|
-
import { useStyleClasses as
|
|
8
|
-
import '../../../index12.css';const
|
|
9
|
-
layout:
|
|
10
|
-
container:
|
|
11
|
-
heading:
|
|
12
|
-
title:
|
|
13
|
-
text:
|
|
14
|
-
scroll:
|
|
15
|
-
sidebar:
|
|
16
|
-
number:
|
|
17
|
-
link:
|
|
18
|
-
active:
|
|
6
|
+
import { useMediaQuery as O } from "../../hooks/useMediaQuery.mjs";
|
|
7
|
+
import { useStyleClasses as N } from "../../hooks/useStyleClasses.mjs";
|
|
8
|
+
import '../../../index12.css';const U = "_layout_1e5td_1", Q = "_container_1e5td_7", V = "_heading_1e5td_23", q = "_title_1e5td_28", D = "_text_1e5td_28", F = "_scroll_1e5td_43", G = "_sidebar_1e5td_48", H = "_number_1e5td_73", J = "_link_1e5td_91", L = "_active_1e5td_106", P = "_content_1e5td_118", W = "_flex_1e5td_129", X = "_item_1e5td_154", Y = "_image_1e5td_173", Z = "_eyebrow_1e5td_199", s = {
|
|
9
|
+
layout: U,
|
|
10
|
+
container: Q,
|
|
11
|
+
heading: V,
|
|
12
|
+
title: q,
|
|
13
|
+
text: D,
|
|
14
|
+
scroll: F,
|
|
15
|
+
sidebar: G,
|
|
16
|
+
number: H,
|
|
17
|
+
link: J,
|
|
18
|
+
active: L,
|
|
19
19
|
content: P,
|
|
20
20
|
flex: W,
|
|
21
21
|
item: X,
|
|
@@ -26,14 +26,14 @@ function lt({
|
|
|
26
26
|
heading: n,
|
|
27
27
|
items: r,
|
|
28
28
|
showNumbers: b,
|
|
29
|
-
styleOptions:
|
|
29
|
+
styleOptions: w,
|
|
30
30
|
id: h,
|
|
31
|
-
renderImage:
|
|
31
|
+
renderImage: f,
|
|
32
32
|
renderRichText: l
|
|
33
33
|
}) {
|
|
34
|
-
const [y,
|
|
34
|
+
const [y, v] = A(null), { mode: g } = B(), I = O("(max-width: 768px)"), $ = N(w), _ = d(!1), m = d(null), k = d([]), S = p(
|
|
35
35
|
(t) => (e) => {
|
|
36
|
-
|
|
36
|
+
k.current[t] = e;
|
|
37
37
|
},
|
|
38
38
|
[]
|
|
39
39
|
);
|
|
@@ -44,7 +44,7 @@ function lt({
|
|
|
44
44
|
const i = e.filter((o) => o.isIntersecting).sort((o, u) => u.intersectionRatio - o.intersectionRatio);
|
|
45
45
|
if (i.length > 0) {
|
|
46
46
|
const o = i[0].target.getAttribute("id");
|
|
47
|
-
o &&
|
|
47
|
+
o && v(o);
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
@@ -52,15 +52,15 @@ function lt({
|
|
|
52
52
|
threshold: 0.1
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
|
-
return
|
|
55
|
+
return k.current.forEach((e) => {
|
|
56
56
|
e && t.observe(e);
|
|
57
57
|
}), () => {
|
|
58
58
|
t.disconnect();
|
|
59
59
|
};
|
|
60
60
|
}, [r]);
|
|
61
|
-
const C =
|
|
61
|
+
const C = p((t) => {
|
|
62
62
|
var e;
|
|
63
|
-
|
|
63
|
+
v(t), _.current = !0, m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
64
64
|
_.current = !1;
|
|
65
65
|
}, 600), (e = document.getElementById(t)) == null || e.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
66
66
|
}, []);
|
|
@@ -93,7 +93,7 @@ function lt({
|
|
|
93
93
|
}
|
|
94
94
|
) }, t._key)) }) }),
|
|
95
95
|
/* @__PURE__ */ a("div", { className: s.content, children: r.map((t, e) => {
|
|
96
|
-
const i = M(t.image,
|
|
96
|
+
const i = M(t.image, g), o = j(t.image, g), u = N(t.styleOptions);
|
|
97
97
|
return /* @__PURE__ */ c(
|
|
98
98
|
"section",
|
|
99
99
|
{
|
|
@@ -112,7 +112,7 @@ function lt({
|
|
|
112
112
|
] }),
|
|
113
113
|
t.description && (l == null ? void 0 : l({ blocks: t.description }))
|
|
114
114
|
] }),
|
|
115
|
-
t.image && i && /* @__PURE__ */ a("div", { className: ` ${u} ${s.image}`, children:
|
|
115
|
+
t.image && i && /* @__PURE__ */ a("div", { className: ` ${u} ${s.image}`, children: f ? f({
|
|
116
116
|
src: i,
|
|
117
117
|
alt: o,
|
|
118
118
|
width: 600,
|