quirk-ui 0.0.550 → 0.0.552

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('../../../assets/index5.css');const t=require("react/jsx-runtime"),r=require("react"),I=require("next/image"),a=require("../../ui/PortableTextRenderer/index.cjs");require("react-dom");const N=require("../../utils/portableTextToPlainText.cjs"),R=require("../../contexts/ThemeContext.cjs"),q="_layout_l5nlh_1",S="_container_l5nlh_7",U="_heading_l5nlh_19",w="_scroll_l5nlh_35",P="_sidebar_l5nlh_40",$="_number_l5nlh_65",A="_link_l5nlh_82",B="_active_l5nlh_96",C="_content_l5nlh_108",E="_item_l5nlh_112",M="_text_l5nlh_124",O="_title_l5nlh_131",V="_image_l5nlh_135",s={layout:q,container:S,heading:U,scroll:w,sidebar:P,number:$,link:A,active:B,content:C,item:E,text:M,title:O,image:V};function z({heading:o,items:_,showNumbers:f}){const[y,u]=r.useState(null),{mode:d}=R.useTheme(),T=r.useRef(null),h=r.useRef([]);return r.useEffect(()=>{const e=new IntersectionObserver(l=>{const n=l.filter(i=>i.isIntersecting).sort((i,c)=>c.intersectionRatio-i.intersectionRatio);if(n.length>0){const i=n[0].target.getAttribute("id");i&&u(i)}},{rootMargin:"-45% 0px -45% 0px",threshold:.1});return h.current.forEach(l=>{l&&e.observe(l)}),T.current=e,()=>{e.disconnect()}},[]),t.jsx("section",{className:s.layout,children:t.jsxs("article",{className:s.container,children:[t.jsxs("div",{className:s.heading,children:[t.jsx(a.RichText,{className:s.title,blocks:o.title}),o.description&&t.jsx(a.RichText,{blocks:o.description})]}),t.jsxs("div",{className:s.scroll,children:[t.jsx("nav",{className:s.sidebar,children:t.jsx("ul",{children:_.map((e,l)=>t.jsx("li",{children:t.jsxs("button",{type:"button",className:`${s.link} ${y===e._key?s.active:""}`,onClick:()=>{u(e._key);const n=document.getElementById(e._key);n==null||n.scrollIntoView({behavior:"smooth",block:"start"})},children:[f&&t.jsx("div",{className:s.number,children:l+1}),e.title&&N.portableTextToPlainText(e.title)]})},e._key))})}),t.jsx("div",{className:s.content,children:_.map((e,l)=>{var c,m,x,g,b,k,v,j;let n;(c=e.image)!=null&&c.imageUrls&&(n=d==="dark"&&((m=e.image.imageUrls.dark)==null?void 0:m.medium)||e.image.imageUrls.default.medium);let i=((b=(g=(x=e.image)==null?void 0:x[d==="dark"?"darkImage":"defaultImage"])==null?void 0:g.asset)==null?void 0:b.altText)||((j=(v=(k=e.image)==null?void 0:k[d==="dark"?"darkImage":"defaultImage"])==null?void 0:v.asset)==null?void 0:j.description)||"Card image";return t.jsxs("section",{ref:p=>{h.current[l]=p},id:e._key,className:s.item,children:[t.jsxs("div",{className:s.text,children:[e.title&&t.jsx(a.RichText,{className:s.title,blocks:e.title}),e.description&&t.jsx(a.RichText,{blocks:e.description})]}),e.image&&n&&t.jsx("div",{className:s.image,children:t.jsx(I,{src:n,alt:i,width:600,height:400,priority:!0})})]},e._key)})})]})]})})}exports.StickyScrollBlock=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index5.css');const t=require("react/jsx-runtime"),r=require("react"),I=require("next/image"),a=require("../../ui/PortableTextRenderer/index.cjs");require("react-dom");const N=require("../../contexts/ThemeContext.cjs"),R=require("../../utils/portableTextToPlainText.cjs"),q="_layout_l5nlh_1",S="_container_l5nlh_7",U="_heading_l5nlh_19",w="_scroll_l5nlh_35",P="_sidebar_l5nlh_40",$="_number_l5nlh_65",A="_link_l5nlh_82",B="_active_l5nlh_96",C="_content_l5nlh_108",E="_item_l5nlh_112",M="_text_l5nlh_124",O="_title_l5nlh_131",V="_image_l5nlh_135",s={layout:q,container:S,heading:U,scroll:w,sidebar:P,number:$,link:A,active:B,content:C,item:E,text:M,title:O,image:V};function z({heading:o,items:_,showNumbers:f}){const[y,u]=r.useState(null),{mode:d}=N.useTheme(),T=r.useRef(null),h=r.useRef([]);return r.useEffect(()=>{const e=new IntersectionObserver(l=>{const n=l.filter(i=>i.isIntersecting).sort((i,c)=>c.intersectionRatio-i.intersectionRatio);if(n.length>0){const i=n[0].target.getAttribute("id");i&&u(i)}},{rootMargin:"-45% 0px -45% 0px",threshold:.1});return h.current.forEach(l=>{l&&e.observe(l)}),T.current=e,()=>{e.disconnect()}},[]),t.jsx("section",{className:s.layout,children:t.jsxs("article",{className:s.container,children:[t.jsxs("div",{className:s.heading,children:[t.jsx(a.RichText,{className:s.title,blocks:o.title}),o.description&&t.jsx(a.RichText,{blocks:o.description})]}),t.jsxs("div",{className:s.scroll,children:[t.jsx("nav",{className:s.sidebar,children:t.jsx("ul",{children:_.map((e,l)=>t.jsx("li",{children:t.jsxs("button",{type:"button",className:`${s.link} ${y===e._key?s.active:""}`,onClick:()=>{u(e._key);const n=document.getElementById(e._key);n==null||n.scrollIntoView({behavior:"smooth",block:"start"})},children:[f&&t.jsx("div",{className:s.number,children:l+1}),e.title&&R.portableTextToPlainText(e.title)]})},e._key))})}),t.jsx("div",{className:s.content,children:_.map((e,l)=>{var c,m,x,g,b,k,v,j;let n;(c=e.image)!=null&&c.imageUrls&&(n=d==="dark"&&((m=e.image.imageUrls.dark)==null?void 0:m.medium)||e.image.imageUrls.default.medium);let i=((b=(g=(x=e.image)==null?void 0:x[d==="dark"?"darkImage":"defaultImage"])==null?void 0:g.asset)==null?void 0:b.altText)||((j=(v=(k=e.image)==null?void 0:k[d==="dark"?"darkImage":"defaultImage"])==null?void 0:v.asset)==null?void 0:j.description)||"Card image";return t.jsxs("section",{ref:p=>{h.current[l]=p},id:e._key,className:s.item,children:[t.jsxs("div",{className:s.text,children:[e.title&&t.jsx(a.RichText,{className:s.title,blocks:e.title}),e.description&&t.jsx(a.RichText,{blocks:e.description})]}),e.image&&n&&t.jsx("div",{className:s.image,children:t.jsx(I,{src:n,alt:i,width:600,height:400,priority:!0})})]},e._key)})})]})]})})}exports.StickyScrollBlock=z;
@@ -3,8 +3,8 @@ import { useState as R, useRef as y, useEffect as U } from "react";
3
3
  import w from "next/image";
4
4
  import { RichText as a } from "../../ui/PortableTextRenderer/index.mjs";
5
5
  import "react-dom";
6
- import { portableTextToPlainText as A } from "../../utils/portableTextToPlainText.mjs";
7
- import { useTheme as E } from "../../contexts/ThemeContext.mjs";
6
+ import { useTheme as A } from "../../contexts/ThemeContext.mjs";
7
+ import { portableTextToPlainText as E } from "../../utils/portableTextToPlainText.mjs";
8
8
  import '../../../assets/index5.css';const S = "_layout_l5nlh_1", j = "_container_l5nlh_7", B = "_heading_l5nlh_19", C = "_scroll_l5nlh_35", $ = "_sidebar_l5nlh_40", M = "_number_l5nlh_65", O = "_link_l5nlh_82", P = "_active_l5nlh_96", V = "_content_l5nlh_108", q = "_item_l5nlh_112", z = "_text_l5nlh_124", D = "_title_l5nlh_131", F = "_image_l5nlh_135", t = {
9
9
  layout: S,
10
10
  container: j,
@@ -25,7 +25,7 @@ function X({
25
25
  items: m,
26
26
  showNumbers: x
27
27
  }) {
28
- const [I, _] = R(null), { mode: d } = E(), N = y(null), h = y([]);
28
+ const [I, _] = R(null), { mode: d } = A(), N = y(null), h = y([]);
29
29
  return U(() => {
30
30
  const e = new IntersectionObserver(
31
31
  (i) => {
@@ -66,7 +66,7 @@ function X({
66
66
  },
67
67
  children: [
68
68
  x && /* @__PURE__ */ l("div", { className: t.number, children: i + 1 }),
69
- e.title && A(e.title)
69
+ e.title && E(e.title)
70
70
  ]
71
71
  }
72
72
  ) }, e._key)) }) }),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),v=require("../../../core/components/ButtonGroup/index.cjs"),i=require("../../../index-BN6814Bi.cjs"),c=require("../../../core/components/Modal/index.cjs"),u=require("../../utils/resolveLinkUrl.cjs");function A({items:e,alignment:g,className:p}){const[d,b]=s.useState([]);return s.useEffect(()=>{if(!(e!=null&&e.length)||!u.resolveLinkURL)return;async function n(){const o=await Promise.all(e.map(l=>u.resolveLinkURL(l)));b(o)}n()},[e]),e!=null&&e.length?r.jsx(v.ButtonGroup,{className:p,alignment:g,children:e.slice(0,3).map((n,o)=>{var t,a;const l=d[o]??"#";switch(n.type){case"link":return r.jsx(i.CallToAction,{as:"a",variant:n.variant??"primary",href:l,target:((t=n.linkOptions)==null?void 0:t.linkType)==="external"?"_blank":"_self",rel:((a=n.linkOptions)==null?void 0:a.linkType)==="external"?"noopener noreferrer":"","aria-label":n.ariaLabel||n.label,icon:n.icon,iconAlignment:n.iconAlignment??"right",children:n.label},o);case"modal":return r.jsx(c.Modal,{trigger:r.jsx(i.CallToAction,{as:"button",variant:n.variant??"primary",icon:n.icon,iconAlignment:n.iconAlignment??"right",children:n.label}),content:n.modalContent},o);case"video":return r.jsx(c.Modal,{trigger:r.jsx(i.CallToAction,{as:"button",variant:n.variant??"primary",icon:n.icon,iconAlignment:n.iconAlignment??"right",children:n.label}),content:r.jsx("video",{src:n.videoUrl,controls:!0,autoPlay:!0})},o);case"download":return r.jsx(i.CallToAction,{as:"a",variant:n.variant??"primary",href:l,download:!0,target:"_blank",rel:"noopener noreferrer","aria-label":n.ariaLabel||n.label,icon:n.icon,iconAlignment:n.iconAlignment??"right",children:n.label},o)}})}):null}exports.CallToActions=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("react"),O=require("next/image"),B=require("../../../core/components/ButtonGroup/index.cjs"),l=require("../../../index-BN6814Bi.cjs"),U=require("../../../core/components/Modal/index.cjs"),L=require("../../utils/resolveLinkUrl.cjs"),G=require("../../contexts/ThemeContext.cjs"),H=require("../../hooks/useMediaQuery.cjs");function Q({items:n,alignment:M,className:I}){const[R,P]=C.useState([]),{mode:a}=G.useTheme(),s=H.useMediaQuery("(max-width: 767px)");return C.useEffect(()=>{if(!(n!=null&&n.length)||!L.resolveLinkURL)return;async function e(){const o=await Promise.all(n.map(t=>L.resolveLinkURL(t)));P(o)}e()},[n]),n!=null&&n.length?r.jsx(B.ButtonGroup,{className:I,alignment:M,children:n.slice(0,3).map((e,o)=>{var g,m,d,c,h,p,f,b,x,v,y,_,k,A,j,T,w,q;const t=R[o]??"#",i={};if(((g=e.image)==null?void 0:g.layout)==="cover")i.objectFit="cover",(m=e.image)!=null&&m.position&&(i.objectPosition=s?"top":(d=e.image)==null?void 0:d.position);else if(((c=e.image)==null?void 0:c.layout)==="contain"){if(i.objectFit="contain",((h=e.image)==null?void 0:h.width)==="half"?i.width=s?"100%":"50%":((p=e.image)==null?void 0:p.width)==="inset"?(i.width=s?"100%":"75%",i.maxWidth=e.image.maxWidth??"unset"):i.width="100%",(f=e.image)!=null&&f.aspectRatio){const[$,F]=(b=e.image)==null?void 0:b.aspectRatio.split(":").map(Number);i.aspectRatio=`${$}/${F}`}}else i.objectFit="none";let u;(x=e.image)!=null&&x.imageUrls&&(u=a==="dark"&&((v=e.image.imageUrls.dark)==null?void 0:v.medium)||e.image.imageUrls.default.medium);let S=((k=(_=(y=e.image)==null?void 0:y[a==="dark"?"darkImage":"defaultImage"])==null?void 0:_.asset)==null?void 0:k.altText)||((T=(j=(A=e.image)==null?void 0:A[a==="dark"?"darkImage":"defaultImage"])==null?void 0:j.asset)==null?void 0:T.description)||"Card image";switch(e.type){case"link":return r.jsx(l.CallToAction,{as:"a",variant:e.variant??"primary",href:t,target:((w=e.linkOptions)==null?void 0:w.linkType)==="external"?"_blank":"_self",rel:((q=e.linkOptions)==null?void 0:q.linkType)==="external"?"noopener noreferrer":"","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.image&&u?r.jsx(O,{src:u,alt:S,width:600,height:658,priority:!1,style:i}):e.label},o);case"modal":return r.jsx(U.Modal,{trigger:r.jsx(l.CallToAction,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label}),content:e.modalContent},o);case"video":return r.jsx(U.Modal,{trigger:r.jsx(l.CallToAction,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label}),content:r.jsx("video",{src:e.videoUrl,controls:!0,autoPlay:!0})},o);case"download":return r.jsx(l.CallToAction,{as:"a",variant:e.variant??"primary",href:t,download:!0,target:"_blank",rel:"noopener noreferrer","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label},o)}})}):null}exports.CallToActions=Q;
@@ -1,94 +1,119 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useState as c, useEffect as b } from "react";
3
- import { ButtonGroup as h } from "../../../core/components/ButtonGroup/index.mjs";
4
- import { C as i } from "../../../index-C-E0ib2G.js";
5
- import { Modal as g } from "../../../core/components/Modal/index.mjs";
6
- import { resolveLinkURL as p } from "../../utils/resolveLinkUrl.mjs";
7
- function C({
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useState as S, useEffect as W } from "react";
3
+ import $ from "next/image";
4
+ import { ButtonGroup as B } from "../../../core/components/ButtonGroup/index.mjs";
5
+ import { C as l } from "../../../index-C-E0ib2G.js";
6
+ import { Modal as C } from "../../../core/components/Modal/index.mjs";
7
+ import { resolveLinkURL as L } from "../../utils/resolveLinkUrl.mjs";
8
+ import { useTheme as E } from "../../contexts/ThemeContext.mjs";
9
+ import { useMediaQuery as G } from "../../hooks/useMediaQuery.mjs";
10
+ function Y({
8
11
  items: r,
9
- alignment: u,
10
- className: s
12
+ alignment: R,
13
+ className: F
11
14
  }) {
12
- const [f, m] = c([]);
13
- return b(() => {
14
- if (!(r != null && r.length) || !p) return;
15
- async function n() {
15
+ const [M, P] = S([]), { mode: t } = E(), m = G("(max-width: 767px)");
16
+ return W(() => {
17
+ if (!(r != null && r.length) || !L) return;
18
+ async function e() {
16
19
  const o = await Promise.all(
17
- r.map((l) => p(l))
20
+ r.map((a) => L(a))
18
21
  );
19
- m(o);
22
+ P(o);
20
23
  }
21
- n();
22
- }, [r]), r != null && r.length ? /* @__PURE__ */ e(h, { className: s, alignment: u, children: r.slice(0, 3).map((n, o) => {
23
- var a, t;
24
- const l = f[o] ?? "#";
25
- switch (n.type) {
24
+ e();
25
+ }, [r]), r != null && r.length ? /* @__PURE__ */ n(B, { className: F, alignment: R, children: r.slice(0, 3).map((e, o) => {
26
+ var g, d, f, p, u, h, b, c, v, y, k, w, A, T, U, x, I, j;
27
+ const a = M[o] ?? "#", i = {};
28
+ if (((g = e.image) == null ? void 0 : g.layout) === "cover")
29
+ i.objectFit = "cover", (d = e.image) != null && d.position && (i.objectPosition = m ? "top" : (f = e.image) == null ? void 0 : f.position);
30
+ else if (((p = e.image) == null ? void 0 : p.layout) === "contain") {
31
+ if (i.objectFit = "contain", ((u = e.image) == null ? void 0 : u.width) === "half" ? i.width = m ? "100%" : "50%" : ((h = e.image) == null ? void 0 : h.width) === "inset" ? (i.width = m ? "100%" : "75%", i.maxWidth = e.image.maxWidth ?? "unset") : i.width = "100%", (b = e.image) != null && b.aspectRatio) {
32
+ const [H, O] = (c = e.image) == null ? void 0 : c.aspectRatio.split(":").map(Number);
33
+ i.aspectRatio = `${H}/${O}`;
34
+ }
35
+ } else
36
+ i.objectFit = "none";
37
+ let s;
38
+ (v = e.image) != null && v.imageUrls && (s = t === "dark" && ((y = e.image.imageUrls.dark) == null ? void 0 : y.medium) || e.image.imageUrls.default.medium);
39
+ let _ = ((A = (w = (k = e.image) == null ? void 0 : k[t === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : w.asset) == null ? void 0 : A.altText) || ((x = (U = (T = e.image) == null ? void 0 : T[t === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : U.asset) == null ? void 0 : x.description) || "Card image";
40
+ switch (e.type) {
26
41
  case "link":
27
- return /* @__PURE__ */ e(
28
- i,
42
+ return /* @__PURE__ */ n(
43
+ l,
29
44
  {
30
45
  as: "a",
31
- variant: n.variant ?? "primary",
32
- href: l,
33
- target: ((a = n.linkOptions) == null ? void 0 : a.linkType) === "external" ? "_blank" : "_self",
34
- rel: ((t = n.linkOptions) == null ? void 0 : t.linkType) === "external" ? "noopener noreferrer" : "",
35
- "aria-label": n.ariaLabel || n.label,
36
- icon: n.icon,
37
- iconAlignment: n.iconAlignment ?? "right",
38
- children: n.label
46
+ variant: e.variant ?? "primary",
47
+ href: a,
48
+ target: ((I = e.linkOptions) == null ? void 0 : I.linkType) === "external" ? "_blank" : "_self",
49
+ rel: ((j = e.linkOptions) == null ? void 0 : j.linkType) === "external" ? "noopener noreferrer" : "",
50
+ "aria-label": e.ariaLabel || e.label,
51
+ icon: e.icon,
52
+ iconAlignment: e.iconAlignment ?? "right",
53
+ children: e.image && s ? /* @__PURE__ */ n(
54
+ $,
55
+ {
56
+ src: s,
57
+ alt: _,
58
+ width: 600,
59
+ height: 658,
60
+ priority: !1,
61
+ style: i
62
+ }
63
+ ) : e.label
39
64
  },
40
65
  o
41
66
  );
42
67
  case "modal":
43
- return /* @__PURE__ */ e(
44
- g,
68
+ return /* @__PURE__ */ n(
69
+ C,
45
70
  {
46
- trigger: /* @__PURE__ */ e(
47
- i,
71
+ trigger: /* @__PURE__ */ n(
72
+ l,
48
73
  {
49
74
  as: "button",
50
- variant: n.variant ?? "primary",
51
- icon: n.icon,
52
- iconAlignment: n.iconAlignment ?? "right",
53
- children: n.label
75
+ variant: e.variant ?? "primary",
76
+ icon: e.icon,
77
+ iconAlignment: e.iconAlignment ?? "right",
78
+ children: e.label
54
79
  }
55
80
  ),
56
- content: n.modalContent
81
+ content: e.modalContent
57
82
  },
58
83
  o
59
84
  );
60
85
  case "video":
61
- return /* @__PURE__ */ e(
62
- g,
86
+ return /* @__PURE__ */ n(
87
+ C,
63
88
  {
64
- trigger: /* @__PURE__ */ e(
65
- i,
89
+ trigger: /* @__PURE__ */ n(
90
+ l,
66
91
  {
67
92
  as: "button",
68
- variant: n.variant ?? "primary",
69
- icon: n.icon,
70
- iconAlignment: n.iconAlignment ?? "right",
71
- children: n.label
93
+ variant: e.variant ?? "primary",
94
+ icon: e.icon,
95
+ iconAlignment: e.iconAlignment ?? "right",
96
+ children: e.label
72
97
  }
73
98
  ),
74
- content: /* @__PURE__ */ e("video", { src: n.videoUrl, controls: !0, autoPlay: !0 })
99
+ content: /* @__PURE__ */ n("video", { src: e.videoUrl, controls: !0, autoPlay: !0 })
75
100
  },
76
101
  o
77
102
  );
78
103
  case "download":
79
- return /* @__PURE__ */ e(
80
- i,
104
+ return /* @__PURE__ */ n(
105
+ l,
81
106
  {
82
107
  as: "a",
83
- variant: n.variant ?? "primary",
84
- href: l,
108
+ variant: e.variant ?? "primary",
109
+ href: a,
85
110
  download: !0,
86
111
  target: "_blank",
87
112
  rel: "noopener noreferrer",
88
- "aria-label": n.ariaLabel || n.label,
89
- icon: n.icon,
90
- iconAlignment: n.iconAlignment ?? "right",
91
- children: n.label
113
+ "aria-label": e.ariaLabel || e.label,
114
+ icon: e.icon,
115
+ iconAlignment: e.iconAlignment ?? "right",
116
+ children: e.label
92
117
  },
93
118
  o
94
119
  );
@@ -96,5 +121,5 @@ function C({
96
121
  }) }) : null;
97
122
  }
98
123
  export {
99
- C as CallToActions
124
+ Y as CallToActions
100
125
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.550",
4
+ "version": "0.0.552",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {