quirk-ui 0.1.146 → 0.1.147
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"});const n=require("react/jsx-runtime"),U=require("react"),B=require("next/image"),G=require("../../../core/components/ButtonGroup/index.cjs"),l=require("../../../index-D7SAxT5B.cjs"),I=require("../../../core/components/Modal/index.cjs"),C=require("../../utils/resolveLinkUrl.cjs"),H=require("../../../core/context/ThemeContext.cjs"),Q=require("../../hooks/useMediaQuery.cjs");function W({items:r,alignment:M,spacing:R,mobileOrientation:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),U=require("react"),B=require("next/image"),G=require("../../../core/components/ButtonGroup/index.cjs"),l=require("../../../index-D7SAxT5B.cjs"),I=require("../../../core/components/Modal/index.cjs"),C=require("../../utils/resolveLinkUrl.cjs"),H=require("../../../core/context/ThemeContext.cjs"),Q=require("../../hooks/useMediaQuery.cjs");function W({items:r,alignment:M,spacing:R,mobileOrientation:O="column",className:P}){const[S,$]=U.useState([]),{mode:t}=H.useTheme(),g=Q.useMediaQuery("(max-width: 767px)");return U.useEffect(()=>{if(!(r!=null&&r.length)||!C.resolveLinkURL)return;async function e(){const o=await Promise.all(r.map(a=>C.resolveLinkURL(a)));$(o)}e()},[r]),r!=null&&r.length?n.jsx(G.ButtonGroup,{className:P,alignment:M,spacing:R,mobileOrientation:O,children:r.slice(0,3).map((e,o)=>{var m,d,c,p,h,b,f,y,v,x,_,k,j,T,A,w,q,L;const a=S[o]??"#",i={};if(i.height="auto",((m=e.image)==null?void 0:m.layout)==="cover")i.objectFit="cover",(d=e.image)!=null&&d.position&&(i.objectPosition=g?"top":(c=e.image)==null?void 0:c.position);else if(((p=e.image)==null?void 0:p.layout)==="contain"){if(i.objectFit="contain",((h=e.image)==null?void 0:h.sizing)==="half"?i.width=g?"100%":"50%":((b=e.image)==null?void 0:b.sizing)==="inset"?(i.width="100%",i.maxWidth=e.image.maxWidth??"unset"):i.width="100%",(f=e.image)!=null&&f.aspectRatio){const[F,z]=(y=e.image)==null?void 0:y.aspectRatio.split(":").map(Number);i.aspectRatio=`${F}/${z}`}}else i.objectFit="none";let s;(v=e.image)!=null&&v.imageUrls&&(s=t==="dark"&&((x=e.image.imageUrls.dark)==null?void 0:x.medium)||e.image.imageUrls.default.medium);let u=((j=(k=(_=e.image)==null?void 0:_[t==="dark"?"darkImage":"defaultImage"])==null?void 0:k.asset)==null?void 0:j.altText)||((w=(A=(T=e.image)==null?void 0:T[t==="dark"?"darkImage":"defaultImage"])==null?void 0:A.asset)==null?void 0:w.description)||"Card image";switch(e.type){case"link":return n.jsx(l.Button,{as:"a",variant:e.variant,href:a,target:((q=e.linkOptions)==null?void 0:q.linkType)==="external"?"_blank":"_self",rel:((L=e.linkOptions)==null?void 0:L.linkType)==="external"?"noopener noreferrer":"","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",displayType:e.displayType,ImageComponent:n.jsx(B,{src:s??"",alt:u,width:600,height:658,priority:!1,style:i}),children:e.label},o);case"scroll":return n.jsx(l.Button,{as:"scroll",variant:e.variant,scrollTarget:e.scrollTarget??"","aria-label":e.ariaLabel||e.label,icon:e.icon,iconAlignment:e.iconAlignment??"right",displayType:e.displayType,scrollOffset:e.scrollOffset,ImageComponent:n.jsx(B,{src:s??"",alt:u,width:600,height:658,priority:!1,style:i}),children:e.label},o);case"modal":return n.jsx(I.Modal,{trigger:n.jsx(l.Button,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right","aria-label":e.ariaLabel||e.label,children:e.label}),content:e.modalContent},o);case"video":return n.jsx(I.Modal,{trigger:n.jsx(l.Button,{as:"button",variant:e.variant??"primary",icon:e.icon,iconAlignment:e.iconAlignment??"right","aria-label":e.ariaLabel||e.label,children:e.label}),content:n.jsx("video",{src:e.videoUrl,controls:!0,autoPlay:!0})},o);case"download":return n.jsx(l.Button,{as:"a",variant:e.variant??"primary",href:a,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.CallToAction=W;
|
|
@@ -2,58 +2,58 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as W, useEffect as $ } from "react";
|
|
3
3
|
import C from "next/image";
|
|
4
4
|
import { ButtonGroup as E } from "../../../core/components/ButtonGroup/index.mjs";
|
|
5
|
-
import { B as
|
|
6
|
-
import { Modal as
|
|
7
|
-
import { resolveLinkURL as
|
|
5
|
+
import { B as o } from "../../../index-BnvfQt_k.js";
|
|
6
|
+
import { Modal as O } from "../../../core/components/Modal/index.mjs";
|
|
7
|
+
import { resolveLinkURL as R } from "../../utils/resolveLinkUrl.mjs";
|
|
8
8
|
import { useTheme as G } from "../../../core/context/ThemeContext.mjs";
|
|
9
9
|
import { useMediaQuery as N } from "../../hooks/useMediaQuery.mjs";
|
|
10
10
|
function ee({
|
|
11
|
-
items:
|
|
12
|
-
alignment:
|
|
13
|
-
spacing:
|
|
14
|
-
mobileOrientation:
|
|
15
|
-
className:
|
|
11
|
+
items: l,
|
|
12
|
+
alignment: B,
|
|
13
|
+
spacing: F,
|
|
14
|
+
mobileOrientation: M = "column",
|
|
15
|
+
className: P
|
|
16
16
|
}) {
|
|
17
|
-
const [
|
|
17
|
+
const [_, z] = W([]), { mode: t } = G(), m = N("(max-width: 767px)");
|
|
18
18
|
return $(() => {
|
|
19
|
-
if (!(
|
|
19
|
+
if (!(l != null && l.length) || !R) return;
|
|
20
20
|
async function e() {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const n = await Promise.all(
|
|
22
|
+
l.map((a) => R(a))
|
|
23
23
|
);
|
|
24
|
-
|
|
24
|
+
z(n);
|
|
25
25
|
}
|
|
26
26
|
e();
|
|
27
|
-
}, [
|
|
27
|
+
}, [l]), l != null && l.length ? /* @__PURE__ */ r(
|
|
28
28
|
E,
|
|
29
29
|
{
|
|
30
|
-
className:
|
|
31
|
-
alignment:
|
|
32
|
-
spacing:
|
|
33
|
-
mobileOrientation:
|
|
34
|
-
children:
|
|
35
|
-
var p, d,
|
|
36
|
-
const
|
|
30
|
+
className: P,
|
|
31
|
+
alignment: B,
|
|
32
|
+
spacing: F,
|
|
33
|
+
mobileOrientation: M,
|
|
34
|
+
children: l.slice(0, 3).map((e, n) => {
|
|
35
|
+
var p, d, f, u, h, b, y, c, v, k, A, T, w, I, L, U, j, x;
|
|
36
|
+
const a = _[n] ?? "#", i = {};
|
|
37
37
|
if (i.height = "auto", ((p = e.image) == null ? void 0 : p.layout) === "cover")
|
|
38
|
-
i.objectFit = "cover", (d = e.image) != null && d.position && (i.objectPosition =
|
|
39
|
-
else if (((
|
|
40
|
-
if (i.objectFit = "contain", ((h = e.image) == null ? void 0 : h.sizing) === "half" ? i.width =
|
|
41
|
-
const [
|
|
42
|
-
i.aspectRatio = `${
|
|
38
|
+
i.objectFit = "cover", (d = e.image) != null && d.position && (i.objectPosition = m ? "top" : (f = e.image) == null ? void 0 : f.position);
|
|
39
|
+
else if (((u = e.image) == null ? void 0 : u.layout) === "contain") {
|
|
40
|
+
if (i.objectFit = "contain", ((h = e.image) == null ? void 0 : h.sizing) === "half" ? i.width = m ? "100%" : "50%" : ((b = e.image) == null ? void 0 : b.sizing) === "inset" ? (i.width = "100%", i.maxWidth = e.image.maxWidth ?? "unset") : i.width = "100%", (y = e.image) != null && y.aspectRatio) {
|
|
41
|
+
const [H, S] = (c = e.image) == null ? void 0 : c.aspectRatio.split(":").map(Number);
|
|
42
|
+
i.aspectRatio = `${H}/${S}`;
|
|
43
43
|
}
|
|
44
44
|
} else
|
|
45
45
|
i.objectFit = "none";
|
|
46
|
-
let
|
|
47
|
-
(v = e.image) != null && v.imageUrls && (
|
|
46
|
+
let s;
|
|
47
|
+
(v = e.image) != null && v.imageUrls && (s = t === "dark" && ((k = e.image.imageUrls.dark) == null ? void 0 : k.medium) || e.image.imageUrls.default.medium);
|
|
48
48
|
let g = ((w = (T = (A = e.image) == null ? void 0 : A[t === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : T.asset) == null ? void 0 : w.altText) || ((U = (L = (I = e.image) == null ? void 0 : I[t === "dark" ? "darkImage" : "defaultImage"]) == null ? void 0 : L.asset) == null ? void 0 : U.description) || "Card image";
|
|
49
49
|
switch (e.type) {
|
|
50
50
|
case "link":
|
|
51
51
|
return /* @__PURE__ */ r(
|
|
52
|
-
|
|
52
|
+
o,
|
|
53
53
|
{
|
|
54
54
|
as: "a",
|
|
55
55
|
variant: e.variant,
|
|
56
|
-
href:
|
|
56
|
+
href: a,
|
|
57
57
|
target: ((j = e.linkOptions) == null ? void 0 : j.linkType) === "external" ? "_blank" : "_self",
|
|
58
58
|
rel: ((x = e.linkOptions) == null ? void 0 : x.linkType) === "external" ? "noopener noreferrer" : "",
|
|
59
59
|
"aria-label": e.ariaLabel || e.label,
|
|
@@ -63,7 +63,7 @@ function ee({
|
|
|
63
63
|
ImageComponent: /* @__PURE__ */ r(
|
|
64
64
|
C,
|
|
65
65
|
{
|
|
66
|
-
src:
|
|
66
|
+
src: s ?? "",
|
|
67
67
|
alt: g,
|
|
68
68
|
width: 600,
|
|
69
69
|
height: 658,
|
|
@@ -73,11 +73,11 @@ function ee({
|
|
|
73
73
|
),
|
|
74
74
|
children: e.label
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
n
|
|
77
77
|
);
|
|
78
78
|
case "scroll":
|
|
79
79
|
return /* @__PURE__ */ r(
|
|
80
|
-
|
|
80
|
+
o,
|
|
81
81
|
{
|
|
82
82
|
as: "scroll",
|
|
83
83
|
variant: e.variant,
|
|
@@ -86,10 +86,11 @@ function ee({
|
|
|
86
86
|
icon: e.icon,
|
|
87
87
|
iconAlignment: e.iconAlignment ?? "right",
|
|
88
88
|
displayType: e.displayType,
|
|
89
|
+
scrollOffset: e.scrollOffset,
|
|
89
90
|
ImageComponent: /* @__PURE__ */ r(
|
|
90
91
|
C,
|
|
91
92
|
{
|
|
92
|
-
src:
|
|
93
|
+
src: s ?? "",
|
|
93
94
|
alt: g,
|
|
94
95
|
width: 600,
|
|
95
96
|
height: 658,
|
|
@@ -99,14 +100,14 @@ function ee({
|
|
|
99
100
|
),
|
|
100
101
|
children: e.label
|
|
101
102
|
},
|
|
102
|
-
|
|
103
|
+
n
|
|
103
104
|
);
|
|
104
105
|
case "modal":
|
|
105
106
|
return /* @__PURE__ */ r(
|
|
106
|
-
|
|
107
|
+
O,
|
|
107
108
|
{
|
|
108
109
|
trigger: /* @__PURE__ */ r(
|
|
109
|
-
|
|
110
|
+
o,
|
|
110
111
|
{
|
|
111
112
|
as: "button",
|
|
112
113
|
variant: e.variant ?? "primary",
|
|
@@ -118,14 +119,14 @@ function ee({
|
|
|
118
119
|
),
|
|
119
120
|
content: e.modalContent
|
|
120
121
|
},
|
|
121
|
-
|
|
122
|
+
n
|
|
122
123
|
);
|
|
123
124
|
case "video":
|
|
124
125
|
return /* @__PURE__ */ r(
|
|
125
|
-
|
|
126
|
+
O,
|
|
126
127
|
{
|
|
127
128
|
trigger: /* @__PURE__ */ r(
|
|
128
|
-
|
|
129
|
+
o,
|
|
129
130
|
{
|
|
130
131
|
as: "button",
|
|
131
132
|
variant: e.variant ?? "primary",
|
|
@@ -137,15 +138,15 @@ function ee({
|
|
|
137
138
|
),
|
|
138
139
|
content: /* @__PURE__ */ r("video", { src: e.videoUrl, controls: !0, autoPlay: !0 })
|
|
139
140
|
},
|
|
140
|
-
|
|
141
|
+
n
|
|
141
142
|
);
|
|
142
143
|
case "download":
|
|
143
144
|
return /* @__PURE__ */ r(
|
|
144
|
-
|
|
145
|
+
o,
|
|
145
146
|
{
|
|
146
147
|
as: "a",
|
|
147
148
|
variant: e.variant ?? "primary",
|
|
148
|
-
href:
|
|
149
|
+
href: a,
|
|
149
150
|
download: !0,
|
|
150
151
|
target: "_blank",
|
|
151
152
|
rel: "noopener noreferrer",
|
|
@@ -154,7 +155,7 @@ function ee({
|
|
|
154
155
|
iconAlignment: e.iconAlignment ?? "right",
|
|
155
156
|
children: e.label
|
|
156
157
|
},
|
|
157
|
-
|
|
158
|
+
n
|
|
158
159
|
);
|
|
159
160
|
}
|
|
160
161
|
})
|