@cntrl-site/components 1.0.101 → 1.0.102
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/README.md +25 -1
- package/dist/Burger-C6jI6C1c.js +661 -0
- package/dist/Burger-EMSn7TPB.mjs +1807 -0
- package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
- package/dist/ClickGallerie-M9xdGR1G.js +36 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
- package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
- package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
- package/dist/Components/Form/FormComponent.d.ts +0 -1
- package/dist/Components/Grid/GridComponent.d.ts +0 -1
- package/dist/Components/Helix/HelixComponent.d.ts +0 -1
- package/dist/Components/Hive/HiveComponent.d.ts +0 -1
- package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
- package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
- package/dist/Components/List/ListComponent.d.ts +0 -1
- package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
- package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
- package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
- package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
- package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
- package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
- package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
- package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
- package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
- package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
- package/dist/ControlSlider-SiOt22l_.js +1 -0
- package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
- package/dist/FAQ-C7823fyi.js +166 -0
- package/dist/FAQ-CZ39u4m8.mjs +588 -0
- package/dist/Form-BX5_41nb.mjs +472 -0
- package/dist/Form-Dn-6A1He.js +153 -0
- package/dist/Grid-CemGhf3F.js +374 -0
- package/dist/Grid-cfQsXW3b.mjs +1553 -0
- package/dist/Helix-2Vr-9WBa.js +43 -0
- package/dist/Helix-BmkAKT1G.mjs +315 -0
- package/dist/Hive-BC6zQBsv.js +321 -0
- package/dist/Hive-BGMWinrW.mjs +1425 -0
- package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
- package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
- package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
- package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
- package/dist/Lightbox-CIss_nOG.js +1 -0
- package/dist/Lightbox-eP9qAZzL.mjs +665 -0
- package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
- package/dist/LightboxJournal-DAEZOPDi.js +523 -0
- package/dist/LightboxStrip-BDjI1jyH.js +386 -0
- package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
- package/dist/List-C32WImI3.js +377 -0
- package/dist/List-DW7fyJbf.mjs +1891 -0
- package/dist/Marquee-BYClHHws.mjs +551 -0
- package/dist/Marquee-vmHaTGIP.js +133 -0
- package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
- package/dist/MarqueeText-E6OubMOG.js +132 -0
- package/dist/Mercury-BwF_XW2w.js +267 -0
- package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
- package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
- package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
- package/dist/Pretext-10CcyP1E.mjs +2762 -0
- package/dist/Pretext-DvQ3xsni.js +231 -0
- package/dist/PretextComponent-C3YFICy8.js +1 -0
- package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
- package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
- package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
- package/dist/Scale-976sjO8e.js +111 -0
- package/dist/Scale-rLNT4KAk.mjs +345 -0
- package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
- package/dist/SimpleButton-nGEcO2gB.js +243 -0
- package/dist/Slider20-C9o2REDl.js +272 -0
- package/dist/Slider20-Dm8BeCli.mjs +851 -0
- package/dist/SvgImage-B5mR9y6q.mjs +51 -0
- package/dist/SvgImage-DFlmxAoL.js +1 -0
- package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
- package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
- package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
- package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
- package/dist/Waterfall-A0FjM2my.mjs +1400 -0
- package/dist/Waterfall-DnPDHbCL.js +287 -0
- package/dist/buildColorVars-CE2D5cQV.js +1 -0
- package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
- package/dist/components-OE3ac1dr.js +1 -0
- package/dist/components-w-jHX-2U.mjs +2053 -0
- package/dist/components.css +1 -1
- package/dist/elements.d.ts +7 -0
- package/dist/elements.js +1 -0
- package/dist/elements.mjs +63 -0
- package/dist/elements.node.d.ts +6 -0
- package/dist/elements.node.js +1 -0
- package/dist/elements.node.mjs +21 -0
- package/dist/forking.d.ts +1 -0
- package/dist/formFieldValidation-DZl2KVaF.js +1 -0
- package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
- package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
- package/dist/getColorAlpha-CoSseoCn.js +1 -0
- package/dist/getImageRect-BQhQXvT8.js +1 -0
- package/dist/getImageRect-CBMhFNHM.mjs +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -28862
- package/dist/index.mjs +16 -62473
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
- package/dist/panelAvailability-D179wwJx.mjs +27 -0
- package/dist/panelAvailability-DnOe0rQ4.js +1 -0
- package/dist/react-splide.esm-CabaEmHi.js +6 -0
- package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
- package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
- package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
- package/dist/scalingValue-C9JH5L6O.mjs +6 -0
- package/dist/scalingValue-CSHYgTZl.js +1 -0
- package/dist/sources.d.ts +1 -0
- package/dist/sources.js +23753 -0
- package/dist/sources.mjs +23779 -0
- package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
- package/dist/textStylesToCss-CNN3zZTV.js +1 -0
- package/dist/types/Component.d.ts +0 -1
- package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
- package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
- package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
- package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
- package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
- package/dist/useScopedStyles-DhBG3557.mjs +11 -0
- package/dist/utils-033j3qNL.js +1 -0
- package/dist/utils-FxC9rcxw.mjs +247 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +17 -11
- package/package.json +31 -2
- package/dist/index-2JTNRDR1.js +0 -1
- package/dist/index-DA8t6EZ4.mjs +0 -255
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { jsxs as K, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as T, useEffect as E } from "react";
|
|
3
|
+
const U = "ImageRevealSlider-module__imageRevealSlider___UE5Ob", V = "ImageRevealSlider-module__image___Qjt-e", Z = "ImageRevealSlider-module__link___N-iLG", ee = "ImageRevealSlider-module__cursor___2U03d", I = {
|
|
4
|
+
imageRevealSlider: U,
|
|
5
|
+
image: V,
|
|
6
|
+
link: Z,
|
|
7
|
+
cursor: ee
|
|
8
|
+
};
|
|
9
|
+
function q(r, c, h) {
|
|
10
|
+
for (const t of h) {
|
|
11
|
+
const a = new Image();
|
|
12
|
+
a.src = t.assetId;
|
|
13
|
+
const l = t.width ? Number.parseFloat(t.width) : a.naturalWidth, o = a.naturalHeight / a.naturalWidth * l, y = l / 2, v = o / 2;
|
|
14
|
+
if (r >= t.x - y && r <= t.x + y && c >= t.y - v && c <= t.y + v)
|
|
15
|
+
return !0;
|
|
16
|
+
}
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
function $(r) {
|
|
20
|
+
return new Promise((c) => {
|
|
21
|
+
const h = new Image();
|
|
22
|
+
h.src = r, h.onload = () => {
|
|
23
|
+
c({ width: h.naturalWidth, height: h.naturalHeight });
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function te(r, c, h, t) {
|
|
28
|
+
let a, l;
|
|
29
|
+
if (c === "custom") {
|
|
30
|
+
a = h;
|
|
31
|
+
const o = await $(r);
|
|
32
|
+
l = o.height / o.width * a;
|
|
33
|
+
} else if (c === "random") {
|
|
34
|
+
a = Math.random() * (t.max - t.min) + t.min;
|
|
35
|
+
const o = await $(r);
|
|
36
|
+
l = o.height / o.width * a;
|
|
37
|
+
} else {
|
|
38
|
+
const o = await $(r);
|
|
39
|
+
a = o.width, l = o.height;
|
|
40
|
+
}
|
|
41
|
+
return { width: a, height: l, finalWidth: `${a}px` };
|
|
42
|
+
}
|
|
43
|
+
function oe({ settings: r, content: c, isEditor: h }) {
|
|
44
|
+
const [t, a] = w(null), [l, o] = w([]), [y, v] = w(0), A = T(0), [W, D] = w({ x: 0, y: 0 }), [J, C] = w(1), [b, _] = w("none"), N = T({ x: 0, y: 0 }), [x, z] = w(!1), { sizeType: L, imageWidth: j, randomRangeImageWidth: H } = r.imageSize, { revealPosition: k, visible: P } = r.position, { cursorType: X, target: S, defaultCursorScale: Y, defaultCursor: B, hoverCursorScale: O, hoverCursor: F } = r.cursor;
|
|
45
|
+
E(() => {
|
|
46
|
+
if (!t) return;
|
|
47
|
+
const e = (s, m) => {
|
|
48
|
+
const i = t.getBoundingClientRect(), f = s - i.left, g = m - i.top;
|
|
49
|
+
if (D({ x: f, y: g }), X === "system") {
|
|
50
|
+
_("none"), C(1);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const u = f, R = g, M = document.elementFromPoint(i.left + u, i.top + R);
|
|
54
|
+
if (M && M.closest("a")) {
|
|
55
|
+
_("none"), C(1);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const Q = q(u, R, l) || S === "area" ? { img: F ?? "none", scale: O } : { img: B ?? "none", scale: Y };
|
|
59
|
+
_(Q.img), C(Q.scale);
|
|
60
|
+
}, n = (s) => {
|
|
61
|
+
s.stopPropagation(), N.current = { x: s.clientX, y: s.clientY }, e(s.clientX, s.clientY);
|
|
62
|
+
}, d = () => {
|
|
63
|
+
x && e(N.current.x, N.current.y);
|
|
64
|
+
};
|
|
65
|
+
return t.addEventListener("mousemove", n), window.addEventListener("scroll", d, !0), () => {
|
|
66
|
+
t.removeEventListener("mousemove", n), window.removeEventListener("scroll", d, !0);
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
t,
|
|
70
|
+
x,
|
|
71
|
+
W,
|
|
72
|
+
X,
|
|
73
|
+
S,
|
|
74
|
+
F,
|
|
75
|
+
B,
|
|
76
|
+
O,
|
|
77
|
+
Y,
|
|
78
|
+
l
|
|
79
|
+
]), E(() => {
|
|
80
|
+
x || (_("none"), C(0));
|
|
81
|
+
}, [x]);
|
|
82
|
+
const G = async (e, n, d, s = {}) => {
|
|
83
|
+
const { width: m, height: i, finalWidth: f } = await te(
|
|
84
|
+
e.image.assetId,
|
|
85
|
+
L,
|
|
86
|
+
j,
|
|
87
|
+
H
|
|
88
|
+
);
|
|
89
|
+
let g = 0, u = 0;
|
|
90
|
+
k === "same" ? (g = n / 2, u = d / 2) : (g = s.x ?? Math.random() * n, u = s.y ?? Math.random() * d);
|
|
91
|
+
const R = Math.min(Math.max(g, m / 2), n - m / 2), M = Math.min(Math.max(u, i / 2), d - i / 2);
|
|
92
|
+
return {
|
|
93
|
+
id: A.current++,
|
|
94
|
+
assetId: e.image.assetId,
|
|
95
|
+
link: e.link,
|
|
96
|
+
name: e.image.name,
|
|
97
|
+
x: R,
|
|
98
|
+
y: M,
|
|
99
|
+
width: f
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
return E(() => {
|
|
103
|
+
if (!t || c.length === 0) return;
|
|
104
|
+
const e = t.getBoundingClientRect(), n = e.width, d = e.height, s = [];
|
|
105
|
+
(async () => {
|
|
106
|
+
const i = c[0], f = await G(i, n, d);
|
|
107
|
+
s.push(f), o(s), v(1);
|
|
108
|
+
})();
|
|
109
|
+
}, [L, j, H, k, t]), E(() => {
|
|
110
|
+
P === "last One" && o((e) => e.length > 0 ? [e[e.length - 1]] : []);
|
|
111
|
+
}, [P]), /* @__PURE__ */ K(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref: a,
|
|
115
|
+
onClick: async (e) => {
|
|
116
|
+
if (!t) return;
|
|
117
|
+
const n = t.getBoundingClientRect(), d = e.clientX - n.left, s = e.clientY - n.top;
|
|
118
|
+
if (S === "image" && !q(d, s, l)) return;
|
|
119
|
+
let m = 0, i = 0;
|
|
120
|
+
k === "on Click" ? (m = d, i = s) : k === "same" ? (m = n.width / 2, i = n.height / 2) : (m = Math.random() * n.width, i = Math.random() * n.height);
|
|
121
|
+
const f = c[y], g = await G(f, n.width, n.height, { x: m, y: i });
|
|
122
|
+
o((u) => P === "all" ? [...u, g] : [g]), v((u) => u >= c.length - 1 ? 0 : u + 1);
|
|
123
|
+
},
|
|
124
|
+
onMouseEnter: () => z(!0),
|
|
125
|
+
onMouseLeave: () => z(!1),
|
|
126
|
+
className: I.imageRevealSlider,
|
|
127
|
+
style: { cursor: b === "none" ? "default" : "none" },
|
|
128
|
+
children: [
|
|
129
|
+
l.map((e) => /* @__PURE__ */ p(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: I.wrapper,
|
|
133
|
+
style: {
|
|
134
|
+
top: `${e.y}px`,
|
|
135
|
+
left: `${e.x}px`,
|
|
136
|
+
position: "absolute",
|
|
137
|
+
transform: "translate(-50%, -50%)",
|
|
138
|
+
width: e.width ?? "auto",
|
|
139
|
+
height: "auto",
|
|
140
|
+
cursor: b === "none" ? "default" : "none"
|
|
141
|
+
},
|
|
142
|
+
children: S === "area" && e.link ? /* @__PURE__ */ p("a", { href: e.link, target: "_blank", className: I.link, children: /* @__PURE__ */ p(
|
|
143
|
+
"img",
|
|
144
|
+
{
|
|
145
|
+
src: e.assetId,
|
|
146
|
+
alt: e.name,
|
|
147
|
+
className: I.image
|
|
148
|
+
},
|
|
149
|
+
e.id
|
|
150
|
+
) }) : /* @__PURE__ */ p(
|
|
151
|
+
"img",
|
|
152
|
+
{
|
|
153
|
+
src: e.assetId,
|
|
154
|
+
alt: e.name,
|
|
155
|
+
className: I.image
|
|
156
|
+
},
|
|
157
|
+
e.id
|
|
158
|
+
)
|
|
159
|
+
},
|
|
160
|
+
e.id
|
|
161
|
+
)),
|
|
162
|
+
x && /* @__PURE__ */ p(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: I.cursor,
|
|
166
|
+
style: {
|
|
167
|
+
left: `${W.x}px`,
|
|
168
|
+
top: `${W.y}px`,
|
|
169
|
+
transform: `translate(-50%, -50%) scale(${J})`,
|
|
170
|
+
backgroundImage: `url('${b}')`,
|
|
171
|
+
backgroundSize: "cover",
|
|
172
|
+
backgroundPosition: "center",
|
|
173
|
+
position: "absolute",
|
|
174
|
+
pointerEvents: "none"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
oe as ImageRevealSlider
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react"),Ae=require("react-dom"),h=require("./scalingValue-CSHYgTZl.js"),ae=require("./SvgImage-DFlmxAoL.js"),$=require("classnames"),fe=require("./react-splide.esm-CabaEmHi.js"),Te=require("./RichTextRenderer-CIy6yI8U.js"),Z=require("./getImageRect-BQhQXvT8.js"),pe=require("./getColorAlpha-CoSseoCn.js"),je=require("./textStylesToCss-CNN3zZTV.js"),$e="LightBox-module__hidden___9s-9x",ze="LightBox-module__heroImage___sTxNF",Fe="LightBox-module__background___rm9ml",Ne="LightBox-module__editor___4ACaY",Oe="LightBox-module__contentStyle___Bgnsq",We="LightBox-module__imageStyle___tLIlB",Ee="LightBox-module__imgWrapper___LuFUp",De="LightBox-module__contain___8-yaS",Me="LightBox-module__cover___hNvOG",Pe="LightBox-module__caption___b6L2I",Xe="LightBox-module__captionTextInner___rCGNH",He="LightBox-module__lightboxSplide___XFuWC",Ye="LightBox-module__arrow___iz38X",Ue="LightBox-module__arrowVertical___Zfz81",qe="LightBox-module__nextArrow___zkAQN",Ge="LightBox-module__arrowInner___p48sW",Ke="LightBox-module__arrowIcon___3VaFf",Ze="LightBox-module__arrowImg___pNV88",Je="LightBox-module__mirror___pjeXc",Qe="LightBox-module__thumbsWrapper___GB-nU",et="LightBox-module__thumbsContainerVertical___wttk5",tt="LightBox-module__thumbsContainer___osSma",nt="LightBox-module__thumbsAlignStart___MO6tY",rt="LightBox-module__thumbsAlignCenter___Q4sUx",ot="LightBox-module__thumbsAlignEnd___p4y9R",it="LightBox-module__thumbItem___HvnF3",st="LightBox-module__closeButton___g2khP",at="LightBox-module__fadeIn___0m5GW",lt="LightBox-module__slideInLeft___gPYwC",ct="LightBox-module__slideInRight___S-pPp",ut="LightBox-module__slideInTop___DFdAj",dt="LightBox-module__slideInBottom___m27kZ",ht="LightBox-module__fadeOut___55qBR",mt="LightBox-module__slideOutLeft___NvU7P",gt="LightBox-module__slideOutRight___SK7eC",ft="LightBox-module__slideOutTop___Vgg0z",pt="LightBox-module__slideOutBottom___nJ0Ef",_t="LightBox-module__scaleSlide___vZriG",e={hidden:$e,heroImage:ze,background:Fe,editor:Ne,contentStyle:Oe,imageStyle:We,imgWrapper:Ee,contain:De,cover:Me,caption:Pe,captionTextInner:Xe,lightboxSplide:He,arrow:Ye,arrowVertical:Ue,nextArrow:qe,arrowInner:Ge,arrowIcon:Ke,arrowImg:Ze,mirror:Je,thumbsWrapper:Qe,thumbsContainerVertical:et,thumbsContainer:tt,thumbsAlignStart:nt,thumbsAlignCenter:rt,thumbsAlignEnd:ot,thumbItem:it,closeButton:st,fadeIn:at,slideInLeft:lt,slideInRight:ct,slideInTop:ut,slideInBottom:dt,fadeOut:ht,slideOutLeft:mt,slideOutRight:gt,slideOutTop:ft,slideOutBottom:pt,scaleSlide:_t},J=(l,L,f)=>{const p={},[V,R]=l.split("-");return V==="top"?(p.top="0",p.bottom="auto"):V==="middle"?(p.top="50%",p.bottom="auto"):V==="bottom"&&(p.top="auto",p.bottom="0"),R==="left"?(p.left="0",p.right="auto"):R==="center"?(p.left="50%",p.right="auto"):R==="right"&&(p.left="auto",p.right="0"),V==="middle"&&R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), calc(-50% + ${h.scalingValue(L.y,f)}))`:V==="middle"?p.transform=`translate(${h.scalingValue(L.x,f)}, calc(-50% + ${h.scalingValue(L.y,f)}))`:R==="center"?p.transform=`translate(calc(-50% + ${h.scalingValue(L.x,f)}), ${h.scalingValue(L.y,f)})`:p.transform=`translate(${h.scalingValue(L.x,f)}, ${h.scalingValue(L.y,f)})`,p};function vt(l,L){const f=(()=>{if(l==="fade in")return e.fadeIn;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),p=(()=>{if(l==="fade in"||l==="mix")return e.fadeIn;if(l==="slide in")switch(L){case"left":return e.slideInLeft;case"right":return e.slideInRight;case"top":return e.slideInTop;case"bottom":return e.slideInBottom;default:return e.slideInRight}return e.fadeIn})(),V=(()=>{if(l==="fade in"||l==="mix")return e.fadeOut;if(l==="slide in")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})(),R=(()=>{if(l==="fade in")return e.fadeOut;if(l==="slide in"||l==="mix")switch(L){case"left":return e.slideOutLeft;case"right":return e.slideOutRight;case"top":return e.slideOutTop;case"bottom":return e.slideOutBottom;default:return e.slideOutRight}return e.fadeOut})();return{appearClass:f,backdropAppearClass:p,backdropDisappearClass:V,disappearClass:R}}const xt=({settings:l,content:L,styles:f,portalId:p,activeEvent:V,isEditor:R,isPreviewMode:r})=>{const[X,O]=g.useState(!1),{assetId:H}=l.thumbnailBlock.cover;return g.useEffect(()=>{V==="close"&&O(!1),V==="open"&&O(!0)},[V]),u.jsxs(u.Fragment,{children:[u.jsx("img",{src:H,alt:"Cover",className:e.heroImage,onClick:()=>O(!0)}),u.jsx(bt,{isOpen:X,onClose:()=>O(!1),content:L,settings:l,lightboxStyles:f,portalId:p,isEditor:R})]})},bt=({isOpen:l,onClose:L,content:f,lightboxStyles:p,settings:V,portalId:R,isEditor:r,metadata:X})=>{var ge;const{widthSettings:O,fontSettings:H,letterSpacing:ve,textAlign:xe,wordSpacing:be,fontSizeLineHeight:le,textAppearance:Q,color:we}=p.imageCaption??{},[z,Y]=g.useState(0),[ce,ee]=g.useState(0),[te,ne]=g.useState(!1),[Le,U]=g.useState(!1),[ue,de]=g.useState({}),I=g.useRef(null),re=g.useRef(null),A=g.useRef(null),W=g.useRef(!1),C=g.useRef(null),E=g.useRef(null),D=g.useRef(null),S=g.useRef(null),F=g.useRef(!1),he=g.useRef(null),[ye,oe]=g.useState(!1),{appear:q,triggers:T,slider:s,thumbnail:_,controls:v,area:B,caption:M,layout:P}=V.lightboxBlock,{appearClass:Ie,backdropAppearClass:Ce,backdropDisappearClass:Se,disappearClass:Be}=vt(q.type,q.direction),ie=(X==null?void 0:X.itemId)??null;g.useEffect(()=>{const t=()=>{setTimeout(()=>{var o,c;(c=(o=I.current)==null?void 0:o.splide)==null||c.refresh()},16)},n=()=>{ee(o=>o+1)};return window.addEventListener("ArticleEditor.Layout:change",t),window.addEventListener("ArticleEditor.ComponentContent:change",n),()=>{window.removeEventListener("ArticleEditor.Layout:change",t),window.removeEventListener("ArticleEditor.ComponentContent:change",n)}},[]),g.useEffect(()=>{if(!l||!_.isActive){oe(!1);return}const t=he.current;if(!t)return;const n=()=>{s.direction==="horiz"?oe(t.scrollWidth>t.clientWidth):oe(t.scrollHeight>t.clientHeight)};n();const o=new ResizeObserver(n);return o.observe(t),()=>o.disconnect()},[l,_.isActive,f.length,ue,s.direction]);const N=g.useCallback(()=>{const t=window.matchMedia("(max-width: 768px)").matches,n=pe.getColorAlpha(B.color);t&&!r&&n>.9&&(document.body.style.backgroundColor=""),ne(!0),W.current=!0;const o=c=>{c.target===C.current&&c.animationName&&(C.current&&E.current&&C.current.removeEventListener("animationend",E.current),E.current=null,W.current&&(W.current=!1,L()),ne(!1))};C.current&&(E.current=o,C.current.addEventListener("animationend",o))},[L,B.color,r]),Ve=(t,n,o)=>{var c,m;if(t){if(T.type==="click"&&T.switch==="image")T.repeat==="close"&&z===f.length-1?N():(c=I.current)==null||c.go("+1");else if(T.type==="click"&&T.switch==="50/50"){const d=t.getBoundingClientRect(),i=n-d.left,x=o-d.top,k=d.width,b=d.height;let y;s.direction==="horiz"?y=i<k/2?"-1":"+1":y=x<b/2?"-1":"+1",(m=I.current)==null||m.go(y)}}},me=t=>{if(F.current){F.current=!1;return}const n=f[z],o=(n==null?void 0:n.image.objectFit)==="cover";let c,m;if("changedTouches"in t&&t.changedTouches.length>0)c=t.changedTouches[0].clientX,m=t.changedTouches[0].clientY;else if("clientX"in t)c=t.clientX,m=t.clientY;else return;let d;if(o&&A.current){const i=Z.getPaddedContainerBounds(A.current);d=c>=i.left&&c<=i.right&&m>=i.top&&m<=i.bottom}else{const i=A.current?Z.getDisplayedImageRect(A.current):null;if(!i){t.target===t.currentTarget&&N();return}d=c>=i.x&&c<=i.x+i.width&&m>=i.y&&m<=i.y+i.height}d?Ve(A.current,c,m):N()},Re=t=>{const n=t.target;(n.classList.contains(e.thumbsWrapper)||n.classList.contains(e.thumbsContainer))&&me(t)};g.useEffect(()=>{if(!l)return;const t=n=>{var o,c;if(n.key==="Escape"){N();return}if(n.key==="ArrowRight"){Y(m=>(m+1)%Math.max(f.length,1)),(o=I.current)==null||o.go("+1");return}n.key==="ArrowLeft"&&(Y(m=>(m-1+Math.max(f.length,1))%Math.max(f.length,1)),(c=I.current)==null||c.go("-1"))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[l,N,f.length]),g.useEffect(()=>{if(l){if(Y(0),ee(n=>n+1),W.current=!1,ne(!1),U(!1),de({}),!ie)return;const t=new CustomEvent("page-overlay",{detail:{itemId:ie}});window.dispatchEvent(t)}return()=>{C.current&&E.current&&(C.current.removeEventListener("animationend",E.current),E.current=null),U(!1)}},[l,ie]),g.useEffect(()=>{re.current!==null&&re.current!==s.type&&ee(t=>t+1),re.current=s.type},[s.type]),g.useEffect(()=>{if(!l)return;const t=document.body.style.overflow,n=window.matchMedia("(max-width: 768px)").matches,o=pe.getColorAlpha(B.color);document.body.style.overflow="hidden",U(!1);const c=d=>{d.target===C.current&&!W.current&&d.animationName&&(n&&!r&&o>.9&&(document.body.style.backgroundColor=B.color),U(!0),C.current&&D.current&&C.current.removeEventListener("animationend",D.current),D.current=null)};C.current&&(D.current=c,C.current.addEventListener("animationend",c));const m=d=>{const i=d.target;i&&(i.closest(`.${e.thumbsWrapper}`)||i.closest(`.${e.thumbsContainer}`))||s.type!=="slide"&&d.preventDefault()};return document.addEventListener("touchmove",m,{passive:!1}),()=>{document.body.style.overflow=t,document.removeEventListener("touchmove",m),C.current&&D.current&&(C.current.removeEventListener("animationend",D.current),D.current=null),U(!1)}},[l,r,B.color,s.type]),g.useEffect(()=>{if(!l)return;const t=n=>{var c,m;if(W.current){n.stopPropagation();return}if(F.current){F.current=!1;return}const o=n.target;if(!(o&&(o.closest(`.${e.thumbsContainer}`)||o.closest(`.${e.thumbItem}`)||o.closest(`.${e.arrow}`)||o.closest(`.${e.closeButton}`)||o.closest(`.${e.caption}`)))){if(s.type==="slide"&&T.type==="drag"&&((m=(c=I.current)==null?void 0:c.splide)!=null&&m.root)){const d=I.current.splide.root;if(o&&(d.contains(o)||d===o))return}if(n.touches.length===0&&n.changedTouches.length>0){const d=f[z],i=(d==null?void 0:d.image.objectFit)==="cover",x=n.changedTouches[0];let k;if(i&&A.current){const b=Z.getPaddedContainerBounds(A.current);k=x.clientX>=b.left&&x.clientX<=b.right&&x.clientY>=b.top&&x.clientY<=b.bottom}else{const b=A.current?Z.getDisplayedImageRect(A.current):null;if(!b)return;k=x.clientX>=b.x&&x.clientX<=b.x+b.width&&x.clientY>=b.y&&x.clientY<=b.y+b.height}if(!k){n.stopPropagation(),W.current=!0;const b=y=>{y.stopPropagation(),y.preventDefault(),document.removeEventListener("click",b,!0)};document.addEventListener("click",b,!0),N()}}}};return document.addEventListener("touchend",t,{passive:!0}),()=>{document.removeEventListener("touchend",t)}},[l,N,z,f]);const se=(s.type==="scale"||s.type==="fade")&&s.direction==="vert"&&T.type==="drag";g.useEffect(()=>{var y,G;if(!l||!se||!((G=(y=I.current)==null?void 0:y.splide)!=null&&G.root))return;const t=I.current.splide.root,n=30,o=(a,w)=>{if(S.current){const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);(j>0||K>0)&&(F.current=!0)}},c=a=>{S.current&&(a.preventDefault(),o(a.clientX,a.clientY))},m=a=>{S.current&&a.touches.length>0&&(a.preventDefault(),o(a.touches[0].clientX,a.touches[0].clientY))},d=(a,w)=>{if(!S.current||!I.current){S.current=null;return}const j=Math.abs(a-S.current.x),K=Math.abs(w-S.current.y);K>n&&K>j&&I.current.go(w<S.current.y?"+1":"-1"),S.current=null},i=a=>{S.current&&d(a.clientX,a.clientY),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("pointermove",c)},x=a=>{if(S.current){if(a.changedTouches.length>0){const w=a.changedTouches[0];d(w.clientX,w.clientY)}document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),document.removeEventListener("touchmove",m)}},k=a=>{S.current={x:a.clientX,y:a.clientY},F.current=!1,document.addEventListener("pointermove",c,{passive:!1}),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},b=a=>{a.touches.length>0&&(S.current={x:a.touches[0].clientX,y:a.touches[0].clientY},F.current=!1,document.addEventListener("touchmove",m,{passive:!1}),document.addEventListener("touchend",x),document.addEventListener("touchcancel",x))};return t.addEventListener("pointerdown",k),t.addEventListener("touchstart",b),()=>{t.removeEventListener("pointerdown",k),t.removeEventListener("touchstart",b),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),document.removeEventListener("touchmove",m),document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x),S.current=null,F.current=!1}},[l,se,ce]);const ke={backgroundColor:B.color,backdropFilter:`blur(${B.blur}px)`,animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"};return typeof document>"u"||!document.getElementById(R)?null:Ae.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:r?null:C,className:$(e.background,te?Se:Ce,{[e.editor]:r},{[e.hidden]:!l}),style:{...ke,...Le&&!r&&!te?{position:"absolute"}:{}}}),u.jsxs("div",{ref:r?C:null,className:$(e.contentStyle,te?Be:Ie,{[e.editor]:r},{[e.hidden]:!l}),style:{animationDuration:`${parseInt(q.duration)}ms`,animationTimingFunction:"ease",animationFillMode:"both"},children:[u.jsx(fe.Splide2,{onMove:t=>Y(t.index),ref:I,className:e.lightboxSplide,options:{arrows:!1,speed:s.duration?parseInt(s.duration):500,direction:s.direction==="horiz"||s.type==="fade"||s.type==="scale"?"ltr":"ttb",pagination:!1,drag:T.type==="drag"&&!se,perPage:1,width:"100%",height:"100%",type:s.type==="fade"||s.type==="scale"?"fade":"loop",padding:0,rewind:T.repeat!=="close",start:0},style:{"--splide-speed":s.duration},children:f.map((t,n)=>{const o=J(P.position,P.offset,r),c=`${h.scalingValue(P.padding.top,r)} ${h.scalingValue(P.padding.right,r)} ${h.scalingValue(P.padding.bottom,r)} ${h.scalingValue(P.padding.left,r)}`,m=s.type==="scale"?(()=>{const{transform:d,...i}=o;return{...i,position:"absolute",padding:c,boxSizing:"border-box","--position-transform":d||"none"}})():{...o,position:"absolute",padding:c,boxSizing:"border-box"};return u.jsx(fe.SplideSlide,{children:u.jsx("div",{className:e.imgWrapper,onClick:me,children:u.jsx("img",{ref:n===z?A:null,className:$(e.imageStyle,{[e.contain]:t.image.objectFit==="contain",[e.cover]:t.image.objectFit==="cover",[e.scaleSlide]:s.type==="scale"}),src:t.image.assetId,alt:t.image.name??"",style:{...m,pointerEvents:t.image.objectFit==="contain"?"none":"auto"}})})},n)})},ce),v.isActive&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:$(e.arrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x,r)}, ${h.scalingValue(v.offset.y*(s.direction==="horiz"?1:-1),r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("-1")},"aria-label":"Previous",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:$(e.arrowImg,e.mirror)}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg,e.mirror)})]})}),u.jsx("div",{className:$(e.arrow,e.nextArrow,{[e.arrowVertical]:s.direction==="vert"}),style:{color:v.color,"--arrow-hover-color":v.hover},children:u.jsxs("button",{className:e.arrowInner,style:{transform:`translate(${h.scalingValue(v.offset.x*(s.direction==="horiz"?-1:1),r)}, ${h.scalingValue(v.offset.y,r)}) scale(${v.scale}) rotate(${s.direction==="horiz"?"0deg":"90deg"})`},onClick:()=>{var t;return(t=I.current)==null?void 0:t.go("+1")},"aria-label":"Next",children:[v.arrowsImgUrl&&u.jsx(ae.SvgImage,{url:v.arrowsImgUrl,fill:v.color,hoverFill:v.hover,className:e.arrowImg}),!v.arrowsImgUrl&&u.jsx(_e,{color:v.color,className:$(e.arrowIcon,e.arrowImg)})]})})]}),B.closeIconUrl&&(()=>{const t=J(B.closeIconAlign,B.closeIconOffset,r),n=`scale(${B.closeIconScale})`,o=t.transform?`${t.transform} ${n}`:n;return u.jsx("button",{className:e.closeButton,style:{...t,transform:o},onClick:N,"aria-label":"Close lightbox",children:u.jsx(ae.SvgImage,{url:B.closeIconUrl,fill:B.closeIconColor??"#000000",hoverFill:B.closeIconHover??"#cccccc"})})})(),M&&M.isActive&&p.imageCaption&&((ge=f[z])==null?void 0:ge.imageCaption)&&u.jsx("div",{className:e.caption,style:{...J(M.alignment,M.offset,r),fontFamily:je.normalizeFontFamilyCssValue(H.fontFamily),fontWeight:H.fontWeight,fontStyle:H.fontStyle,width:O.sizing==="auto"?"max-content":h.scalingValue(O.width,r),letterSpacing:h.scalingValue(ve,r),wordSpacing:h.scalingValue(be,r),textAlign:xe,fontSize:h.scalingValue(le.fontSize,r),lineHeight:h.scalingValue(le.lineHeight,r),textTransform:Q.textTransform??"none",textDecoration:Q.textDecoration??"none",fontVariant:Q.fontVariant??"normal",color:we},onClick:t=>t.stopPropagation(),children:u.jsx("div",{"data-styles":"imageCaption",className:e.captionTextInner,style:{"--link-color":M.linkColor,"--link-hover-color":M.linkHoverColor},children:u.jsx(Te.RichTextRenderer,{content:f[z].imageCaption})})}),_.isActive&&(()=>{const[t,n]=_.position.split("-"),o=s.direction==="horiz"?`${t}-left`:_.position,c=J(o,_.offset,r),m=()=>{if(s.direction==="horiz"){if(n==="left")return"flex-start";if(n==="center")return"center";if(n==="right")return"flex-end"}else{if(t==="top")return"flex-start";if(t==="middle")return"center";if(t==="bottom")return"flex-end"}return"flex-start"};return u.jsx("div",{ref:he,className:e.thumbsWrapper,onClick:d=>Re(d),style:{position:r?"absolute":"fixed",...c,...s.direction==="horiz"?{maxWidth:"100vw",width:"100%",overflowX:"auto",overflowY:"hidden"}:{maxHeight:"100vh",overflowY:"auto",overflowX:"hidden"}},children:u.jsx("div",{className:$(e.thumbsContainer,{[e.thumbsContainerVertical]:s.direction==="vert",[e.thumbsAlignStart]:_.align==="start",[e.thumbsAlignCenter]:_.align==="center",[e.thumbsAlignEnd]:_.align==="end"}),style:{gap:h.scalingValue(_.grid.gap,r),justifyContent:ye?"flex-start":m()},children:f.map((d,i)=>{const x=i===z,k=ue[i],y=_.grid.size*(x?_.activeState.scale:1),G=()=>{if(_.fit!=="fit")return{};if(!k)return s.direction==="horiz"?{height:h.scalingValue(y,r)}:{width:h.scalingValue(y,r)};const a=k.width/k.height;if(s.direction==="horiz"){const w=y,j=w*a;return{width:h.scalingValue(j,r),height:h.scalingValue(w,r)}}else{const w=y,j=w/a;return{width:h.scalingValue(w,r),height:h.scalingValue(j,r)}}};return u.jsx("button",{className:e.thumbItem,style:{...s.direction==="horiz"&&_.fit!=="fit"?{height:h.scalingValue(y,r)}:{},...s.direction==="vert"&&_.fit!=="fit"?{width:h.scalingValue(y,r)}:{},..._.fit==="cover"?{width:h.scalingValue(y,r),height:h.scalingValue(y,r)}:{},...G(),transition:x?"all 0.25s ease-out":"none",opacity:x?_.activeState.opacity/100:_.opacity/100,"--thumb-hover":_.activeState.opacity/100},onClick:a=>{var w;a.stopPropagation(),Y(i),(w=I.current)==null||w.go(i)},onMouseEnter:()=>{var a;_.triggers==="hov"&&((a=I.current)==null||a.go(i))},children:u.jsx("img",{src:d.image.assetId,alt:d.image.name??"",onLoad:a=>{const w=a.currentTarget;w.naturalWidth&&w.naturalHeight&&de(j=>({...j,[i]:{width:w.naturalWidth,height:w.naturalHeight}}))},style:{objectFit:_.fit==="cover"?"cover":"contain",..._.fit==="fit"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{},..._.fit==="cover"?{width:"100%",height:"100%"}:{}}})},`${d.image.name}-${i}`)})})})})()]})]}),document.getElementById(R))};function _e({color:l,className:L}){return u.jsx("svg",{viewBox:"0 0 10 18",className:L,children:u.jsx("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fillRule:"evenodd",children:u.jsx("path",{d:"M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z",id:"Shape-Copy",fill:l,transform:"translate(5, 9) rotate(-90) translate(-5, -9)"})})})}exports.LightboxGallery=xt;
|