@cntrl-site/components 1.0.118-alpha.3 → 1.0.118-alpha.4
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/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
- package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
- package/dist/{ChroniclesComponent-DD3tqNNm.mjs → ChroniclesComponent-DVoJ0kdT.mjs} +442 -512
- package/dist/ChroniclesComponent-Nm_yIRmr.js +1 -0
- package/dist/Components/Grid/Grid.d.ts +7 -25
- package/dist/Components/PopupMenu/PopupMenu.d.ts +73 -0
- package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +594 -0
- package/dist/Components/PopupMenu/popupMenuLayout.d.ts +203 -0
- package/dist/Components/PopupMenu/popupMenuSnap.d.ts +61 -0
- package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
- package/dist/{ControlSlider-BBAXRDLP.mjs → ControlSlider-3w-bHQEg.mjs} +4 -3
- package/dist/ControlSlider-DB4nbVLT.js +1 -0
- package/dist/{FAQ-DLh63Utr.js → FAQ-7HEkaoU6.js} +1 -1
- package/dist/{FAQ-CJHCMSBa.mjs → FAQ-GmiwRdFq.mjs} +1 -1
- package/dist/Grid-BuRdth9A.mjs +1622 -0
- package/dist/Grid-tqSSYh2-.js +408 -0
- package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
- package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
- package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
- package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
- package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
- package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
- package/dist/{LightboxJournal-Bf_rZzmz.js → LightboxJournal-B-vul_be.js} +1 -1
- package/dist/{LightboxJournal-BDUs6T0B.mjs → LightboxJournal-DisD2DLv.mjs} +1 -1
- package/dist/{LightboxStrip-RA4ABUC-.js → LightboxStrip-YDyEPEb6.js} +1 -1
- package/dist/{LightboxStrip-Cuhb2fIR.mjs → LightboxStrip-wCHUhAqN.mjs} +1 -1
- package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
- package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
- package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
- package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
- package/dist/PopupMenu-CYdDyzEt.mjs +1372 -0
- package/dist/PopupMenu-Di1fHgho.js +409 -0
- package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
- package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
- package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
- package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
- package/dist/SvgImage-CwRq9-ec.mjs +56 -0
- package/dist/SvgImage-_QN8ngad.js +1 -0
- package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
- package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
- package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
- package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
- package/dist/components-BYoTPJk3.js +1 -0
- package/dist/{components-BwAmTGJp.mjs → components-eK82xypT.mjs} +653 -30
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +24 -24
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +63 -36
- package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
- package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
- package/dist/sources.js +233 -514
- package/dist/sources.mjs +273 -555
- package/dist/types/Component.d.ts +7 -0
- package/dist/types/SchemaV1.d.ts +3 -0
- package/package.json +1 -1
- package/dist/ChroniclesComponent-BMbUwzk6.js +0 -1
- package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
- package/dist/ControlSlider-BCkVFl4w.js +0 -1
- package/dist/Grid-CUaVUaRa.js +0 -441
- package/dist/Grid-D19xZ_mh.mjs +0 -1800
- package/dist/SvgImage-B5mR9y6q.mjs +0 -51
- package/dist/SvgImage-DFlmxAoL.js +0 -1
- package/dist/components-D8RelPGE.js +0 -1
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
package/dist/sources.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
const
|
|
1
|
+
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-DVoJ0kdT.mjs";
|
|
2
|
+
const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
3
3
|
import { CommonComponentProps } from '../props';
|
|
4
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
5
5
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -2684,7 +2684,7 @@ export function Burger({
|
|
|
2684
2684
|
</div>
|
|
2685
2685
|
);
|
|
2686
2686
|
}
|
|
2687
|
-
`,
|
|
2687
|
+
`, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2688
2688
|
import { createPortal } from 'react-dom';
|
|
2689
2689
|
import cn from 'classnames';
|
|
2690
2690
|
import { CommonComponentProps } from '../props';
|
|
@@ -3731,7 +3731,7 @@ export function Chronicles({
|
|
|
3731
3731
|
</>
|
|
3732
3732
|
);
|
|
3733
3733
|
}
|
|
3734
|
-
`,
|
|
3734
|
+
`, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3735
3735
|
import { CommonComponentProps } from '../props';
|
|
3736
3736
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3737
3737
|
|
|
@@ -4260,7 +4260,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4260
4260
|
</>
|
|
4261
4261
|
);
|
|
4262
4262
|
}
|
|
4263
|
-
`,
|
|
4263
|
+
`, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4264
4264
|
import cn from 'classnames';
|
|
4265
4265
|
import { CommonComponentProps } from '../props';
|
|
4266
4266
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5004,7 +5004,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5004
5004
|
</>
|
|
5005
5005
|
);
|
|
5006
5006
|
}
|
|
5007
|
-
`,
|
|
5007
|
+
`, I = `import React, { useMemo, useState } from 'react';
|
|
5008
5008
|
import { CommonComponentProps } from '../props';
|
|
5009
5009
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5010
5010
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5642,7 +5642,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5642
5642
|
};
|
|
5643
5643
|
|
|
5644
5644
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5645
|
-
`,
|
|
5645
|
+
`, E = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5646
|
+
import '@splidejs/react-splide/css/core';
|
|
5647
|
+
import { CommonComponentProps } from '../props';
|
|
5646
5648
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5647
5649
|
import {
|
|
5648
5650
|
buildColorVars,
|
|
@@ -5652,7 +5654,7 @@ import {
|
|
|
5652
5654
|
useLazyVideos,
|
|
5653
5655
|
useScopedStyles,
|
|
5654
5656
|
} from '../utils/index';
|
|
5655
|
-
import {
|
|
5657
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5656
5658
|
import { createPortal } from 'react-dom';
|
|
5657
5659
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5658
5660
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5769,19 +5771,15 @@ function getCSS(P: string): string {
|
|
|
5769
5771
|
width: 100%;
|
|
5770
5772
|
overflow: hidden;
|
|
5771
5773
|
}
|
|
5774
|
+
.\${P}-item-slider .splide__track {
|
|
5775
|
+
overflow: hidden;
|
|
5776
|
+
}
|
|
5772
5777
|
.\${P}-item-image-link {
|
|
5773
5778
|
width: 100%;
|
|
5774
5779
|
display: flex;
|
|
5775
5780
|
flex-direction: column;
|
|
5776
5781
|
align-items: center;
|
|
5777
5782
|
}
|
|
5778
|
-
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5779
|
-
flex: 1 1 0%;
|
|
5780
|
-
min-height: 0;
|
|
5781
|
-
}
|
|
5782
|
-
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
|
|
5783
|
-
flex: none;
|
|
5784
|
-
}
|
|
5785
5783
|
.\${P}-item-text-link {
|
|
5786
5784
|
display: flex;
|
|
5787
5785
|
flex-direction: column;
|
|
@@ -5802,47 +5800,18 @@ function getCSS(P: string): string {
|
|
|
5802
5800
|
display: block;
|
|
5803
5801
|
max-width: 100%;
|
|
5804
5802
|
}
|
|
5805
|
-
.\${P}-item-slider
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
overflow: hidden;
|
|
5810
|
-
}
|
|
5811
|
-
.\${P}-item-slider-list {
|
|
5812
|
-
position: relative;
|
|
5813
|
-
display: flex;
|
|
5814
|
-
flex-direction: row;
|
|
5803
|
+
.\${P}-item-slider,
|
|
5804
|
+
.\${P}-item-slider .splide__track,
|
|
5805
|
+
.\${P}-item-slider .splide__list,
|
|
5806
|
+
.\${P}-item-slider .splide__slide {
|
|
5815
5807
|
width: 100%;
|
|
5816
5808
|
height: 100%;
|
|
5817
|
-
will-change: transform;
|
|
5818
|
-
}
|
|
5819
|
-
.\${P}-item-slider-list-vertical {
|
|
5820
|
-
flex-direction: column;
|
|
5821
|
-
}
|
|
5822
|
-
.\${P}-item-slider-list-fade {
|
|
5823
|
-
display: block;
|
|
5824
|
-
will-change: auto;
|
|
5825
5809
|
}
|
|
5826
|
-
.\${P}-item-
|
|
5827
|
-
position: relative;
|
|
5828
|
-
flex: 0 0 100%;
|
|
5829
|
-
width: 100%;
|
|
5830
|
-
height: 100%;
|
|
5810
|
+
.\${P}-item-slider .splide__slide {
|
|
5831
5811
|
display: flex;
|
|
5832
5812
|
justify-content: center;
|
|
5833
5813
|
align-items: center;
|
|
5834
5814
|
}
|
|
5835
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5836
|
-
position: absolute;
|
|
5837
|
-
top: 0;
|
|
5838
|
-
left: 0;
|
|
5839
|
-
opacity: 0;
|
|
5840
|
-
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5841
|
-
}
|
|
5842
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5843
|
-
opacity: 1;
|
|
5844
|
-
z-index: 1;
|
|
5845
|
-
}
|
|
5846
5815
|
.\${P}-item-title {
|
|
5847
5816
|
white-space: normal;
|
|
5848
5817
|
overflow-wrap: anywhere;
|
|
@@ -5989,13 +5958,13 @@ function getCSS(P: string): string {
|
|
|
5989
5958
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
5990
5959
|
align-items: flex-end;
|
|
5991
5960
|
}
|
|
5992
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
5961
|
+
.\${P}-image-align-top .\${P}-item-slider .splide__slide {
|
|
5993
5962
|
align-items: flex-start;
|
|
5994
5963
|
}
|
|
5995
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
5964
|
+
.\${P}-image-align-center .\${P}-item-slider .splide__slide {
|
|
5996
5965
|
align-items: center;
|
|
5997
5966
|
}
|
|
5998
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
5967
|
+
.\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
|
|
5999
5968
|
align-items: flex-end;
|
|
6000
5969
|
}
|
|
6001
5970
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6076,13 +6045,13 @@ function getCSS(P: string): string {
|
|
|
6076
6045
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6077
6046
|
align-items: flex-end;
|
|
6078
6047
|
}
|
|
6079
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6048
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6080
6049
|
align-items: flex-start;
|
|
6081
6050
|
}
|
|
6082
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6051
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6083
6052
|
align-items: center;
|
|
6084
6053
|
}
|
|
6085
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6054
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6086
6055
|
align-items: flex-end;
|
|
6087
6056
|
}
|
|
6088
6057
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6150,9 +6119,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6150
6119
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6151
6120
|
}
|
|
6152
6121
|
|
|
6153
|
-
function
|
|
6154
|
-
|
|
6155
|
-
|
|
6122
|
+
function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
|
|
6123
|
+
const autoplay = splide.Components.Autoplay;
|
|
6124
|
+
if (!autoplay) return;
|
|
6125
|
+
autoplay.pause(false);
|
|
6126
|
+
autoplay.play();
|
|
6127
|
+
}
|
|
6128
|
+
|
|
6129
|
+
function handleRandomSlideMoved(splide: {
|
|
6130
|
+
options: { direction?: string };
|
|
6131
|
+
Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
|
|
6132
|
+
}) {
|
|
6133
|
+
const next = pickRandomSlideDirection();
|
|
6134
|
+
if (splide.options.direction !== next) {
|
|
6135
|
+
splide.options = { ...splide.options, direction: next };
|
|
6136
|
+
}
|
|
6137
|
+
|
|
6138
|
+
requestAnimationFrame(() => {
|
|
6139
|
+
requestAnimationFrame(() => {
|
|
6140
|
+
resumeSplideAutoplay(splide);
|
|
6141
|
+
});
|
|
6142
|
+
});
|
|
6156
6143
|
}
|
|
6157
6144
|
|
|
6158
6145
|
type GridProps = {
|
|
@@ -6192,8 +6179,6 @@ type LightboxProps = {
|
|
|
6192
6179
|
|
|
6193
6180
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6194
6181
|
const SLIDER_TRANSITION_MS = 750;
|
|
6195
|
-
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6196
|
-
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6197
6182
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6198
6183
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6199
6184
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6283,7 +6268,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6283
6268
|
return result;
|
|
6284
6269
|
}
|
|
6285
6270
|
|
|
6286
|
-
|
|
6271
|
+
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6287
6272
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6288
6273
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6289
6274
|
// an embed's player is only ever framed where it shows
|
|
@@ -6322,7 +6307,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
|
|
|
6322
6307
|
))}
|
|
6323
6308
|
</div>
|
|
6324
6309
|
);
|
|
6325
|
-
}
|
|
6310
|
+
}
|
|
6326
6311
|
|
|
6327
6312
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6328
6313
|
video.pause();
|
|
@@ -6330,121 +6315,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6330
6315
|
video.load();
|
|
6331
6316
|
}
|
|
6332
6317
|
|
|
6333
|
-
const
|
|
6334
|
-
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6335
|
-
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6318
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
6336
6319
|
|
|
6337
6320
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
isFade: boolean;
|
|
6345
|
-
direction: GridSettings['direction'];
|
|
6346
|
-
intervalMs: number;
|
|
6347
|
-
};
|
|
6348
|
-
|
|
6349
|
-
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6350
|
-
const count = slides.length;
|
|
6351
|
-
const hasClones = !isFade && count > 1;
|
|
6352
|
-
const isRandom = !isFade && direction === 'random';
|
|
6353
|
-
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6354
|
-
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6355
|
-
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6356
|
-
const [isMoving, setIsMoving] = useState(false);
|
|
6357
|
-
const [skipTransition, setSkipTransition] = useState(false);
|
|
6358
|
-
const [cycle, setCycle] = useState(0);
|
|
6359
|
-
const isMovingRef = useRef(false);
|
|
6360
|
-
|
|
6361
|
-
useEffect(() => {
|
|
6362
|
-
if (count < 2) return;
|
|
6363
|
-
const timeoutId = window.setTimeout(() => {
|
|
6364
|
-
if (isMovingRef.current) {
|
|
6365
|
-
setCycle(prev => prev + 1);
|
|
6366
|
-
return;
|
|
6367
|
-
}
|
|
6368
|
-
isMovingRef.current = true;
|
|
6369
|
-
setIsMoving(true);
|
|
6370
|
-
setSkipTransition(false);
|
|
6371
|
-
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6372
|
-
if (!isRandom) setCycle(prev => prev + 1);
|
|
6373
|
-
}, delayMs);
|
|
6374
|
-
return () => window.clearTimeout(timeoutId);
|
|
6375
|
-
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6376
|
-
|
|
6377
|
-
useEffect(() => {
|
|
6378
|
-
if (!isMoving) return;
|
|
6379
|
-
const timeoutId = window.setTimeout(() => {
|
|
6380
|
-
const isOnClone = hasClones && position === count + 1;
|
|
6381
|
-
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6382
|
-
if (isOnClone || nextAxis !== axis) {
|
|
6383
|
-
setSkipTransition(true);
|
|
6384
|
-
if (isOnClone) setPosition(1);
|
|
6385
|
-
setAxis(nextAxis);
|
|
6386
|
-
}
|
|
6387
|
-
isMovingRef.current = false;
|
|
6388
|
-
setIsMoving(false);
|
|
6389
|
-
if (isRandom) setCycle(prev => prev + 1);
|
|
6390
|
-
}, SLIDER_TRANSITION_MS);
|
|
6391
|
-
return () => window.clearTimeout(timeoutId);
|
|
6392
|
-
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6393
|
-
|
|
6394
|
-
useEffect(() => {
|
|
6395
|
-
if (!skipTransition) return;
|
|
6396
|
-
let innerId = 0;
|
|
6397
|
-
const outerId = requestAnimationFrame(() => {
|
|
6398
|
-
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6399
|
-
});
|
|
6400
|
-
return () => {
|
|
6401
|
-
cancelAnimationFrame(outerId);
|
|
6402
|
-
cancelAnimationFrame(innerId);
|
|
6403
|
-
};
|
|
6404
|
-
}, [skipTransition]);
|
|
6405
|
-
|
|
6406
|
-
const slotsCount = hasClones ? count + 2 : count;
|
|
6407
|
-
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6408
|
-
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6409
|
-
const activeIndex = getItemIndex(position);
|
|
6410
|
-
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6411
|
-
const isPlayingSlot = (slot: number) => isFade
|
|
6412
|
-
|| (slot === position && !isCloneSlot(slot))
|
|
6413
|
-
|| slot === nextSlot
|
|
6414
|
-
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6415
|
-
const isVertical = !isFade && axis === 'ttb';
|
|
6416
|
-
const listStyle: React.CSSProperties | undefined = isFade
|
|
6417
|
-
? undefined
|
|
6418
|
-
: {
|
|
6419
|
-
transform: isVertical
|
|
6420
|
-
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6421
|
-
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6422
|
-
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6423
|
-
};
|
|
6424
|
-
|
|
6425
|
-
return (
|
|
6426
|
-
<div className={\`\${P}-item-slider\`}>
|
|
6427
|
-
<div
|
|
6428
|
-
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6429
|
-
style={listStyle}
|
|
6430
|
-
>
|
|
6431
|
-
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6432
|
-
const itemIndex = getItemIndex(slot);
|
|
6433
|
-
const isClone = isCloneSlot(slot);
|
|
6434
|
-
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6435
|
-
return (
|
|
6436
|
-
<div
|
|
6437
|
-
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6438
|
-
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6439
|
-
aria-hidden={isShown ? undefined : true}
|
|
6440
|
-
>
|
|
6441
|
-
{slides[itemIndex]}
|
|
6442
|
-
</div>
|
|
6443
|
-
);
|
|
6444
|
-
})}
|
|
6445
|
-
</div>
|
|
6446
|
-
</div>
|
|
6447
|
-
);
|
|
6321
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
6322
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
6323
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
6324
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
6325
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
6326
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
6448
6327
|
}
|
|
6449
6328
|
|
|
6450
6329
|
function GridMediaItem({
|
|
@@ -6452,7 +6331,7 @@ function GridMediaItem({
|
|
|
6452
6331
|
className,
|
|
6453
6332
|
style,
|
|
6454
6333
|
hasLightbox,
|
|
6455
|
-
|
|
6334
|
+
isSplideSlide = false,
|
|
6456
6335
|
onMediaClick,
|
|
6457
6336
|
}: {
|
|
6458
6337
|
media: GridMedia;
|
|
@@ -6460,7 +6339,7 @@ function GridMediaItem({
|
|
|
6460
6339
|
style: React.CSSProperties;
|
|
6461
6340
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6462
6341
|
hasLightbox: boolean;
|
|
6463
|
-
|
|
6342
|
+
isSplideSlide?: boolean;
|
|
6464
6343
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6465
6344
|
}) {
|
|
6466
6345
|
if (isEmbedMedia(media)) {
|
|
@@ -6492,7 +6371,7 @@ function GridMediaItem({
|
|
|
6492
6371
|
playsInline: true,
|
|
6493
6372
|
onClick: onMediaClick,
|
|
6494
6373
|
};
|
|
6495
|
-
return
|
|
6374
|
+
return isSplideSlide
|
|
6496
6375
|
? <video {...videoProps} preload='none' />
|
|
6497
6376
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6498
6377
|
}
|
|
@@ -6521,7 +6400,7 @@ function GridItemMediaWrapper({
|
|
|
6521
6400
|
children: React.ReactNode;
|
|
6522
6401
|
}) {
|
|
6523
6402
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6524
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6403
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6525
6404
|
|
|
6526
6405
|
return (
|
|
6527
6406
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7422,108 +7301,11 @@ function resolveLightboxImageDisplay(
|
|
|
7422
7301
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7423
7302
|
}
|
|
7424
7303
|
|
|
7425
|
-
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7426
|
-
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7427
|
-
}
|
|
7428
|
-
|
|
7429
|
-
type CustomGridSlot = {
|
|
7430
|
-
column: number;
|
|
7431
|
-
span: number;
|
|
7432
|
-
width: number;
|
|
7433
|
-
top: number;
|
|
7434
|
-
height: number;
|
|
7435
|
-
gridColumn: string;
|
|
7436
|
-
};
|
|
7437
|
-
|
|
7438
|
-
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7439
|
-
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7440
|
-
}
|
|
7441
|
-
|
|
7442
|
-
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7443
|
-
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7444
|
-
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7445
|
-
}
|
|
7446
|
-
|
|
7447
|
-
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7448
|
-
const block = layout.blocks[index % layout.blocks.length];
|
|
7449
|
-
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7450
|
-
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7451
|
-
return {
|
|
7452
|
-
column,
|
|
7453
|
-
span,
|
|
7454
|
-
width: getCustomGridSpanWidth(layout, span),
|
|
7455
|
-
top: Math.max(0, block.top),
|
|
7456
|
-
height: Math.max(0, block.height),
|
|
7457
|
-
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7458
|
-
};
|
|
7459
|
-
}
|
|
7460
|
-
|
|
7461
|
-
const EDGE_TOLERANCE = 1e-6;
|
|
7462
|
-
|
|
7463
|
-
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7464
|
-
const beat = layout.beat ?? 0;
|
|
7465
|
-
const onBeats = beat > 0 && !!entryHeights;
|
|
7466
|
-
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7467
|
-
const tracks: (number | 'auto')[] = [];
|
|
7468
|
-
const gridRows: string[] = [];
|
|
7469
|
-
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7470
|
-
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7471
|
-
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7472
|
-
const slots = Array.from(
|
|
7473
|
-
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7474
|
-
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7475
|
-
);
|
|
7476
|
-
const ends = slots.map((slot) => {
|
|
7477
|
-
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7478
|
-
&& slot.column < other.column + other.span
|
|
7479
|
-
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7480
|
-
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7481
|
-
});
|
|
7482
|
-
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7483
|
-
.sort((a, b) => a - b)
|
|
7484
|
-
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7485
|
-
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7486
|
-
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7487
|
-
const positions: number[] = [];
|
|
7488
|
-
let position = 0;
|
|
7489
|
-
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7490
|
-
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7491
|
-
if (ending.length === 0) return;
|
|
7492
|
-
if (!onBeats) {
|
|
7493
|
-
tracks.push('auto');
|
|
7494
|
-
return;
|
|
7495
|
-
}
|
|
7496
|
-
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7497
|
-
const track = Math.max(0, snapUp(needed) - position);
|
|
7498
|
-
tracks.push(track);
|
|
7499
|
-
position += track;
|
|
7500
|
-
};
|
|
7501
|
-
const lines = tops.map((top, index) => {
|
|
7502
|
-
if (index > 0) {
|
|
7503
|
-
tracks.push(top - tops[index - 1]);
|
|
7504
|
-
position += top - tops[index - 1];
|
|
7505
|
-
}
|
|
7506
|
-
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7507
|
-
positions.push(position);
|
|
7508
|
-
return tracks.length + 1;
|
|
7509
|
-
});
|
|
7510
|
-
pushContentTrack(end => end === undefined);
|
|
7511
|
-
const groupEnd = tracks.length + 1;
|
|
7512
|
-
const getLine = (value: number) => lines[getTop(value)];
|
|
7513
|
-
slots.forEach((slot, index) => {
|
|
7514
|
-
const end = ends[index];
|
|
7515
|
-
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7516
|
-
});
|
|
7517
|
-
}
|
|
7518
|
-
return { tracks, gridRows };
|
|
7519
|
-
}
|
|
7520
|
-
|
|
7521
7304
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7522
7305
|
const { prefix: P } = useScopedStyles();
|
|
7523
7306
|
const {
|
|
7524
7307
|
type = 'a',
|
|
7525
7308
|
gridLayout,
|
|
7526
|
-
customGrid,
|
|
7527
7309
|
textBoxWidth = 100,
|
|
7528
7310
|
verticalGap,
|
|
7529
7311
|
entriesCount,
|
|
@@ -7571,69 +7353,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7571
7353
|
hover = 'none',
|
|
7572
7354
|
alignEntries = 'off',
|
|
7573
7355
|
align = 'top',
|
|
7574
|
-
textGrowth = 'inside',
|
|
7575
7356
|
} = settings;
|
|
7576
7357
|
|
|
7577
|
-
const
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7595
|
-
]);
|
|
7358
|
+
const resolvedTitleTextStyle: TextStyles = {
|
|
7359
|
+
fontSettings: {
|
|
7360
|
+
fontFamily: titleFontFamily,
|
|
7361
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7362
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7363
|
+
},
|
|
7364
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7365
|
+
lineHeight: titleLineHeight,
|
|
7366
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7367
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7368
|
+
textAppearance: titleTextAppearance,
|
|
7369
|
+
color: titleColor,
|
|
7370
|
+
};
|
|
7371
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
|
|
7372
|
+
const titleFieldCss = {
|
|
7373
|
+
...titleTypographyCss,
|
|
7374
|
+
} as React.CSSProperties;
|
|
7596
7375
|
|
|
7597
|
-
const
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7615
|
-
]);
|
|
7376
|
+
const resolvedSubtitleTextStyle: TextStyles = {
|
|
7377
|
+
fontSettings: {
|
|
7378
|
+
fontFamily: subtitleFontFamily,
|
|
7379
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7380
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7381
|
+
},
|
|
7382
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7383
|
+
lineHeight: subtitleLineHeight,
|
|
7384
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7385
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7386
|
+
textAppearance: subtitleTextAppearance,
|
|
7387
|
+
color: subtitleColor,
|
|
7388
|
+
};
|
|
7389
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
|
|
7390
|
+
const subtitleFieldCss = {
|
|
7391
|
+
...subtitleTypographyCss,
|
|
7392
|
+
} as React.CSSProperties;
|
|
7616
7393
|
|
|
7617
|
-
const
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7394
|
+
const resolvedLightboxCounterTextStyle: TextStyles = {
|
|
7395
|
+
fontSettings: {
|
|
7396
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7397
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7398
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7399
|
+
},
|
|
7400
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7401
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7402
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7403
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7404
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7405
|
+
color: lightboxCounterColor,
|
|
7406
|
+
};
|
|
7407
|
+
const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
|
|
7408
|
+
const lightboxCounterFieldCss = {
|
|
7409
|
+
...lightboxCounterTypographyCss,
|
|
7631
7410
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7632
|
-
} as React.CSSProperties
|
|
7633
|
-
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7634
|
-
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7635
|
-
isEditor, P,
|
|
7636
|
-
]);
|
|
7411
|
+
} as React.CSSProperties;
|
|
7637
7412
|
|
|
7638
7413
|
const titleTextClassName = getGridTextClassName(
|
|
7639
7414
|
titleFontSize,
|
|
@@ -7647,6 +7422,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7647
7422
|
\`\${P}-item-subtitle\`,
|
|
7648
7423
|
\`\${P}-text-tight-leading\`,
|
|
7649
7424
|
);
|
|
7425
|
+
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7426
|
+
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7650
7427
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7651
7428
|
lightboxCounterFontSize,
|
|
7652
7429
|
lightboxCounterLineHeight,
|
|
@@ -7654,56 +7431,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7654
7431
|
\`\${P}-text-tight-leading\`,
|
|
7655
7432
|
);
|
|
7656
7433
|
|
|
7657
|
-
const colorVars =
|
|
7434
|
+
const colorVars = buildColorVars(P, {
|
|
7658
7435
|
titleColor,
|
|
7659
7436
|
subtitleColor,
|
|
7660
7437
|
lightboxCounterColor,
|
|
7661
|
-
}, COLOR_VAR_MAP, STATE_KEYS)
|
|
7438
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7662
7439
|
|
|
7663
7440
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7664
7441
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7665
7442
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7666
7443
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7667
7444
|
|
|
7668
|
-
const
|
|
7669
|
-
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7670
|
-
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7671
|
-
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7672
|
-
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7445
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
7673
7446
|
|
|
7674
|
-
const cropContent =
|
|
7447
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7675
7448
|
const lightboxMediaToPreload = useMemo(
|
|
7676
7449
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7677
7450
|
[cropContent, lightbox],
|
|
7678
7451
|
);
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7686
|
-
: -1));
|
|
7687
|
-
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7688
|
-
}), [cropContent]);
|
|
7689
|
-
|
|
7690
|
-
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7691
|
-
|
|
7692
|
-
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7693
|
-
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7694
|
-
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7695
|
-
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7452
|
+
|
|
7453
|
+
const size = gridLayout.entryWidth ?? 0.2;
|
|
7454
|
+
|
|
7455
|
+
const isCover = imageDisplay?.display === 'cover';
|
|
7456
|
+
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
7457
|
+
const ratioReversed = imageDisplay?.reversed ?? false;
|
|
7696
7458
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7697
7459
|
const effW = ratioReversed ? rH : rW;
|
|
7698
7460
|
const effH = ratioReversed ? rW : rH;
|
|
7699
7461
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7700
7462
|
|
|
7701
|
-
const columnsCount = gridLayout
|
|
7463
|
+
const columnsCount = gridLayout.columnsCount;
|
|
7702
7464
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7703
|
-
const
|
|
7465
|
+
const imageWrapperWidth = entryWidthScaled;
|
|
7466
|
+
const isFitSlider = !isCover && slider !== 'off';
|
|
7704
7467
|
|
|
7705
7468
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7706
|
-
const isPartialLastRow =
|
|
7469
|
+
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7707
7470
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7708
7471
|
const lastRowStartColumn = isPartialLastRow
|
|
7709
7472
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7711,21 +7474,19 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7711
7474
|
|
|
7712
7475
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7713
7476
|
|
|
7714
|
-
const
|
|
7715
|
-
width:
|
|
7716
|
-
...(
|
|
7717
|
-
?
|
|
7718
|
-
|
|
7719
|
-
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7720
|
-
: isCover
|
|
7721
|
-
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7722
|
-
: { height: 'auto' }),
|
|
7477
|
+
const imageWrapperStyle: React.CSSProperties = {
|
|
7478
|
+
width: imageWrapperWidth,
|
|
7479
|
+
...(isCover
|
|
7480
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7481
|
+
: { height: 'auto' }),
|
|
7723
7482
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7724
|
-
}
|
|
7483
|
+
};
|
|
7725
7484
|
|
|
7726
7485
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7727
7486
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7728
|
-
const shouldAlignEntries =
|
|
7487
|
+
const shouldAlignEntries = alignEntries === 'on';
|
|
7488
|
+
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7489
|
+
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7729
7490
|
|
|
7730
7491
|
const imageRadiusStyle = imageBorderRadius
|
|
7731
7492
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7745,73 +7506,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7745
7506
|
width: 'auto',
|
|
7746
7507
|
height: 'auto',
|
|
7747
7508
|
maxWidth: '100%',
|
|
7748
|
-
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7749
7509
|
...imageRadiusStyle,
|
|
7750
7510
|
};
|
|
7751
7511
|
|
|
7752
|
-
const
|
|
7753
|
-
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7754
|
-
useLayoutEffect(() => {
|
|
7755
|
-
if (!shouldMeasureEntries) {
|
|
7756
|
-
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7757
|
-
return;
|
|
7758
|
-
}
|
|
7759
|
-
const wrapper = containerRef.current;
|
|
7760
|
-
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7761
|
-
const measure = () => {
|
|
7762
|
-
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7763
|
-
if (unit <= 0) return;
|
|
7764
|
-
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7765
|
-
setCustomEntryHeights(prev => (
|
|
7766
|
-
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7767
|
-
? prev
|
|
7768
|
-
: heights
|
|
7769
|
-
));
|
|
7770
|
-
};
|
|
7771
|
-
measure();
|
|
7772
|
-
const ro = new ResizeObserver(measure);
|
|
7773
|
-
if (wrapper) ro.observe(wrapper);
|
|
7774
|
-
inners.forEach(inner => inner && ro.observe(inner));
|
|
7775
|
-
return () => ro.disconnect();
|
|
7776
|
-
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7777
|
-
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7778
|
-
? customEntryHeights
|
|
7779
|
-
: undefined;
|
|
7780
|
-
const customRows = useMemo(() => {
|
|
7781
|
-
if (!customLayout) return undefined;
|
|
7782
|
-
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7783
|
-
return {
|
|
7784
|
-
gridRows: rows.gridRows,
|
|
7785
|
-
gridTemplateRows: rows.tracks.length
|
|
7786
|
-
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7787
|
-
: 'auto',
|
|
7788
|
-
};
|
|
7789
|
-
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7790
|
-
const customSlots = useMemo(
|
|
7791
|
-
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7792
|
-
[customLayout, cropContent.length],
|
|
7793
|
-
);
|
|
7794
|
-
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7795
|
-
? {
|
|
7796
|
-
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7797
|
-
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7798
|
-
rowGap: 0,
|
|
7799
|
-
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7800
|
-
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7801
|
-
}
|
|
7802
|
-
: {
|
|
7803
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7804
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7805
|
-
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7806
|
-
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7807
|
-
...(shouldAlignEntries
|
|
7808
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7809
|
-
: {}),
|
|
7810
|
-
};
|
|
7811
|
-
|
|
7512
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
7812
7513
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7813
7514
|
|
|
7814
|
-
const
|
|
7515
|
+
const resolvedSplideDirection = transition === 'fade'
|
|
7516
|
+
? 'ltr'
|
|
7517
|
+
: direction === 'horizontal'
|
|
7518
|
+
? 'ltr'
|
|
7519
|
+
: direction === 'vertical'
|
|
7520
|
+
? 'ttb'
|
|
7521
|
+
: 'ltr';
|
|
7522
|
+
|
|
7523
|
+
useEffect(() => {
|
|
7524
|
+
const el = containerRef.current;
|
|
7525
|
+
if (!el) return;
|
|
7526
|
+
const ro = new ResizeObserver((entries) => {
|
|
7527
|
+
setContainerWidth(Math.round(entries[0].contentRect.width));
|
|
7528
|
+
});
|
|
7529
|
+
ro.observe(el);
|
|
7530
|
+
return () => ro.disconnect();
|
|
7531
|
+
}, []);
|
|
7532
|
+
|
|
7533
|
+
const lightboxPortalStyle = (() => {
|
|
7815
7534
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7816
7535
|
const articleWidth = containerRef.current
|
|
7817
7536
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7820,7 +7539,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7820
7539
|
style['--cntrl-article-width'] = articleWidth;
|
|
7821
7540
|
}
|
|
7822
7541
|
return style as React.CSSProperties;
|
|
7823
|
-
};
|
|
7542
|
+
})();
|
|
7824
7543
|
|
|
7825
7544
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7826
7545
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7859,8 +7578,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7859
7578
|
<div style={colorVars}>
|
|
7860
7579
|
<div
|
|
7861
7580
|
ref={containerRef}
|
|
7862
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}
|
|
7863
|
-
style={
|
|
7581
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7582
|
+
style={{
|
|
7583
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7584
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7585
|
+
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7586
|
+
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7587
|
+
...(shouldAlignEntries
|
|
7588
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7589
|
+
: {}),
|
|
7590
|
+
}}>
|
|
7864
7591
|
{cropContent.map((item: any, index: number) => {
|
|
7865
7592
|
const hasTitle = hasText(item.title);
|
|
7866
7593
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7870,24 +7597,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7870
7597
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7871
7598
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7872
7599
|
: undefined;
|
|
7873
|
-
const customSlot = customSlots?.[index];
|
|
7874
|
-
const itemSize = customSlot?.width ?? size;
|
|
7875
|
-
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
7876
|
-
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
7877
|
-
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
7878
|
-
const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
|
|
7879
|
-
const itemStyle: React.CSSProperties | undefined = customSlot
|
|
7880
|
-
? {
|
|
7881
|
-
gridColumn: customSlot.gridColumn,
|
|
7882
|
-
gridRow: customRows?.gridRows[index],
|
|
7883
|
-
alignSelf: 'start',
|
|
7884
|
-
}
|
|
7885
|
-
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7886
7600
|
|
|
7887
7601
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7888
7602
|
<div className={\`\${P}-item-text-block\`}>
|
|
7889
7603
|
{hasTitle && (
|
|
7890
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7604
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7891
7605
|
{item.title}
|
|
7892
7606
|
</p>
|
|
7893
7607
|
)}
|
|
@@ -7902,7 +7616,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7902
7616
|
/>
|
|
7903
7617
|
)}
|
|
7904
7618
|
{hasSubtitle && (
|
|
7905
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7619
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7906
7620
|
{item.subtitle}
|
|
7907
7621
|
</p>
|
|
7908
7622
|
)}
|
|
@@ -7932,7 +7646,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7932
7646
|
/>
|
|
7933
7647
|
)}
|
|
7934
7648
|
{hasTitle && (
|
|
7935
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7649
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
7936
7650
|
{item.title}
|
|
7937
7651
|
</p>
|
|
7938
7652
|
)}
|
|
@@ -7962,7 +7676,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7962
7676
|
/>
|
|
7963
7677
|
)}
|
|
7964
7678
|
{hasSubtitle && (
|
|
7965
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7679
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
7966
7680
|
{item.subtitle}
|
|
7967
7681
|
</p>
|
|
7968
7682
|
)}
|
|
@@ -7986,7 +7700,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7986
7700
|
</LinkWrapper>
|
|
7987
7701
|
);
|
|
7988
7702
|
|
|
7989
|
-
const
|
|
7703
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7704
|
+
const lightboxItemsForEntry = displayItems
|
|
7705
|
+
.filter(entry => entry.lightboxMedia)
|
|
7706
|
+
.map(entry => entry.lightboxMedia!);
|
|
7990
7707
|
|
|
7991
7708
|
const imageContent = (
|
|
7992
7709
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
@@ -7995,8 +7712,10 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7995
7712
|
: slider === 'off'
|
|
7996
7713
|
?
|
|
7997
7714
|
(() => {
|
|
7998
|
-
const { displayMedia } = displayItems[0];
|
|
7999
|
-
const lightboxIndex =
|
|
7715
|
+
const { displayMedia, lightboxMedia } = displayItems[0];
|
|
7716
|
+
const lightboxIndex = lightboxMedia
|
|
7717
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7718
|
+
: -1;
|
|
8000
7719
|
return (
|
|
8001
7720
|
<GridMediaItem
|
|
8002
7721
|
media={displayMedia}
|
|
@@ -8024,28 +7743,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8024
7743
|
))}
|
|
8025
7744
|
</div>
|
|
8026
7745
|
)}
|
|
8027
|
-
<
|
|
8028
|
-
key={\`\${transition}-\${
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
7746
|
+
<Splide
|
|
7747
|
+
key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7748
|
+
className={\`\${P}-item-slider\`}
|
|
7749
|
+
options={{
|
|
7750
|
+
arrows: false,
|
|
7751
|
+
pagination: false,
|
|
7752
|
+
drag: false,
|
|
7753
|
+
perPage: 1,
|
|
7754
|
+
autoplay: true,
|
|
7755
|
+
interval: sliderTiming * 1000,
|
|
7756
|
+
width: '100%',
|
|
7757
|
+
height: '100%',
|
|
7758
|
+
speed: SLIDER_TRANSITION_MS,
|
|
7759
|
+
type: transition === 'fade' ? 'fade' : 'loop',
|
|
7760
|
+
rewind: transition === 'fade',
|
|
7761
|
+
pauseOnHover: false,
|
|
7762
|
+
pauseOnFocus: false,
|
|
7763
|
+
direction: resolvedSplideDirection,
|
|
7764
|
+
}}
|
|
7765
|
+
onMoved={(splide) => {
|
|
7766
|
+
if (direction !== 'random' || transition === 'fade') return;
|
|
7767
|
+
handleRandomSlideMoved(splide);
|
|
7768
|
+
}}
|
|
7769
|
+
>
|
|
7770
|
+
{displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
|
|
7771
|
+
const lightboxIndex = lightboxMedia
|
|
7772
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7773
|
+
: -1;
|
|
8035
7774
|
return (
|
|
8036
|
-
<
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
7775
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
7776
|
+
<GridMediaItem
|
|
7777
|
+
media={displayMedia}
|
|
7778
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7779
|
+
style={imageStyle}
|
|
7780
|
+
hasLightbox={lightbox === 'on'}
|
|
7781
|
+
isSplideSlide
|
|
7782
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7783
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
7784
|
+
: undefined}
|
|
7785
|
+
/>
|
|
7786
|
+
</SplideSlide>
|
|
8046
7787
|
);
|
|
8047
7788
|
})}
|
|
8048
|
-
|
|
7789
|
+
</Splide>
|
|
8049
7790
|
</>
|
|
8050
7791
|
}
|
|
8051
7792
|
</GridItemMediaWrapper>
|
|
@@ -8063,7 +7804,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8063
7804
|
/>
|
|
8064
7805
|
<p
|
|
8065
7806
|
className={titleTextClassName}
|
|
8066
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7807
|
+
style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
|
|
8067
7808
|
>
|
|
8068
7809
|
{item.title}
|
|
8069
7810
|
</p>
|
|
@@ -8077,7 +7818,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8077
7818
|
/>
|
|
8078
7819
|
<p
|
|
8079
7820
|
className={subtitleTextClassName}
|
|
8080
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7821
|
+
style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
|
|
8081
7822
|
>
|
|
8082
7823
|
{item.subtitle}
|
|
8083
7824
|
</p>
|
|
@@ -8097,18 +7838,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8097
7838
|
<div
|
|
8098
7839
|
key={index}
|
|
8099
7840
|
className={\`\${P}-item\`.trim()}
|
|
8100
|
-
style={
|
|
7841
|
+
style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
|
|
8101
7842
|
>
|
|
8102
7843
|
<div
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
? \`\${P}-item-inner\`
|
|
7844
|
+
className={\`\${isEditMode
|
|
7845
|
+
? \`\${P}-item-inner\`
|
|
8106
7846
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
8107
7847
|
style={{
|
|
8108
7848
|
width: (textBoxWidth ?? 0) > 100
|
|
8109
|
-
? \`calc(\${
|
|
8110
|
-
:
|
|
8111
|
-
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7849
|
+
? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
7850
|
+
: entryWidthScaled,
|
|
8112
7851
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
8113
7852
|
}}
|
|
8114
7853
|
>
|
|
@@ -8154,7 +7893,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8154
7893
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
8155
7894
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
8156
7895
|
return createPortal(
|
|
8157
|
-
<div style={
|
|
7896
|
+
<div style={lightboxPortalStyle} data-selection="none">
|
|
8158
7897
|
<Lightbox
|
|
8159
7898
|
prefix={P}
|
|
8160
7899
|
items={lightboxItems}
|
|
@@ -8191,36 +7930,17 @@ type GridLayoutConfig = {
|
|
|
8191
7930
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
8192
7931
|
};
|
|
8193
7932
|
|
|
8194
|
-
type CustomGridBlock = {
|
|
8195
|
-
column: number;
|
|
8196
|
-
span: number;
|
|
8197
|
-
top: number;
|
|
8198
|
-
height: number;
|
|
8199
|
-
};
|
|
8200
|
-
|
|
8201
|
-
type CustomGridLayout = {
|
|
8202
|
-
columnsCount: number;
|
|
8203
|
-
columnWidth: number;
|
|
8204
|
-
gutterWidth: number;
|
|
8205
|
-
maxWidth: number | null;
|
|
8206
|
-
verticalGap?: number;
|
|
8207
|
-
beat?: number;
|
|
8208
|
-
repeatHeight?: number;
|
|
8209
|
-
blocks: CustomGridBlock[];
|
|
8210
|
-
};
|
|
8211
|
-
|
|
8212
7933
|
type GridSettings = {
|
|
8213
7934
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
8214
|
-
gridLayout
|
|
8215
|
-
customGrid?: CustomGridLayout;
|
|
7935
|
+
gridLayout: GridLayoutConfig;
|
|
8216
7936
|
textBoxWidth: number;
|
|
8217
|
-
verticalGap
|
|
8218
|
-
entriesCount
|
|
7937
|
+
verticalGap: number;
|
|
7938
|
+
entriesCount: number;
|
|
8219
7939
|
lightbox: 'on' | 'off';
|
|
8220
|
-
imageDisplay:
|
|
7940
|
+
imageDisplay: {
|
|
8221
7941
|
display: 'fit' | 'cover';
|
|
8222
|
-
ratioValue
|
|
8223
|
-
reversed
|
|
7942
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
7943
|
+
reversed: boolean;
|
|
8224
7944
|
};
|
|
8225
7945
|
imageCorners?: number;
|
|
8226
7946
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -8230,9 +7950,8 @@ type GridSettings = {
|
|
|
8230
7950
|
transition: 'fade' | 'slide',
|
|
8231
7951
|
showText: 'always' | 'on hover';
|
|
8232
7952
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
8233
|
-
alignEntries
|
|
7953
|
+
alignEntries: 'on' | 'off';
|
|
8234
7954
|
align?: 'top' | 'center' | 'bottom';
|
|
8235
|
-
textGrowth?: 'inside' | 'outside';
|
|
8236
7955
|
titleMarginTop: number;
|
|
8237
7956
|
subtitleMarginTop: number;
|
|
8238
7957
|
titleColor: string;
|
|
@@ -8279,7 +7998,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8279
7998
|
};
|
|
8280
7999
|
|
|
8281
8000
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8282
|
-
`,
|
|
8001
|
+
`, T = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8283
8002
|
import { CommonComponentProps } from '../props';
|
|
8284
8003
|
import { scalingValue } from '../utils/scalingValue';
|
|
8285
8004
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8852,7 +8571,7 @@ export function Helix({
|
|
|
8852
8571
|
</>
|
|
8853
8572
|
);
|
|
8854
8573
|
}
|
|
8855
|
-
`,
|
|
8574
|
+
`, R = `import { CommonComponentProps } from '../props';
|
|
8856
8575
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8857
8576
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8858
8577
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11304,7 +11023,7 @@ export function Hive({
|
|
|
11304
11023
|
</>
|
|
11305
11024
|
);
|
|
11306
11025
|
}
|
|
11307
|
-
`,
|
|
11026
|
+
`, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11308
11027
|
import { createPortal } from 'react-dom';
|
|
11309
11028
|
import { CommonComponentProps } from '../props';
|
|
11310
11029
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12107,7 +11826,7 @@ export type LightboxJournalSettings = {
|
|
|
12107
11826
|
closeIconColor: string;
|
|
12108
11827
|
closeIconHoverColor: string;
|
|
12109
11828
|
};
|
|
12110
|
-
`,
|
|
11829
|
+
`, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
12111
11830
|
import { createPortal } from 'react-dom';
|
|
12112
11831
|
import { CommonComponentProps } from '../props';
|
|
12113
11832
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12691,7 +12410,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12691
12410
|
</>
|
|
12692
12411
|
);
|
|
12693
12412
|
};
|
|
12694
|
-
`,
|
|
12413
|
+
`, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12695
12414
|
import { createPortal } from 'react-dom';
|
|
12696
12415
|
import { CommonComponentProps } from '../props';
|
|
12697
12416
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15796,7 +15515,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15796
15515
|
</>
|
|
15797
15516
|
);
|
|
15798
15517
|
}
|
|
15799
|
-
`,
|
|
15518
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15800
15519
|
import cn from 'classnames';
|
|
15801
15520
|
import { CommonComponentProps } from '../props';
|
|
15802
15521
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16654,7 +16373,7 @@ type MarqueeProps = {
|
|
|
16654
16373
|
isPreviewMode?: boolean;
|
|
16655
16374
|
isEditMode?: boolean;
|
|
16656
16375
|
} & CommonComponentProps;
|
|
16657
|
-
`,
|
|
16376
|
+
`, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16658
16377
|
import cn from 'classnames';
|
|
16659
16378
|
import { CommonComponentProps } from '../props';
|
|
16660
16379
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17597,7 +17316,7 @@ type MarqueeTextProps = {
|
|
|
17597
17316
|
isPreviewMode?: boolean;
|
|
17598
17317
|
isEditMode?: boolean;
|
|
17599
17318
|
} & CommonComponentProps;
|
|
17600
|
-
`,
|
|
17319
|
+
`, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17601
17320
|
import { createPortal } from 'react-dom';
|
|
17602
17321
|
import type React from 'react';
|
|
17603
17322
|
import { CommonComponentProps } from '../props';
|
|
@@ -20079,7 +19798,7 @@ export function Mercury({
|
|
|
20079
19798
|
</>
|
|
20080
19799
|
);
|
|
20081
19800
|
}
|
|
20082
|
-
`,
|
|
19801
|
+
`, O = `import React, { useMemo, useState } from 'react';
|
|
20083
19802
|
import { CommonComponentProps } from '../props';
|
|
20084
19803
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
20085
19804
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20658,7 +20377,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20658
20377
|
};
|
|
20659
20378
|
|
|
20660
20379
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20661
|
-
`,
|
|
20380
|
+
`, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20662
20381
|
import type React from 'react';
|
|
20663
20382
|
import { CommonComponentProps } from '../props';
|
|
20664
20383
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21497,7 +21216,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21497
21216
|
</>
|
|
21498
21217
|
);
|
|
21499
21218
|
}
|
|
21500
|
-
`,
|
|
21219
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21501
21220
|
import cn from 'classnames';
|
|
21502
21221
|
import { CommonComponentProps } from '../props';
|
|
21503
21222
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -22125,7 +21844,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
22125
21844
|
</>
|
|
22126
21845
|
);
|
|
22127
21846
|
}
|
|
22128
|
-
`,
|
|
21847
|
+
`, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
22129
21848
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
22130
21849
|
import { CommonComponentProps } from '../props';
|
|
22131
21850
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22757,7 +22476,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22757
22476
|
</>
|
|
22758
22477
|
);
|
|
22759
22478
|
}
|
|
22760
|
-
`,
|
|
22479
|
+
`, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22761
22480
|
import cn from 'classnames';
|
|
22762
22481
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22763
22482
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23939,7 +23658,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23939
23658
|
</svg>
|
|
23940
23659
|
);
|
|
23941
23660
|
}
|
|
23942
|
-
`,
|
|
23661
|
+
`, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23943
23662
|
import cn from 'classnames';
|
|
23944
23663
|
import { CommonComponentProps } from '../props';
|
|
23945
23664
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24570,7 +24289,7 @@ type TestimonialsSettings = {
|
|
|
24570
24289
|
logoHeight: number;
|
|
24571
24290
|
captionMarginTop: number;
|
|
24572
24291
|
};
|
|
24573
|
-
`,
|
|
24292
|
+
`, z = `import cn from 'classnames';
|
|
24574
24293
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24575
24294
|
import { CommonComponentProps } from '../props';
|
|
24576
24295
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -25066,7 +24785,7 @@ type TestimonialsSettings = {
|
|
|
25066
24785
|
icon?: string | null;
|
|
25067
24786
|
};
|
|
25068
24787
|
};
|
|
25069
|
-
`,
|
|
24788
|
+
`, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
25070
24789
|
import type React from 'react';
|
|
25071
24790
|
import { createPortal } from 'react-dom';
|
|
25072
24791
|
import { CommonComponentProps } from '../props';
|
|
@@ -25599,31 +25318,30 @@ export function Waterfall({
|
|
|
25599
25318
|
</>
|
|
25600
25319
|
);
|
|
25601
25320
|
}
|
|
25602
|
-
`,
|
|
25603
|
-
[
|
|
25604
|
-
[
|
|
25605
|
-
[
|
|
25606
|
-
[
|
|
25607
|
-
[
|
|
25608
|
-
[
|
|
25609
|
-
[
|
|
25610
|
-
[
|
|
25611
|
-
[
|
|
25612
|
-
[
|
|
25613
|
-
[
|
|
25614
|
-
[
|
|
25615
|
-
[
|
|
25616
|
-
[
|
|
25617
|
-
[
|
|
25618
|
-
[
|
|
25619
|
-
[
|
|
25620
|
-
[
|
|
25621
|
-
[
|
|
25622
|
-
[
|
|
25623
|
-
[
|
|
25624
|
-
[
|
|
25625
|
-
[e.id]: G
|
|
25321
|
+
`, U = {
|
|
25322
|
+
[y.id]: S,
|
|
25323
|
+
[b.id]: C,
|
|
25324
|
+
[x.id]: w,
|
|
25325
|
+
[P.id]: $,
|
|
25326
|
+
[v.id]: I,
|
|
25327
|
+
[f.id]: E,
|
|
25328
|
+
[h.id]: T,
|
|
25329
|
+
[p.id]: R,
|
|
25330
|
+
[m.id]: M,
|
|
25331
|
+
[g.id]: L,
|
|
25332
|
+
[u.id]: k,
|
|
25333
|
+
[d.id]: A,
|
|
25334
|
+
[c.id]: N,
|
|
25335
|
+
[l.id]: H,
|
|
25336
|
+
[s.id]: O,
|
|
25337
|
+
[a.id]: _,
|
|
25338
|
+
[r.id]: F,
|
|
25339
|
+
[o.id]: W,
|
|
25340
|
+
[i.id]: D,
|
|
25341
|
+
[t.id]: B,
|
|
25342
|
+
[e.id]: z,
|
|
25343
|
+
[n.id]: V
|
|
25626
25344
|
};
|
|
25627
25345
|
export {
|
|
25628
|
-
|
|
25346
|
+
U as componentSources
|
|
25629
25347
|
};
|