quirk-ui 0.0.550 → 0.0.551

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 n=require("react/jsx-runtime"),x=require("react"),C=require("next/image"),q=require("../../../core/components/ButtonGroup/index.cjs"),o=require("../../../index-BN6814Bi.cjs"),h=require("../../../core/components/Modal/index.cjs"),k=require("../../utils/resolveLinkUrl.cjs"),U=require("../../contexts/ThemeContext.cjs");function L({items:r,alignment:A,className:_}){const[T,y]=x.useState([]),{mode:a}=U.useTheme();return x.useEffect(()=>{if(!(r!=null&&r.length)||!k.resolveLinkURL)return;async function e(){const i=await Promise.all(r.map(l=>k.resolveLinkURL(l)));y(i)}e()},[r]),r!=null&&r.length?n.jsx(q.ButtonGroup,{className:_,alignment:A,children:r.slice(0,3).map((e,i)=>{var s,u,g,c,m,d,p,f,v,b;const l=T[i]??"#";let t;(s=e.image)!=null&&s.imageUrls&&(t=a==="dark"&&((u=e.image.imageUrls.dark)==null?void 0:u.medium)||e.image.imageUrls.default.medium);let j=((m=(c=(g=e.image)==null?void 0:g[a==="dark"?"darkImage":"defaultImage"])==null?void 0:c.asset)==null?void 0:m.altText)||((f=(p=(d=e.image)==null?void 0:d[a==="dark"?"darkImage":"defaultImage"])==null?void 0:p.asset)==null?void 0:f.description)||"Card image";switch(e.type){case"link":return n.jsx(o.CallToAction,{as:"a",variant:e.variant??"primary",href:l,target:((v=e.linkOptions)==null?void 0:v.linkType)==="external"?"_blank":"_self",rel:((b=e.linkOptions)==null?void 0:b.linkType)==="external"?"noopener noreferrer":"","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.image&&t?n.jsx(C,{src:t??"",alt:j,fill:!0,priority:!0,style:{objectFit:"cover"},draggable:!1,sizes:"(min-width: 500px) 500px, 100vw"}):e.label},i);case"modal":return n.jsx(h.Modal,{trigger:n.jsx(o.CallToAction,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label}),content:e.modalContent},i);case"video":return n.jsx(h.Modal,{trigger:n.jsx(o.CallToAction,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label}),content:n.jsx("video",{src:e.videoUrl,controls:!0,autoPlay:!0})},i);case"download":return n.jsx(o.CallToAction,{as:"a",variant:e.variant??"primary",href:l,download:!0,target:"_blank",rel:"noopener noreferrer","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",children:e.label},i)}})}):null}exports.CallToActions=L;
@@ -1,100 +1,116 @@
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 I, useEffect as C } from "react";
3
+ import x from "next/image";
4
+ import { ButtonGroup as L } from "../../../core/components/ButtonGroup/index.mjs";
5
+ import { C as a } from "../../../index-C-E0ib2G.js";
6
+ import { Modal as v } from "../../../core/components/Modal/index.mjs";
7
+ import { resolveLinkURL as k } from "../../utils/resolveLinkUrl.mjs";
8
+ import { useTheme as _ } from "../../contexts/ThemeContext.mjs";
9
+ function G({
8
10
  items: r,
9
- alignment: u,
10
- className: s
11
+ alignment: y,
12
+ className: A
11
13
  }) {
12
- const [f, m] = c([]);
13
- return b(() => {
14
- if (!(r != null && r.length) || !p) return;
15
- async function n() {
16
- const o = await Promise.all(
17
- r.map((l) => p(l))
14
+ const [T, U] = I([]), { mode: o } = _();
15
+ return C(() => {
16
+ if (!(r != null && r.length) || !k) return;
17
+ async function e() {
18
+ const i = await Promise.all(
19
+ r.map((l) => k(l))
18
20
  );
19
- m(o);
21
+ U(i);
20
22
  }
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) {
23
+ e();
24
+ }, [r]), r != null && r.length ? /* @__PURE__ */ n(L, { className: A, alignment: y, children: r.slice(0, 3).map((e, i) => {
25
+ var m, g, s, u, d, f, p, b, c, h;
26
+ const l = T[i] ?? "#";
27
+ let t;
28
+ (m = e.image) != null && m.imageUrls && (t = o === "dark" && ((g = e.image.imageUrls.dark) == null ? void 0 : g.medium) || e.image.imageUrls.default.medium);
29
+ let w = ((d = (u = (s = e.image) == null ? void 0 : s[o === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : u.asset) == null ? void 0 : d.altText) || ((b = (p = (f = e.image) == null ? void 0 : f[o === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : p.asset) == null ? void 0 : b.description) || "Card image";
30
+ switch (e.type) {
26
31
  case "link":
27
- return /* @__PURE__ */ e(
28
- i,
32
+ return /* @__PURE__ */ n(
33
+ a,
29
34
  {
30
35
  as: "a",
31
- variant: n.variant ?? "primary",
36
+ variant: e.variant ?? "primary",
32
37
  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
38
+ target: ((c = e.linkOptions) == null ? void 0 : c.linkType) === "external" ? "_blank" : "_self",
39
+ rel: ((h = e.linkOptions) == null ? void 0 : h.linkType) === "external" ? "noopener noreferrer" : "",
40
+ "aria-label": e.ariaLabel || e.label,
41
+ icon: e.icon,
42
+ iconAlignment: e.iconAlignment ?? "right",
43
+ children: e.image && t ? /* @__PURE__ */ n(
44
+ x,
45
+ {
46
+ src: t ?? "",
47
+ alt: w,
48
+ fill: !0,
49
+ priority: !0,
50
+ style: { objectFit: "cover" },
51
+ draggable: !1,
52
+ sizes: "(min-width: 500px) 500px, 100vw"
53
+ }
54
+ ) : e.label
39
55
  },
40
- o
56
+ i
41
57
  );
42
58
  case "modal":
43
- return /* @__PURE__ */ e(
44
- g,
59
+ return /* @__PURE__ */ n(
60
+ v,
45
61
  {
46
- trigger: /* @__PURE__ */ e(
47
- i,
62
+ trigger: /* @__PURE__ */ n(
63
+ a,
48
64
  {
49
65
  as: "button",
50
- variant: n.variant ?? "primary",
51
- icon: n.icon,
52
- iconAlignment: n.iconAlignment ?? "right",
53
- children: n.label
66
+ variant: e.variant ?? "primary",
67
+ icon: e.icon,
68
+ iconAlignment: e.iconAlignment ?? "right",
69
+ children: e.label
54
70
  }
55
71
  ),
56
- content: n.modalContent
72
+ content: e.modalContent
57
73
  },
58
- o
74
+ i
59
75
  );
60
76
  case "video":
61
- return /* @__PURE__ */ e(
62
- g,
77
+ return /* @__PURE__ */ n(
78
+ v,
63
79
  {
64
- trigger: /* @__PURE__ */ e(
65
- i,
80
+ trigger: /* @__PURE__ */ n(
81
+ a,
66
82
  {
67
83
  as: "button",
68
- variant: n.variant ?? "primary",
69
- icon: n.icon,
70
- iconAlignment: n.iconAlignment ?? "right",
71
- children: n.label
84
+ variant: e.variant ?? "primary",
85
+ icon: e.icon,
86
+ iconAlignment: e.iconAlignment ?? "right",
87
+ children: e.label
72
88
  }
73
89
  ),
74
- content: /* @__PURE__ */ e("video", { src: n.videoUrl, controls: !0, autoPlay: !0 })
90
+ content: /* @__PURE__ */ n("video", { src: e.videoUrl, controls: !0, autoPlay: !0 })
75
91
  },
76
- o
92
+ i
77
93
  );
78
94
  case "download":
79
- return /* @__PURE__ */ e(
80
- i,
95
+ return /* @__PURE__ */ n(
96
+ a,
81
97
  {
82
98
  as: "a",
83
- variant: n.variant ?? "primary",
99
+ variant: e.variant ?? "primary",
84
100
  href: l,
85
101
  download: !0,
86
102
  target: "_blank",
87
103
  rel: "noopener noreferrer",
88
- "aria-label": n.ariaLabel || n.label,
89
- icon: n.icon,
90
- iconAlignment: n.iconAlignment ?? "right",
91
- children: n.label
104
+ "aria-label": e.ariaLabel || e.label,
105
+ icon: e.icon,
106
+ iconAlignment: e.iconAlignment ?? "right",
107
+ children: e.label
92
108
  },
93
- o
109
+ i
94
110
  );
95
111
  }
96
112
  }) }) : null;
97
113
  }
98
114
  export {
99
- C as CallToActions
115
+ G as CallToActions
100
116
  };
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.551",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {