@cntrl-site/components 1.0.118-alpha.9 → 1.0.119
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/ChroniclesComponent-Bp8Zmj26.js +1 -0
- package/dist/{ChroniclesComponent-Bf8jxaas.mjs → ChroniclesComponent-D_YAkpJZ.mjs} +444 -514
- package/dist/Components/Grid/Grid.d.ts +7 -27
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +2 -0
- package/dist/ControlSlider-C8ckUIDm.js +1 -0
- package/dist/{ControlSlider-BBAXRDLP.mjs → ControlSlider-DqKfaKMG.mjs} +3 -2
- package/dist/Grid-C4hO8KCr.js +408 -0
- package/dist/Grid-Dud7PLS9.mjs +1622 -0
- package/dist/SimpleButton-BrIUFz_a.js +289 -0
- package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-GXckV2Tj.mjs} +198 -141
- package/dist/{components-IX-rNSn-.mjs → components-6CfbAMrX.mjs} +13 -14
- package/dist/{components-QVeWZKot.js → components-DcHbdTvp.js} +1 -1
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +8 -9
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +311 -633
- package/dist/sources.mjs +351 -674
- package/package.json +1 -1
- package/dist/ChroniclesComponent-XAHXrzRb.js +0 -1
- package/dist/Components/Grid/CustomGridComponent.d.ts +0 -41
- package/dist/ControlSlider-BCkVFl4w.js +0 -1
- package/dist/Grid-Dwn03N-q.mjs +0 -1853
- package/dist/Grid-pyPdnAeI.js +0 -445
- package/dist/SimpleButton-nGEcO2gB.js +0 -243
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-D_YAkpJZ.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';
|
|
@@ -2729,7 +2729,7 @@ export function Burger({
|
|
|
2729
2729
|
</div>
|
|
2730
2730
|
);
|
|
2731
2731
|
}
|
|
2732
|
-
`,
|
|
2732
|
+
`, w = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2733
2733
|
import { createPortal } from 'react-dom';
|
|
2734
2734
|
import cn from 'classnames';
|
|
2735
2735
|
import { CommonComponentProps } from '../props';
|
|
@@ -3776,7 +3776,7 @@ export function Chronicles({
|
|
|
3776
3776
|
</>
|
|
3777
3777
|
);
|
|
3778
3778
|
}
|
|
3779
|
-
`,
|
|
3779
|
+
`, C = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3780
3780
|
import { CommonComponentProps } from '../props';
|
|
3781
3781
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3782
3782
|
|
|
@@ -4305,7 +4305,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4305
4305
|
</>
|
|
4306
4306
|
);
|
|
4307
4307
|
}
|
|
4308
|
-
`,
|
|
4308
|
+
`, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4309
4309
|
import cn from 'classnames';
|
|
4310
4310
|
import { CommonComponentProps } from '../props';
|
|
4311
4311
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5049,7 +5049,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5049
5049
|
</>
|
|
5050
5050
|
);
|
|
5051
5051
|
}
|
|
5052
|
-
`,
|
|
5052
|
+
`, I = `import React, { useMemo, useState } from 'react';
|
|
5053
5053
|
import { CommonComponentProps } from '../props';
|
|
5054
5054
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5055
5055
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5687,7 +5687,9 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5687
5687
|
};
|
|
5688
5688
|
|
|
5689
5689
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5690
|
-
`,
|
|
5690
|
+
`, E = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5691
|
+
import '@splidejs/react-splide/css/core';
|
|
5692
|
+
import { CommonComponentProps } from '../props';
|
|
5691
5693
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5692
5694
|
import {
|
|
5693
5695
|
buildColorVars,
|
|
@@ -5697,7 +5699,7 @@ import {
|
|
|
5697
5699
|
useLazyVideos,
|
|
5698
5700
|
useScopedStyles,
|
|
5699
5701
|
} from '../utils/index';
|
|
5700
|
-
import {
|
|
5702
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5701
5703
|
import { createPortal } from 'react-dom';
|
|
5702
5704
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5703
5705
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5814,23 +5816,15 @@ function getCSS(P: string): string {
|
|
|
5814
5816
|
width: 100%;
|
|
5815
5817
|
overflow: hidden;
|
|
5816
5818
|
}
|
|
5819
|
+
.\${P}-item-slider .splide__track {
|
|
5820
|
+
overflow: hidden;
|
|
5821
|
+
}
|
|
5817
5822
|
.\${P}-item-image-link {
|
|
5818
5823
|
width: 100%;
|
|
5819
5824
|
display: flex;
|
|
5820
5825
|
flex-direction: column;
|
|
5821
5826
|
align-items: center;
|
|
5822
5827
|
}
|
|
5823
|
-
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5824
|
-
flex: 1 1 0%;
|
|
5825
|
-
min-height: 0;
|
|
5826
|
-
}
|
|
5827
|
-
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link,
|
|
5828
|
-
.\${P}-custom-layout.\${P}-auto-height .\${P}-item-image-link {
|
|
5829
|
-
flex: none;
|
|
5830
|
-
}
|
|
5831
|
-
.\${P}-auto-height .\${P}-item-image-wrapper-fit-slider > .\${P}-item-image-wrapper-sizer :is(img, video) {
|
|
5832
|
-
width: 100%;
|
|
5833
|
-
}
|
|
5834
5828
|
.\${P}-item-text-link {
|
|
5835
5829
|
display: flex;
|
|
5836
5830
|
flex-direction: column;
|
|
@@ -5851,47 +5845,18 @@ function getCSS(P: string): string {
|
|
|
5851
5845
|
display: block;
|
|
5852
5846
|
max-width: 100%;
|
|
5853
5847
|
}
|
|
5854
|
-
.\${P}-item-slider
|
|
5855
|
-
|
|
5848
|
+
.\${P}-item-slider,
|
|
5849
|
+
.\${P}-item-slider .splide__track,
|
|
5850
|
+
.\${P}-item-slider .splide__list,
|
|
5851
|
+
.\${P}-item-slider .splide__slide {
|
|
5856
5852
|
width: 100%;
|
|
5857
5853
|
height: 100%;
|
|
5858
|
-
overflow: hidden;
|
|
5859
|
-
}
|
|
5860
|
-
.\${P}-item-slider-list {
|
|
5861
|
-
position: relative;
|
|
5862
|
-
display: flex;
|
|
5863
|
-
flex-direction: row;
|
|
5864
|
-
width: 100%;
|
|
5865
|
-
height: 100%;
|
|
5866
|
-
will-change: transform;
|
|
5867
|
-
}
|
|
5868
|
-
.\${P}-item-slider-list-vertical {
|
|
5869
|
-
flex-direction: column;
|
|
5870
5854
|
}
|
|
5871
|
-
.\${P}-item-slider
|
|
5872
|
-
display: block;
|
|
5873
|
-
will-change: auto;
|
|
5874
|
-
}
|
|
5875
|
-
.\${P}-item-slide {
|
|
5876
|
-
position: relative;
|
|
5877
|
-
flex: 0 0 100%;
|
|
5878
|
-
width: 100%;
|
|
5879
|
-
height: 100%;
|
|
5855
|
+
.\${P}-item-slider .splide__slide {
|
|
5880
5856
|
display: flex;
|
|
5881
5857
|
justify-content: center;
|
|
5882
5858
|
align-items: center;
|
|
5883
5859
|
}
|
|
5884
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide {
|
|
5885
|
-
position: absolute;
|
|
5886
|
-
top: 0;
|
|
5887
|
-
left: 0;
|
|
5888
|
-
opacity: 0;
|
|
5889
|
-
transition: opacity \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING};
|
|
5890
|
-
}
|
|
5891
|
-
.\${P}-item-slider-list-fade .\${P}-item-slide-active {
|
|
5892
|
-
opacity: 1;
|
|
5893
|
-
z-index: 1;
|
|
5894
|
-
}
|
|
5895
5860
|
.\${P}-item-title {
|
|
5896
5861
|
white-space: normal;
|
|
5897
5862
|
overflow-wrap: anywhere;
|
|
@@ -6038,13 +6003,13 @@ function getCSS(P: string): string {
|
|
|
6038
6003
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6039
6004
|
align-items: flex-end;
|
|
6040
6005
|
}
|
|
6041
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6006
|
+
.\${P}-image-align-top .\${P}-item-slider .splide__slide {
|
|
6042
6007
|
align-items: flex-start;
|
|
6043
6008
|
}
|
|
6044
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6009
|
+
.\${P}-image-align-center .\${P}-item-slider .splide__slide {
|
|
6045
6010
|
align-items: center;
|
|
6046
6011
|
}
|
|
6047
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6012
|
+
.\${P}-image-align-bottom .\${P}-item-slider .splide__slide {
|
|
6048
6013
|
align-items: flex-end;
|
|
6049
6014
|
}
|
|
6050
6015
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6125,13 +6090,13 @@ function getCSS(P: string): string {
|
|
|
6125
6090
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6126
6091
|
align-items: flex-end;
|
|
6127
6092
|
}
|
|
6128
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6093
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6129
6094
|
align-items: flex-start;
|
|
6130
6095
|
}
|
|
6131
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6096
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6132
6097
|
align-items: center;
|
|
6133
6098
|
}
|
|
6134
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6099
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .splide__slide {
|
|
6135
6100
|
align-items: flex-end;
|
|
6136
6101
|
}
|
|
6137
6102
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6199,9 +6164,27 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6199
6164
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6200
6165
|
}
|
|
6201
6166
|
|
|
6202
|
-
function
|
|
6203
|
-
|
|
6204
|
-
|
|
6167
|
+
function resumeSplideAutoplay(splide: { Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } } }) {
|
|
6168
|
+
const autoplay = splide.Components.Autoplay;
|
|
6169
|
+
if (!autoplay) return;
|
|
6170
|
+
autoplay.pause(false);
|
|
6171
|
+
autoplay.play();
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6174
|
+
function handleRandomSlideMoved(splide: {
|
|
6175
|
+
options: { direction?: string };
|
|
6176
|
+
Components: { Autoplay?: { pause: (stop?: boolean) => void; play: () => void } };
|
|
6177
|
+
}) {
|
|
6178
|
+
const next = pickRandomSlideDirection();
|
|
6179
|
+
if (splide.options.direction !== next) {
|
|
6180
|
+
splide.options = { ...splide.options, direction: next };
|
|
6181
|
+
}
|
|
6182
|
+
|
|
6183
|
+
requestAnimationFrame(() => {
|
|
6184
|
+
requestAnimationFrame(() => {
|
|
6185
|
+
resumeSplideAutoplay(splide);
|
|
6186
|
+
});
|
|
6187
|
+
});
|
|
6205
6188
|
}
|
|
6206
6189
|
|
|
6207
6190
|
type GridProps = {
|
|
@@ -6241,8 +6224,6 @@ type LightboxProps = {
|
|
|
6241
6224
|
|
|
6242
6225
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6243
6226
|
const SLIDER_TRANSITION_MS = 750;
|
|
6244
|
-
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6245
|
-
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6246
6227
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6247
6228
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6248
6229
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6332,7 +6313,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6332
6313
|
return result;
|
|
6333
6314
|
}
|
|
6334
6315
|
|
|
6335
|
-
|
|
6316
|
+
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6336
6317
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6337
6318
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6338
6319
|
// an embed's player is only ever framed where it shows
|
|
@@ -6371,7 +6352,7 @@ const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaL
|
|
|
6371
6352
|
))}
|
|
6372
6353
|
</div>
|
|
6373
6354
|
);
|
|
6374
|
-
}
|
|
6355
|
+
}
|
|
6375
6356
|
|
|
6376
6357
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6377
6358
|
video.pause();
|
|
@@ -6379,121 +6360,15 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6379
6360
|
video.load();
|
|
6380
6361
|
}
|
|
6381
6362
|
|
|
6382
|
-
const
|
|
6383
|
-
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6384
|
-
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6363
|
+
const SPLIDE_SLIDE_VIDEOS = '.splide__slide video';
|
|
6385
6364
|
|
|
6386
6365
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
isFade: boolean;
|
|
6394
|
-
direction: GridSettings['direction'];
|
|
6395
|
-
intervalMs: number;
|
|
6396
|
-
};
|
|
6397
|
-
|
|
6398
|
-
function GridEntrySlider({ prefix: P, slides, isFade, direction, intervalMs }: GridEntrySliderProps) {
|
|
6399
|
-
const count = slides.length;
|
|
6400
|
-
const hasClones = !isFade && count > 1;
|
|
6401
|
-
const isRandom = !isFade && direction === 'random';
|
|
6402
|
-
const delayMs = Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : SLIDER_DEFAULT_INTERVAL_MS;
|
|
6403
|
-
const [position, setPosition] = useState(hasClones ? 1 : 0);
|
|
6404
|
-
const [axis, setAxis] = useState<'ltr' | 'ttb'>(!isFade && direction === 'vertical' ? 'ttb' : 'ltr');
|
|
6405
|
-
const [isMoving, setIsMoving] = useState(false);
|
|
6406
|
-
const [skipTransition, setSkipTransition] = useState(false);
|
|
6407
|
-
const [cycle, setCycle] = useState(0);
|
|
6408
|
-
const isMovingRef = useRef(false);
|
|
6409
|
-
|
|
6410
|
-
useEffect(() => {
|
|
6411
|
-
if (count < 2) return;
|
|
6412
|
-
const timeoutId = window.setTimeout(() => {
|
|
6413
|
-
if (isMovingRef.current) {
|
|
6414
|
-
setCycle(prev => prev + 1);
|
|
6415
|
-
return;
|
|
6416
|
-
}
|
|
6417
|
-
isMovingRef.current = true;
|
|
6418
|
-
setIsMoving(true);
|
|
6419
|
-
setSkipTransition(false);
|
|
6420
|
-
setPosition(prev => (hasClones ? prev + 1 : wrapSlideIndex(prev + 1, count)));
|
|
6421
|
-
if (!isRandom) setCycle(prev => prev + 1);
|
|
6422
|
-
}, delayMs);
|
|
6423
|
-
return () => window.clearTimeout(timeoutId);
|
|
6424
|
-
}, [count, cycle, delayMs, hasClones, isRandom]);
|
|
6425
|
-
|
|
6426
|
-
useEffect(() => {
|
|
6427
|
-
if (!isMoving) return;
|
|
6428
|
-
const timeoutId = window.setTimeout(() => {
|
|
6429
|
-
const isOnClone = hasClones && position === count + 1;
|
|
6430
|
-
const nextAxis = isRandom ? pickRandomSlideDirection() : axis;
|
|
6431
|
-
if (isOnClone || nextAxis !== axis) {
|
|
6432
|
-
setSkipTransition(true);
|
|
6433
|
-
if (isOnClone) setPosition(1);
|
|
6434
|
-
setAxis(nextAxis);
|
|
6435
|
-
}
|
|
6436
|
-
isMovingRef.current = false;
|
|
6437
|
-
setIsMoving(false);
|
|
6438
|
-
if (isRandom) setCycle(prev => prev + 1);
|
|
6439
|
-
}, SLIDER_TRANSITION_MS);
|
|
6440
|
-
return () => window.clearTimeout(timeoutId);
|
|
6441
|
-
}, [axis, count, hasClones, isMoving, isRandom, position]);
|
|
6442
|
-
|
|
6443
|
-
useEffect(() => {
|
|
6444
|
-
if (!skipTransition) return;
|
|
6445
|
-
let innerId = 0;
|
|
6446
|
-
const outerId = requestAnimationFrame(() => {
|
|
6447
|
-
innerId = requestAnimationFrame(() => setSkipTransition(false));
|
|
6448
|
-
});
|
|
6449
|
-
return () => {
|
|
6450
|
-
cancelAnimationFrame(outerId);
|
|
6451
|
-
cancelAnimationFrame(innerId);
|
|
6452
|
-
};
|
|
6453
|
-
}, [skipTransition]);
|
|
6454
|
-
|
|
6455
|
-
const slotsCount = hasClones ? count + 2 : count;
|
|
6456
|
-
const getItemIndex = (slot: number) => (hasClones ? wrapSlideIndex(slot - 1, count) : slot);
|
|
6457
|
-
const isCloneSlot = (slot: number) => hasClones && (slot === 0 || slot === count + 1);
|
|
6458
|
-
const activeIndex = getItemIndex(position);
|
|
6459
|
-
const nextSlot = position + 1 < slotsCount ? position + 1 : -1;
|
|
6460
|
-
const isPlayingSlot = (slot: number) => isFade
|
|
6461
|
-
|| (slot === position && !isCloneSlot(slot))
|
|
6462
|
-
|| slot === nextSlot
|
|
6463
|
-
|| (nextSlot >= 0 && !isCloneSlot(slot) && getItemIndex(slot) === getItemIndex(nextSlot));
|
|
6464
|
-
const isVertical = !isFade && axis === 'ttb';
|
|
6465
|
-
const listStyle: React.CSSProperties | undefined = isFade
|
|
6466
|
-
? undefined
|
|
6467
|
-
: {
|
|
6468
|
-
transform: isVertical
|
|
6469
|
-
? \`translate3d(0, \${-position * 100}%, 0)\`
|
|
6470
|
-
: \`translate3d(\${-position * 100}%, 0, 0)\`,
|
|
6471
|
-
transition: skipTransition ? 'none' : \`transform \${SLIDER_TRANSITION_MS}ms \${SLIDER_EASING}\`,
|
|
6472
|
-
};
|
|
6473
|
-
|
|
6474
|
-
return (
|
|
6475
|
-
<div className={\`\${P}-item-slider\`}>
|
|
6476
|
-
<div
|
|
6477
|
-
className={\`\${P}-item-slider-list\${isFade ? \` \${P}-item-slider-list-fade\` : ''}\${isVertical ? \` \${P}-item-slider-list-vertical\` : ''}\`}
|
|
6478
|
-
style={listStyle}
|
|
6479
|
-
>
|
|
6480
|
-
{Array.from({ length: slotsCount }, (_, slot) => {
|
|
6481
|
-
const itemIndex = getItemIndex(slot);
|
|
6482
|
-
const isClone = isCloneSlot(slot);
|
|
6483
|
-
const isShown = isFade ? itemIndex === activeIndex : slot === position;
|
|
6484
|
-
return (
|
|
6485
|
-
<div
|
|
6486
|
-
key={isClone ? \`clone-\${slot === 0 ? 'start' : 'end'}\` : \`slide-\${itemIndex}\`}
|
|
6487
|
-
className={\`\${P}-item-slide \${GRID_SLIDE_CLASS}\${isFade && isShown ? \` \${P}-item-slide-active\` : ''}\${isPlayingSlot(slot) ? \` \${GRID_SLIDE_PLAYING_CLASS}\` : ''}\`}
|
|
6488
|
-
aria-hidden={isShown ? undefined : true}
|
|
6489
|
-
>
|
|
6490
|
-
{slides[itemIndex]}
|
|
6491
|
-
</div>
|
|
6492
|
-
);
|
|
6493
|
-
})}
|
|
6494
|
-
</div>
|
|
6495
|
-
</div>
|
|
6496
|
-
);
|
|
6366
|
+
if (video.closest('.splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next')) return true;
|
|
6367
|
+
const slide = video.closest<HTMLElement>('.splide__slide');
|
|
6368
|
+
if (!slide || slide.classList.contains('splide__slide--clone')) return false;
|
|
6369
|
+
const slideIndex = slide.dataset.slideIndex;
|
|
6370
|
+
const upcomingSlide = slide.parentElement?.querySelector<HTMLElement>('.splide__slide.is-next');
|
|
6371
|
+
return slideIndex !== undefined && upcomingSlide?.dataset.slideIndex === slideIndex;
|
|
6497
6372
|
}
|
|
6498
6373
|
|
|
6499
6374
|
function GridMediaItem({
|
|
@@ -6501,7 +6376,7 @@ function GridMediaItem({
|
|
|
6501
6376
|
className,
|
|
6502
6377
|
style,
|
|
6503
6378
|
hasLightbox,
|
|
6504
|
-
|
|
6379
|
+
isSplideSlide = false,
|
|
6505
6380
|
onMediaClick,
|
|
6506
6381
|
}: {
|
|
6507
6382
|
media: GridMedia;
|
|
@@ -6509,7 +6384,7 @@ function GridMediaItem({
|
|
|
6509
6384
|
style: React.CSSProperties;
|
|
6510
6385
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6511
6386
|
hasLightbox: boolean;
|
|
6512
|
-
|
|
6387
|
+
isSplideSlide?: boolean;
|
|
6513
6388
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6514
6389
|
}) {
|
|
6515
6390
|
if (isEmbedMedia(media)) {
|
|
@@ -6541,7 +6416,7 @@ function GridMediaItem({
|
|
|
6541
6416
|
playsInline: true,
|
|
6542
6417
|
onClick: onMediaClick,
|
|
6543
6418
|
};
|
|
6544
|
-
return
|
|
6419
|
+
return isSplideSlide
|
|
6545
6420
|
? <video {...videoProps} preload='none' />
|
|
6546
6421
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6547
6422
|
}
|
|
@@ -6570,7 +6445,7 @@ function GridItemMediaWrapper({
|
|
|
6570
6445
|
children: React.ReactNode;
|
|
6571
6446
|
}) {
|
|
6572
6447
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6573
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6448
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: SPLIDE_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6574
6449
|
|
|
6575
6450
|
return (
|
|
6576
6451
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7471,149 +7346,11 @@ function resolveLightboxImageDisplay(
|
|
|
7471
7346
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7472
7347
|
}
|
|
7473
7348
|
|
|
7474
|
-
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7475
|
-
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7476
|
-
}
|
|
7477
|
-
|
|
7478
|
-
type CustomGridSlot = {
|
|
7479
|
-
column: number;
|
|
7480
|
-
span: number;
|
|
7481
|
-
width: number;
|
|
7482
|
-
top: number;
|
|
7483
|
-
height: number;
|
|
7484
|
-
gridColumn: string;
|
|
7485
|
-
};
|
|
7486
|
-
|
|
7487
|
-
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7488
|
-
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7489
|
-
}
|
|
7490
|
-
|
|
7491
|
-
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7492
|
-
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7493
|
-
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7494
|
-
}
|
|
7495
|
-
|
|
7496
|
-
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7497
|
-
const block = layout.blocks[index % layout.blocks.length];
|
|
7498
|
-
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7499
|
-
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7500
|
-
return {
|
|
7501
|
-
column,
|
|
7502
|
-
span,
|
|
7503
|
-
width: getCustomGridSpanWidth(layout, span),
|
|
7504
|
-
top: Math.max(0, block.top),
|
|
7505
|
-
height: Math.max(0, block.height),
|
|
7506
|
-
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7507
|
-
};
|
|
7508
|
-
}
|
|
7509
|
-
|
|
7510
|
-
const EDGE_TOLERANCE = 1e-6;
|
|
7511
|
-
|
|
7512
|
-
function getCustomGridRows(layout: CustomGridLayout, entriesCount: number, entryHeights?: number[]) {
|
|
7513
|
-
const beat = layout.beat ?? 0;
|
|
7514
|
-
const onBeats = beat > 0 && !!entryHeights;
|
|
7515
|
-
const snapUp = (value: number) => Math.ceil(value / beat - 1e-3) * beat;
|
|
7516
|
-
const tracks: (number | 'auto')[] = [];
|
|
7517
|
-
const gridRows: string[] = [];
|
|
7518
|
-
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7519
|
-
for (let groupStart = 0; groupStart < entriesCount; groupStart += layout.blocks.length) {
|
|
7520
|
-
if (groupStart > 0 && verticalGap > 0) tracks.push(verticalGap);
|
|
7521
|
-
const slots = Array.from(
|
|
7522
|
-
{ length: Math.min(layout.blocks.length, entriesCount - groupStart) },
|
|
7523
|
-
(_, index) => getCustomGridSlot(layout, groupStart + index),
|
|
7524
|
-
);
|
|
7525
|
-
const ends = slots.map((slot) => {
|
|
7526
|
-
const under = slots.filter(other => other.column < slot.column + slot.span
|
|
7527
|
-
&& slot.column < other.column + other.span
|
|
7528
|
-
&& other.top >= slot.top + slot.height - EDGE_TOLERANCE);
|
|
7529
|
-
return under.length > 0 ? Math.min(...under.map(other => other.top)) : undefined;
|
|
7530
|
-
});
|
|
7531
|
-
const tops = [0, ...slots.map(slot => slot.top)]
|
|
7532
|
-
.sort((a, b) => a - b)
|
|
7533
|
-
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7534
|
-
const isSame = (a: number, b: number) => Math.abs(a - b) <= EDGE_TOLERANCE;
|
|
7535
|
-
const getTop = (value: number) => tops.findIndex(top => isSame(top, value));
|
|
7536
|
-
const positions: number[] = [];
|
|
7537
|
-
let position = 0;
|
|
7538
|
-
const pushContentTrack = (isEnding: (end: number | undefined) => boolean) => {
|
|
7539
|
-
const ending = slots.flatMap((slot, index) => (isEnding(ends[index]) ? [{ slot, entry: groupStart + index }] : []));
|
|
7540
|
-
if (ending.length === 0) return;
|
|
7541
|
-
if (!onBeats) {
|
|
7542
|
-
tracks.push('auto');
|
|
7543
|
-
return;
|
|
7544
|
-
}
|
|
7545
|
-
const needed = Math.max(...ending.map(({ slot, entry }) => positions[getTop(slot.top)] + (entryHeights[entry] ?? 0)));
|
|
7546
|
-
const track = Math.max(0, snapUp(needed) - position);
|
|
7547
|
-
tracks.push(track);
|
|
7548
|
-
position += track;
|
|
7549
|
-
};
|
|
7550
|
-
const lines = tops.map((top, index) => {
|
|
7551
|
-
if (index > 0) {
|
|
7552
|
-
tracks.push(top - tops[index - 1]);
|
|
7553
|
-
position += top - tops[index - 1];
|
|
7554
|
-
}
|
|
7555
|
-
pushContentTrack(end => end !== undefined && isSame(end, top));
|
|
7556
|
-
positions.push(position);
|
|
7557
|
-
return tracks.length + 1;
|
|
7558
|
-
});
|
|
7559
|
-
pushContentTrack(end => end === undefined);
|
|
7560
|
-
const groupEnd = tracks.length + 1;
|
|
7561
|
-
const getLine = (value: number) => lines[getTop(value)];
|
|
7562
|
-
slots.forEach((slot, index) => {
|
|
7563
|
-
const end = ends[index];
|
|
7564
|
-
gridRows.push(\`\${getLine(slot.top)} / \${end === undefined ? groupEnd : getLine(end)}\`);
|
|
7565
|
-
});
|
|
7566
|
-
}
|
|
7567
|
-
return { tracks, gridRows };
|
|
7568
|
-
}
|
|
7569
|
-
|
|
7570
|
-
function getGridMediaAspect(media: GridMedia): number | undefined {
|
|
7571
|
-
if (isEmbedMedia(media)) return getEmbedAspect(media);
|
|
7572
|
-
return media.width && media.height && media.width > 0 && media.height > 0 ? media.width / media.height : undefined;
|
|
7573
|
-
}
|
|
7574
|
-
|
|
7575
|
-
/**
|
|
7576
|
-
* Where each entry stands, given the height it takes; the CMS grid builder places its blocks the same way.
|
|
7577
|
-
* A block keeps its drawn distance to the blocks above it in its group; a block with none above it starts at
|
|
7578
|
-
* its drawn top in the group, or, with masonry on, the vertical gap below whatever earlier group reaches
|
|
7579
|
-
* lowest in its columns.
|
|
7580
|
-
*/
|
|
7581
|
-
function placeCustomGridEntries(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7582
|
-
const groupSize = layout.blocks.length;
|
|
7583
|
-
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7584
|
-
const isMasonry = layout.masonry === 'on';
|
|
7585
|
-
const tops: number[] = [];
|
|
7586
|
-
const placed: { column: number; span: number; bottom: number; group: number }[] = [];
|
|
7587
|
-
const getBottom = (items: typeof placed) => items.reduce((bottom, item) => Math.max(bottom, item.bottom), 0);
|
|
7588
|
-
let groupStart = 0;
|
|
7589
|
-
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7590
|
-
const group = start / groupSize;
|
|
7591
|
-
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7592
|
-
.sort((a, b) => slots[a].top - slots[b].top || a - b);
|
|
7593
|
-
for (const entry of entries) {
|
|
7594
|
-
const slot = slots[entry];
|
|
7595
|
-
const sharesColumns = (other: { column: number; span: number }) => other.column < slot.column + slot.span
|
|
7596
|
-
&& slot.column < other.column + other.span;
|
|
7597
|
-
const above = entries.filter(other => other !== entry && tops[other] !== undefined && sharesColumns(slots[other])
|
|
7598
|
-
&& slots[other].top + slots[other].height <= slot.top + EDGE_TOLERANCE);
|
|
7599
|
-
const earlier = isMasonry ? placed.filter(item => item.group < group && sharesColumns(item)) : [];
|
|
7600
|
-
const candidates = above.map(other => tops[other] + heights[other] + slot.top - (slots[other].top + slots[other].height));
|
|
7601
|
-
if (earlier.length > 0) candidates.push(getBottom(earlier) + verticalGap);
|
|
7602
|
-
if (candidates.length === 0) candidates.push(groupStart + slot.top);
|
|
7603
|
-
tops[entry] = Math.max(...candidates);
|
|
7604
|
-
placed.push({ column: slot.column, span: slot.span, bottom: tops[entry] + heights[entry], group });
|
|
7605
|
-
}
|
|
7606
|
-
groupStart = getBottom(placed) + verticalGap;
|
|
7607
|
-
}
|
|
7608
|
-
return { tops, bottom: getBottom(placed) };
|
|
7609
|
-
}
|
|
7610
|
-
|
|
7611
7349
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7612
7350
|
const { prefix: P } = useScopedStyles();
|
|
7613
7351
|
const {
|
|
7614
7352
|
type = 'a',
|
|
7615
7353
|
gridLayout,
|
|
7616
|
-
customGrid,
|
|
7617
7354
|
textBoxWidth = 100,
|
|
7618
7355
|
verticalGap,
|
|
7619
7356
|
entriesCount,
|
|
@@ -7661,69 +7398,62 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7661
7398
|
hover = 'none',
|
|
7662
7399
|
alignEntries = 'off',
|
|
7663
7400
|
align = 'top',
|
|
7664
|
-
textGrowth = 'inside',
|
|
7665
7401
|
} = settings;
|
|
7666
7402
|
|
|
7667
|
-
const
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7685
|
-
]);
|
|
7403
|
+
const resolvedTitleTextStyle: TextStyles = {
|
|
7404
|
+
fontSettings: {
|
|
7405
|
+
fontFamily: titleFontFamily,
|
|
7406
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7407
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7408
|
+
},
|
|
7409
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7410
|
+
lineHeight: titleLineHeight,
|
|
7411
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7412
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7413
|
+
textAppearance: titleTextAppearance,
|
|
7414
|
+
color: titleColor,
|
|
7415
|
+
};
|
|
7416
|
+
const titleTypographyCss = omitTextColors(textStylesToCss(resolvedTitleTextStyle, isEditor));
|
|
7417
|
+
const titleFieldCss = {
|
|
7418
|
+
...titleTypographyCss,
|
|
7419
|
+
} as React.CSSProperties;
|
|
7686
7420
|
|
|
7687
|
-
const
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7705
|
-
]);
|
|
7421
|
+
const resolvedSubtitleTextStyle: TextStyles = {
|
|
7422
|
+
fontSettings: {
|
|
7423
|
+
fontFamily: subtitleFontFamily,
|
|
7424
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7425
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7426
|
+
},
|
|
7427
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7428
|
+
lineHeight: subtitleLineHeight,
|
|
7429
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7430
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7431
|
+
textAppearance: subtitleTextAppearance,
|
|
7432
|
+
color: subtitleColor,
|
|
7433
|
+
};
|
|
7434
|
+
const subtitleTypographyCss = omitTextColors(textStylesToCss(resolvedSubtitleTextStyle, isEditor));
|
|
7435
|
+
const subtitleFieldCss = {
|
|
7436
|
+
...subtitleTypographyCss,
|
|
7437
|
+
} as React.CSSProperties;
|
|
7706
7438
|
|
|
7707
|
-
const
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7439
|
+
const resolvedLightboxCounterTextStyle: TextStyles = {
|
|
7440
|
+
fontSettings: {
|
|
7441
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7442
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7443
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7444
|
+
},
|
|
7445
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7446
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7447
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7448
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7449
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7450
|
+
color: lightboxCounterColor,
|
|
7451
|
+
};
|
|
7452
|
+
const lightboxCounterTypographyCss = omitTextColors(textStylesToCss(resolvedLightboxCounterTextStyle, isEditor));
|
|
7453
|
+
const lightboxCounterFieldCss = {
|
|
7454
|
+
...lightboxCounterTypographyCss,
|
|
7721
7455
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7722
|
-
} as React.CSSProperties
|
|
7723
|
-
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7724
|
-
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7725
|
-
isEditor, P,
|
|
7726
|
-
]);
|
|
7456
|
+
} as React.CSSProperties;
|
|
7727
7457
|
|
|
7728
7458
|
const titleTextClassName = getGridTextClassName(
|
|
7729
7459
|
titleFontSize,
|
|
@@ -7737,6 +7467,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7737
7467
|
\`\${P}-item-subtitle\`,
|
|
7738
7468
|
\`\${P}-text-tight-leading\`,
|
|
7739
7469
|
);
|
|
7470
|
+
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7471
|
+
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7740
7472
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7741
7473
|
lightboxCounterFontSize,
|
|
7742
7474
|
lightboxCounterLineHeight,
|
|
@@ -7744,59 +7476,42 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7744
7476
|
\`\${P}-text-tight-leading\`,
|
|
7745
7477
|
);
|
|
7746
7478
|
|
|
7747
|
-
const colorVars =
|
|
7479
|
+
const colorVars = buildColorVars(P, {
|
|
7748
7480
|
titleColor,
|
|
7749
7481
|
subtitleColor,
|
|
7750
7482
|
lightboxCounterColor,
|
|
7751
|
-
}, COLOR_VAR_MAP, STATE_KEYS)
|
|
7483
|
+
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7752
7484
|
|
|
7753
7485
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7754
7486
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7755
7487
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7756
7488
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7757
7489
|
|
|
7758
|
-
const
|
|
7759
|
-
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7760
|
-
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7761
|
-
const isAutoHeight = customLayout?.cellHeight === 'auto';
|
|
7762
|
-
// entries stand where placeCustomGridEntries puts them rather than on grid rows
|
|
7763
|
-
const isPlacedLayout = isAutoHeight || customLayout?.masonry === 'on';
|
|
7764
|
-
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7765
|
-
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7490
|
+
const resEntriesCount = entriesCount === 0 ? Infinity : entriesCount;
|
|
7766
7491
|
|
|
7767
|
-
const cropContent =
|
|
7492
|
+
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7768
7493
|
const lightboxMediaToPreload = useMemo(
|
|
7769
7494
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7770
7495
|
[cropContent, lightbox],
|
|
7771
7496
|
);
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7779
|
-
: -1));
|
|
7780
|
-
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7781
|
-
}), [cropContent]);
|
|
7782
|
-
|
|
7783
|
-
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7784
|
-
|
|
7785
|
-
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7786
|
-
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7787
|
-
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7788
|
-
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7497
|
+
|
|
7498
|
+
const size = gridLayout.entryWidth ?? 0.2;
|
|
7499
|
+
|
|
7500
|
+
const isCover = imageDisplay?.display === 'cover';
|
|
7501
|
+
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
7502
|
+
const ratioReversed = imageDisplay?.reversed ?? false;
|
|
7789
7503
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7790
7504
|
const effW = ratioReversed ? rH : rW;
|
|
7791
7505
|
const effH = ratioReversed ? rW : rH;
|
|
7792
7506
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7793
7507
|
|
|
7794
|
-
const columnsCount = gridLayout
|
|
7508
|
+
const columnsCount = gridLayout.columnsCount;
|
|
7795
7509
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7796
|
-
const
|
|
7510
|
+
const imageWrapperWidth = entryWidthScaled;
|
|
7511
|
+
const isFitSlider = !isCover && slider !== 'off';
|
|
7797
7512
|
|
|
7798
7513
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7799
|
-
const isPartialLastRow =
|
|
7514
|
+
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7800
7515
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7801
7516
|
const lastRowStartColumn = isPartialLastRow
|
|
7802
7517
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7804,47 +7519,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7804
7519
|
|
|
7805
7520
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7806
7521
|
|
|
7807
|
-
const
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
width: entryWidth,
|
|
7813
|
-
...(slot && isAutoHeight
|
|
7814
|
-
? {
|
|
7815
|
-
// an entry with no media keeps the drawn height, so it can still be seen and filled
|
|
7816
|
-
height: media?.isEmpty ? scalingValue(slot.height, isEditor) : 'auto',
|
|
7817
|
-
flexShrink: 0,
|
|
7818
|
-
overflow: 'hidden',
|
|
7819
|
-
...(media?.aspect && !isFitSlider ? { aspectRatio: \`\${media.aspect}\` } : {}),
|
|
7820
|
-
}
|
|
7821
|
-
: slot
|
|
7822
|
-
? isTextOutside
|
|
7823
|
-
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7824
|
-
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7825
|
-
: isCover
|
|
7826
|
-
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7827
|
-
: { height: 'auto' }),
|
|
7522
|
+
const imageWrapperStyle: React.CSSProperties = {
|
|
7523
|
+
width: imageWrapperWidth,
|
|
7524
|
+
...(isCover
|
|
7525
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7526
|
+
: { height: 'auto' }),
|
|
7828
7527
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7829
|
-
}
|
|
7528
|
+
};
|
|
7830
7529
|
|
|
7831
7530
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7832
7531
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7833
|
-
const shouldAlignEntries =
|
|
7532
|
+
const shouldAlignEntries = alignEntries === 'on';
|
|
7533
|
+
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7534
|
+
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7834
7535
|
|
|
7835
7536
|
const imageRadiusStyle = imageBorderRadius
|
|
7836
7537
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
7837
7538
|
: {};
|
|
7838
|
-
const imageStyle: React.CSSProperties =
|
|
7839
|
-
? {
|
|
7840
|
-
objectFit: isFitSlider && !isCover ? 'contain' : 'cover',
|
|
7841
|
-
pointerEvents: 'auto',
|
|
7842
|
-
width: '100%',
|
|
7843
|
-
height: '100%',
|
|
7844
|
-
maxWidth: '100%',
|
|
7845
|
-
...imageRadiusStyle,
|
|
7846
|
-
}
|
|
7847
|
-
: isCover
|
|
7539
|
+
const imageStyle: React.CSSProperties = isCover
|
|
7848
7540
|
? {
|
|
7849
7541
|
objectFit: 'cover',
|
|
7850
7542
|
pointerEvents: 'auto',
|
|
@@ -7859,94 +7551,31 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7859
7551
|
width: 'auto',
|
|
7860
7552
|
height: 'auto',
|
|
7861
7553
|
maxWidth: '100%',
|
|
7862
|
-
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7863
7554
|
...imageRadiusStyle,
|
|
7864
7555
|
};
|
|
7865
7556
|
|
|
7866
|
-
const
|
|
7867
|
-
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7868
|
-
useLayoutEffect(() => {
|
|
7869
|
-
if (!shouldMeasureEntries) {
|
|
7870
|
-
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7871
|
-
return;
|
|
7872
|
-
}
|
|
7873
|
-
const wrapper = containerRef.current;
|
|
7874
|
-
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7875
|
-
const measure = () => {
|
|
7876
|
-
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7877
|
-
if (unit <= 0) return;
|
|
7878
|
-
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7879
|
-
setCustomEntryHeights(prev => (
|
|
7880
|
-
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7881
|
-
? prev
|
|
7882
|
-
: heights
|
|
7883
|
-
));
|
|
7884
|
-
};
|
|
7885
|
-
measure();
|
|
7886
|
-
const ro = new ResizeObserver(measure);
|
|
7887
|
-
if (wrapper) ro.observe(wrapper);
|
|
7888
|
-
inners.forEach(inner => inner && ro.observe(inner));
|
|
7889
|
-
return () => ro.disconnect();
|
|
7890
|
-
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7891
|
-
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7892
|
-
? customEntryHeights
|
|
7893
|
-
: undefined;
|
|
7894
|
-
const customRows = useMemo(() => {
|
|
7895
|
-
if (!customLayout) return undefined;
|
|
7896
|
-
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7897
|
-
return {
|
|
7898
|
-
gridRows: rows.gridRows,
|
|
7899
|
-
gridTemplateRows: rows.tracks.length
|
|
7900
|
-
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7901
|
-
: 'auto',
|
|
7902
|
-
};
|
|
7903
|
-
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7904
|
-
const customSlots = useMemo(
|
|
7905
|
-
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7906
|
-
[customLayout, cropContent.length],
|
|
7907
|
-
);
|
|
7908
|
-
// the aspect a single media keeps when the cell takes its height
|
|
7909
|
-
const entryMediaAspects = useMemo(
|
|
7910
|
-
() => entriesMedia.map(({ displayItems }) => (
|
|
7911
|
-
isAutoHeight && displayItems.length > 0 ? getGridMediaAspect(displayItems[0].displayMedia) : undefined
|
|
7912
|
-
)),
|
|
7913
|
-
[entriesMedia, isAutoHeight],
|
|
7914
|
-
);
|
|
7915
|
-
const customPlacement = useMemo(() => {
|
|
7916
|
-
if (!customLayout || !customSlots || !isPlacedLayout) return undefined;
|
|
7917
|
-
const beat = customLayout.beat ?? 0;
|
|
7918
|
-
const heights = customSlots.map((slot, index) => {
|
|
7919
|
-
// until the entries are measured, a media that tells its size gives the height it will take
|
|
7920
|
-
const aspects = entriesMedia[index].displayItems.map(({ displayMedia }) => getGridMediaAspect(displayMedia));
|
|
7921
|
-
const known = aspects.filter((aspect): aspect is number => aspect !== undefined);
|
|
7922
|
-
const estimate = isAutoHeight && known.length > 0 ? Math.max(...known.map(aspect => slot.width / aspect)) : slot.height;
|
|
7923
|
-
const height = measuredEntryHeights?.[index] ?? estimate;
|
|
7924
|
-
return beat > 0 ? Math.ceil(height / beat - 1e-3) * beat : height;
|
|
7925
|
-
});
|
|
7926
|
-
return placeCustomGridEntries(customLayout, customSlots, heights);
|
|
7927
|
-
}, [customLayout, customSlots, isPlacedLayout, isAutoHeight, entriesMedia, measuredEntryHeights]);
|
|
7928
|
-
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7929
|
-
? {
|
|
7930
|
-
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7931
|
-
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7932
|
-
rowGap: 0,
|
|
7933
|
-
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7934
|
-
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7935
|
-
...(customPlacement ? { position: 'relative', height: scalingValue(customPlacement.bottom, isEditor) } : {}),
|
|
7936
|
-
}
|
|
7937
|
-
: {
|
|
7938
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7939
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7940
|
-
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7941
|
-
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7942
|
-
...(shouldAlignEntries
|
|
7943
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7944
|
-
: {}),
|
|
7945
|
-
};
|
|
7946
|
-
|
|
7557
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
7947
7558
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7948
7559
|
|
|
7949
|
-
const
|
|
7560
|
+
const resolvedSplideDirection = transition === 'fade'
|
|
7561
|
+
? 'ltr'
|
|
7562
|
+
: direction === 'horizontal'
|
|
7563
|
+
? 'ltr'
|
|
7564
|
+
: direction === 'vertical'
|
|
7565
|
+
? 'ttb'
|
|
7566
|
+
: 'ltr';
|
|
7567
|
+
|
|
7568
|
+
useEffect(() => {
|
|
7569
|
+
const el = containerRef.current;
|
|
7570
|
+
if (!el) return;
|
|
7571
|
+
const ro = new ResizeObserver((entries) => {
|
|
7572
|
+
setContainerWidth(Math.round(entries[0].contentRect.width));
|
|
7573
|
+
});
|
|
7574
|
+
ro.observe(el);
|
|
7575
|
+
return () => ro.disconnect();
|
|
7576
|
+
}, []);
|
|
7577
|
+
|
|
7578
|
+
const lightboxPortalStyle = (() => {
|
|
7950
7579
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7951
7580
|
const articleWidth = containerRef.current
|
|
7952
7581
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7955,7 +7584,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7955
7584
|
style['--cntrl-article-width'] = articleWidth;
|
|
7956
7585
|
}
|
|
7957
7586
|
return style as React.CSSProperties;
|
|
7958
|
-
};
|
|
7587
|
+
})();
|
|
7959
7588
|
|
|
7960
7589
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7961
7590
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7994,8 +7623,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7994
7623
|
<div style={colorVars}>
|
|
7995
7624
|
<div
|
|
7996
7625
|
ref={containerRef}
|
|
7997
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}
|
|
7998
|
-
style={
|
|
7626
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7627
|
+
style={{
|
|
7628
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7629
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7630
|
+
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7631
|
+
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7632
|
+
...(shouldAlignEntries
|
|
7633
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7634
|
+
: {}),
|
|
7635
|
+
}}>
|
|
7999
7636
|
{cropContent.map((item: any, index: number) => {
|
|
8000
7637
|
const hasTitle = hasText(item.title);
|
|
8001
7638
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -8005,40 +7642,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8005
7642
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
8006
7643
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
8007
7644
|
: undefined;
|
|
8008
|
-
const customSlot = customSlots?.[index];
|
|
8009
|
-
const itemSize = customSlot?.width ?? size;
|
|
8010
|
-
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
8011
|
-
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
8012
|
-
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
8013
|
-
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
8014
|
-
const mediaAspect = slider === 'off' ? entryMediaAspects[index] : undefined;
|
|
8015
|
-
const imageWrapperStyle = getImageWrapperStyle(
|
|
8016
|
-
itemWidthScaled,
|
|
8017
|
-
customSlot,
|
|
8018
|
-
{ aspect: mediaAspect, isEmpty: displayItems.length === 0 },
|
|
8019
|
-
);
|
|
8020
|
-
const entryImageStyle = isAutoHeight && slider === 'off' && !mediaAspect
|
|
8021
|
-
? { ...imageStyle, height: 'auto' }
|
|
8022
|
-
: imageStyle;
|
|
8023
|
-
const itemStyle: React.CSSProperties | undefined = customSlot && customLayout && customPlacement
|
|
8024
|
-
? {
|
|
8025
|
-
position: 'absolute',
|
|
8026
|
-
left: scalingValue(customSlot.column * (customLayout.columnWidth + customLayout.gutterWidth), isEditor),
|
|
8027
|
-
top: scalingValue(customPlacement.tops[index], isEditor),
|
|
8028
|
-
width: itemWidthScaled,
|
|
8029
|
-
}
|
|
8030
|
-
: customSlot
|
|
8031
|
-
? {
|
|
8032
|
-
gridColumn: customSlot.gridColumn,
|
|
8033
|
-
gridRow: customRows?.gridRows[index],
|
|
8034
|
-
alignSelf: 'start',
|
|
8035
|
-
}
|
|
8036
|
-
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
8037
7645
|
|
|
8038
7646
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
8039
7647
|
<div className={\`\${P}-item-text-block\`}>
|
|
8040
7648
|
{hasTitle && (
|
|
8041
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7649
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
8042
7650
|
{item.title}
|
|
8043
7651
|
</p>
|
|
8044
7652
|
)}
|
|
@@ -8053,7 +7661,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8053
7661
|
/>
|
|
8054
7662
|
)}
|
|
8055
7663
|
{hasSubtitle && (
|
|
8056
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7664
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
8057
7665
|
{item.subtitle}
|
|
8058
7666
|
</p>
|
|
8059
7667
|
)}
|
|
@@ -8083,7 +7691,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8083
7691
|
/>
|
|
8084
7692
|
)}
|
|
8085
7693
|
{hasTitle && (
|
|
8086
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7694
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}>
|
|
8087
7695
|
{item.title}
|
|
8088
7696
|
</p>
|
|
8089
7697
|
)}
|
|
@@ -8113,7 +7721,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8113
7721
|
/>
|
|
8114
7722
|
)}
|
|
8115
7723
|
{hasSubtitle && (
|
|
8116
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
7724
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}>
|
|
8117
7725
|
{item.subtitle}
|
|
8118
7726
|
</p>
|
|
8119
7727
|
)}
|
|
@@ -8137,6 +7745,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8137
7745
|
</LinkWrapper>
|
|
8138
7746
|
);
|
|
8139
7747
|
|
|
7748
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7749
|
+
const lightboxItemsForEntry = displayItems
|
|
7750
|
+
.filter(entry => entry.lightboxMedia)
|
|
7751
|
+
.map(entry => entry.lightboxMedia!);
|
|
7752
|
+
|
|
8140
7753
|
const imageContent = (
|
|
8141
7754
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
8142
7755
|
{displayItems.length === 0
|
|
@@ -8144,13 +7757,15 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8144
7757
|
: slider === 'off'
|
|
8145
7758
|
?
|
|
8146
7759
|
(() => {
|
|
8147
|
-
const { displayMedia } = displayItems[0];
|
|
8148
|
-
const lightboxIndex =
|
|
7760
|
+
const { displayMedia, lightboxMedia } = displayItems[0];
|
|
7761
|
+
const lightboxIndex = lightboxMedia
|
|
7762
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7763
|
+
: -1;
|
|
8149
7764
|
return (
|
|
8150
7765
|
<GridMediaItem
|
|
8151
7766
|
media={displayMedia}
|
|
8152
7767
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8153
|
-
style={
|
|
7768
|
+
style={imageStyle}
|
|
8154
7769
|
hasLightbox={lightbox === 'on'}
|
|
8155
7770
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8156
7771
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -8173,28 +7788,50 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8173
7788
|
))}
|
|
8174
7789
|
</div>
|
|
8175
7790
|
)}
|
|
8176
|
-
<
|
|
8177
|
-
key={\`\${transition}-\${
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
7791
|
+
<Splide
|
|
7792
|
+
key={\`\${transition}-\${size}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7793
|
+
className={\`\${P}-item-slider\`}
|
|
7794
|
+
options={{
|
|
7795
|
+
arrows: false,
|
|
7796
|
+
pagination: false,
|
|
7797
|
+
drag: false,
|
|
7798
|
+
perPage: 1,
|
|
7799
|
+
autoplay: true,
|
|
7800
|
+
interval: sliderTiming * 1000,
|
|
7801
|
+
width: '100%',
|
|
7802
|
+
height: '100%',
|
|
7803
|
+
speed: SLIDER_TRANSITION_MS,
|
|
7804
|
+
type: transition === 'fade' ? 'fade' : 'loop',
|
|
7805
|
+
rewind: transition === 'fade',
|
|
7806
|
+
pauseOnHover: false,
|
|
7807
|
+
pauseOnFocus: false,
|
|
7808
|
+
direction: resolvedSplideDirection,
|
|
7809
|
+
}}
|
|
7810
|
+
onMoved={(splide) => {
|
|
7811
|
+
if (direction !== 'random' || transition === 'fade') return;
|
|
7812
|
+
handleRandomSlideMoved(splide);
|
|
7813
|
+
}}
|
|
7814
|
+
>
|
|
7815
|
+
{displayItems.map(({ displayMedia, lightboxMedia }, imgIndex) => {
|
|
7816
|
+
const lightboxIndex = lightboxMedia
|
|
7817
|
+
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7818
|
+
: -1;
|
|
8184
7819
|
return (
|
|
8185
|
-
<
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
7820
|
+
<SplideSlide key={imgIndex} data-slide-index={imgIndex}>
|
|
7821
|
+
<GridMediaItem
|
|
7822
|
+
media={displayMedia}
|
|
7823
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7824
|
+
style={imageStyle}
|
|
7825
|
+
hasLightbox={lightbox === 'on'}
|
|
7826
|
+
isSplideSlide
|
|
7827
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7828
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
7829
|
+
: undefined}
|
|
7830
|
+
/>
|
|
7831
|
+
</SplideSlide>
|
|
8195
7832
|
);
|
|
8196
7833
|
})}
|
|
8197
|
-
|
|
7834
|
+
</Splide>
|
|
8198
7835
|
</>
|
|
8199
7836
|
}
|
|
8200
7837
|
</GridItemMediaWrapper>
|
|
@@ -8212,7 +7849,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8212
7849
|
/>
|
|
8213
7850
|
<p
|
|
8214
7851
|
className={titleTextClassName}
|
|
8215
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7852
|
+
style={{ width: textBoxWidthStyle, ...titleFieldCss, ...titleTextLeadingVars }}
|
|
8216
7853
|
>
|
|
8217
7854
|
{item.title}
|
|
8218
7855
|
</p>
|
|
@@ -8226,7 +7863,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8226
7863
|
/>
|
|
8227
7864
|
<p
|
|
8228
7865
|
className={subtitleTextClassName}
|
|
8229
|
-
style={{ width: textBoxWidthStyle, ...
|
|
7866
|
+
style={{ width: textBoxWidthStyle, ...subtitleFieldCss, ...subtitleTextLeadingVars }}
|
|
8230
7867
|
>
|
|
8231
7868
|
{item.subtitle}
|
|
8232
7869
|
</p>
|
|
@@ -8246,18 +7883,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8246
7883
|
<div
|
|
8247
7884
|
key={index}
|
|
8248
7885
|
className={\`\${P}-item\`.trim()}
|
|
8249
|
-
style={
|
|
7886
|
+
style={gridColumn && !shouldAlignEntries ? { gridColumn } : undefined}
|
|
8250
7887
|
>
|
|
8251
7888
|
<div
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
? \`\${P}-item-inner\`
|
|
7889
|
+
className={\`\${isEditMode
|
|
7890
|
+
? \`\${P}-item-inner\`
|
|
8255
7891
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
8256
7892
|
style={{
|
|
8257
7893
|
width: (textBoxWidth ?? 0) > 100
|
|
8258
|
-
? \`calc(\${
|
|
8259
|
-
:
|
|
8260
|
-
...(customSlot && !isTextOutside && !isAutoHeight ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7894
|
+
? \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
7895
|
+
: entryWidthScaled,
|
|
8261
7896
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
8262
7897
|
}}
|
|
8263
7898
|
>
|
|
@@ -8303,7 +7938,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
8303
7938
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
8304
7939
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
8305
7940
|
return createPortal(
|
|
8306
|
-
<div style={
|
|
7941
|
+
<div style={lightboxPortalStyle} data-selection="none">
|
|
8307
7942
|
<Lightbox
|
|
8308
7943
|
prefix={P}
|
|
8309
7944
|
items={lightboxItems}
|
|
@@ -8340,38 +7975,17 @@ type GridLayoutConfig = {
|
|
|
8340
7975
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
8341
7976
|
};
|
|
8342
7977
|
|
|
8343
|
-
type CustomGridBlock = {
|
|
8344
|
-
column: number;
|
|
8345
|
-
span: number;
|
|
8346
|
-
top: number;
|
|
8347
|
-
height: number;
|
|
8348
|
-
};
|
|
8349
|
-
|
|
8350
|
-
type CustomGridLayout = {
|
|
8351
|
-
columnsCount: number;
|
|
8352
|
-
columnWidth: number;
|
|
8353
|
-
gutterWidth: number;
|
|
8354
|
-
maxWidth: number | null;
|
|
8355
|
-
verticalGap?: number;
|
|
8356
|
-
beat?: number;
|
|
8357
|
-
repeatHeight?: number;
|
|
8358
|
-
blocks: CustomGridBlock[];
|
|
8359
|
-
cellHeight?: 'manual' | 'auto';
|
|
8360
|
-
masonry?: 'off' | 'on';
|
|
8361
|
-
};
|
|
8362
|
-
|
|
8363
7978
|
type GridSettings = {
|
|
8364
7979
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
8365
|
-
gridLayout
|
|
8366
|
-
customGrid?: CustomGridLayout;
|
|
7980
|
+
gridLayout: GridLayoutConfig;
|
|
8367
7981
|
textBoxWidth: number;
|
|
8368
|
-
verticalGap
|
|
8369
|
-
entriesCount
|
|
7982
|
+
verticalGap: number;
|
|
7983
|
+
entriesCount: number;
|
|
8370
7984
|
lightbox: 'on' | 'off';
|
|
8371
|
-
imageDisplay:
|
|
7985
|
+
imageDisplay: {
|
|
8372
7986
|
display: 'fit' | 'cover';
|
|
8373
|
-
ratioValue
|
|
8374
|
-
reversed
|
|
7987
|
+
ratioValue: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
7988
|
+
reversed: boolean;
|
|
8375
7989
|
};
|
|
8376
7990
|
imageCorners?: number;
|
|
8377
7991
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -8381,9 +7995,8 @@ type GridSettings = {
|
|
|
8381
7995
|
transition: 'fade' | 'slide',
|
|
8382
7996
|
showText: 'always' | 'on hover';
|
|
8383
7997
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
8384
|
-
alignEntries
|
|
7998
|
+
alignEntries: 'on' | 'off';
|
|
8385
7999
|
align?: 'top' | 'center' | 'bottom';
|
|
8386
|
-
textGrowth?: 'inside' | 'outside';
|
|
8387
8000
|
titleMarginTop: number;
|
|
8388
8001
|
subtitleMarginTop: number;
|
|
8389
8002
|
titleColor: string;
|
|
@@ -8430,7 +8043,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8430
8043
|
};
|
|
8431
8044
|
|
|
8432
8045
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8433
|
-
`,
|
|
8046
|
+
`, T = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8434
8047
|
import { CommonComponentProps } from '../props';
|
|
8435
8048
|
import { scalingValue } from '../utils/scalingValue';
|
|
8436
8049
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -9003,7 +8616,7 @@ export function Helix({
|
|
|
9003
8616
|
</>
|
|
9004
8617
|
);
|
|
9005
8618
|
}
|
|
9006
|
-
`,
|
|
8619
|
+
`, R = `import { CommonComponentProps } from '../props';
|
|
9007
8620
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
9008
8621
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
9009
8622
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11455,7 +11068,7 @@ export function Hive({
|
|
|
11455
11068
|
</>
|
|
11456
11069
|
);
|
|
11457
11070
|
}
|
|
11458
|
-
`,
|
|
11071
|
+
`, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11459
11072
|
import { createPortal } from 'react-dom';
|
|
11460
11073
|
import { CommonComponentProps } from '../props';
|
|
11461
11074
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12258,7 +11871,7 @@ export type LightboxJournalSettings = {
|
|
|
12258
11871
|
closeIconColor: string;
|
|
12259
11872
|
closeIconHoverColor: string;
|
|
12260
11873
|
};
|
|
12261
|
-
`,
|
|
11874
|
+
`, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
12262
11875
|
import { createPortal } from 'react-dom';
|
|
12263
11876
|
import { CommonComponentProps } from '../props';
|
|
12264
11877
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12842,7 +12455,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12842
12455
|
</>
|
|
12843
12456
|
);
|
|
12844
12457
|
};
|
|
12845
|
-
`,
|
|
12458
|
+
`, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12846
12459
|
import { createPortal } from 'react-dom';
|
|
12847
12460
|
import { CommonComponentProps } from '../props';
|
|
12848
12461
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15947,7 +15560,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15947
15560
|
</>
|
|
15948
15561
|
);
|
|
15949
15562
|
}
|
|
15950
|
-
`,
|
|
15563
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15951
15564
|
import cn from 'classnames';
|
|
15952
15565
|
import { CommonComponentProps } from '../props';
|
|
15953
15566
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16805,7 +16418,7 @@ type MarqueeProps = {
|
|
|
16805
16418
|
isPreviewMode?: boolean;
|
|
16806
16419
|
isEditMode?: boolean;
|
|
16807
16420
|
} & CommonComponentProps;
|
|
16808
|
-
`,
|
|
16421
|
+
`, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16809
16422
|
import cn from 'classnames';
|
|
16810
16423
|
import { CommonComponentProps } from '../props';
|
|
16811
16424
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17748,7 +17361,7 @@ type MarqueeTextProps = {
|
|
|
17748
17361
|
isPreviewMode?: boolean;
|
|
17749
17362
|
isEditMode?: boolean;
|
|
17750
17363
|
} & CommonComponentProps;
|
|
17751
|
-
`,
|
|
17364
|
+
`, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17752
17365
|
import { createPortal } from 'react-dom';
|
|
17753
17366
|
import type React from 'react';
|
|
17754
17367
|
import { CommonComponentProps } from '../props';
|
|
@@ -20230,7 +19843,7 @@ export function Mercury({
|
|
|
20230
19843
|
</>
|
|
20231
19844
|
);
|
|
20232
19845
|
}
|
|
20233
|
-
`,
|
|
19846
|
+
`, O = `import React, { useMemo, useState } from 'react';
|
|
20234
19847
|
import { CommonComponentProps } from '../props';
|
|
20235
19848
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
20236
19849
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20809,7 +20422,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20809
20422
|
};
|
|
20810
20423
|
|
|
20811
20424
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20812
|
-
`,
|
|
20425
|
+
`, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20813
20426
|
import type React from 'react';
|
|
20814
20427
|
import { CommonComponentProps } from '../props';
|
|
20815
20428
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21648,7 +21261,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21648
21261
|
</>
|
|
21649
21262
|
);
|
|
21650
21263
|
}
|
|
21651
|
-
`,
|
|
21264
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21652
21265
|
import cn from 'classnames';
|
|
21653
21266
|
import { CommonComponentProps } from '../props';
|
|
21654
21267
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -22276,7 +21889,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
22276
21889
|
</>
|
|
22277
21890
|
);
|
|
22278
21891
|
}
|
|
22279
|
-
`,
|
|
21892
|
+
`, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
22280
21893
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
22281
21894
|
import { CommonComponentProps } from '../props';
|
|
22282
21895
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22365,6 +21978,8 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
22365
21978
|
|
|
22366
21979
|
const STATE_KEYS = ['hover', 'active'] as const;
|
|
22367
21980
|
|
|
21981
|
+
const isGradient = (value?: string) => !!value && value.includes('gradient(');
|
|
21982
|
+
|
|
22368
21983
|
const ALIGNMENT_MAP = {
|
|
22369
21984
|
left: 'flex-start',
|
|
22370
21985
|
center: 'center',
|
|
@@ -22417,7 +22032,7 @@ function getCSS(P: string): string {
|
|
|
22417
22032
|
box-sizing: border-box;
|
|
22418
22033
|
border-style: solid;
|
|
22419
22034
|
border-color: var(--\${P}-border-color);
|
|
22420
|
-
background
|
|
22035
|
+
background: var(--\${P}-background-color);
|
|
22421
22036
|
color: var(--\${P}-text-color);
|
|
22422
22037
|
-webkit-backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
22423
22038
|
backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
@@ -22461,7 +22076,7 @@ function getCSS(P: string): string {
|
|
|
22461
22076
|
content: '';
|
|
22462
22077
|
position: absolute;
|
|
22463
22078
|
inset: 0;
|
|
22464
|
-
background
|
|
22079
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22465
22080
|
pointer-events: none;
|
|
22466
22081
|
z-index: 0;
|
|
22467
22082
|
transform: scaleY(0);
|
|
@@ -22488,7 +22103,7 @@ a:focus-visible .\${P}-hover-effect-reveal.\${P}-reveal-from-bottom::before,
|
|
|
22488
22103
|
content: '';
|
|
22489
22104
|
position: absolute;
|
|
22490
22105
|
inset: 0;
|
|
22491
|
-
background
|
|
22106
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22492
22107
|
pointer-events: none;
|
|
22493
22108
|
z-index: 0;
|
|
22494
22109
|
transform: translateX(-100%);
|
|
@@ -22504,7 +22119,7 @@ a:focus-visible .\${P}-hover-effect-swipe::before,
|
|
|
22504
22119
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-reveal,
|
|
22505
22120
|
\${effectFocus('swipe')},
|
|
22506
22121
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-swipe {
|
|
22507
|
-
background
|
|
22122
|
+
background: var(--\${P}-background-color);
|
|
22508
22123
|
}
|
|
22509
22124
|
.\${P}-hover-effect-content-roll {
|
|
22510
22125
|
position: relative;
|
|
@@ -22566,15 +22181,17 @@ a:focus-visible .\${P}-hover-effect-content-roll .\${P}-content-roll-layer-hover
|
|
|
22566
22181
|
opacity: 1;
|
|
22567
22182
|
}
|
|
22568
22183
|
\${buttonHoverOrFocus} {
|
|
22569
|
-
background
|
|
22184
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22570
22185
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22571
22186
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22187
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22572
22188
|
box-shadow: \${hoverBoxShadow};
|
|
22573
22189
|
}
|
|
22574
22190
|
.\${P}-wrapper.\${P}-state-hover .\${P}-button {
|
|
22575
|
-
background
|
|
22191
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22576
22192
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22577
22193
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22194
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22578
22195
|
box-shadow: \${hoverBoxShadow};
|
|
22579
22196
|
}
|
|
22580
22197
|
.\${P}-button:focus,
|
|
@@ -22585,17 +22202,61 @@ a:focus-visible:has(.\${P}-button) {
|
|
|
22585
22202
|
}
|
|
22586
22203
|
.\${P}-button:active,
|
|
22587
22204
|
a:active .\${P}-button {
|
|
22588
|
-
background
|
|
22205
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22589
22206
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22590
22207
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22208
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22591
22209
|
box-shadow: \${activeBoxShadow};
|
|
22592
22210
|
}
|
|
22593
22211
|
.\${P}-wrapper.\${P}-state-active .\${P}-button {
|
|
22594
|
-
background
|
|
22212
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22595
22213
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22596
22214
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22215
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22597
22216
|
box-shadow: \${activeBoxShadow};
|
|
22598
22217
|
}
|
|
22218
|
+
/* Gradient border: CSS borders can't take gradients with radius, so the transparent border is covered by a masked ring. */
|
|
22219
|
+
.\${P}-border-gradient {
|
|
22220
|
+
position: relative;
|
|
22221
|
+
}
|
|
22222
|
+
.\${P}-border-gradient::after {
|
|
22223
|
+
content: '';
|
|
22224
|
+
position: absolute;
|
|
22225
|
+
inset: calc(var(--\${P}-stroke) * -1);
|
|
22226
|
+
padding: var(--\${P}-stroke);
|
|
22227
|
+
border-radius: inherit;
|
|
22228
|
+
background: var(--\${P}-border-fill, var(--\${P}-border-color));
|
|
22229
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
22230
|
+
-webkit-mask-composite: xor;
|
|
22231
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
22232
|
+
pointer-events: none;
|
|
22233
|
+
z-index: 2;
|
|
22234
|
+
}
|
|
22235
|
+
/* overflow would clip the ring, so these effects clip their moving parts instead */
|
|
22236
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal,
|
|
22237
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe,
|
|
22238
|
+
.\${P}-border-gradient.\${P}-hover-effect-content-roll {
|
|
22239
|
+
overflow: visible;
|
|
22240
|
+
}
|
|
22241
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal::before,
|
|
22242
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22243
|
+
border-radius: max(0px, calc(var(--\${P}-radius) - var(--\${P}-stroke)));
|
|
22244
|
+
}
|
|
22245
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22246
|
+
transform: none;
|
|
22247
|
+
clip-path: inset(0 100% 0 0);
|
|
22248
|
+
transition: clip-path 250ms;
|
|
22249
|
+
}
|
|
22250
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:hover::before,
|
|
22251
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:focus-visible::before,
|
|
22252
|
+
a:focus-visible .\${P}-border-gradient.\${P}-hover-effect-swipe::before,
|
|
22253
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22254
|
+
clip-path: inset(0);
|
|
22255
|
+
}
|
|
22256
|
+
/* clip the roll at the padding edge, where the button itself would have clipped it */
|
|
22257
|
+
.\${P}-border-gradient .\${P}-content-roll-viewport {
|
|
22258
|
+
clip-path: var(--\${P}-roll-clip);
|
|
22259
|
+
}
|
|
22599
22260
|
.\${P}-text {
|
|
22600
22261
|
display: block;
|
|
22601
22262
|
flex: 1;
|
|
@@ -22774,6 +22435,12 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22774
22435
|
const useContentRoll = hoverEffect === 'content-roll';
|
|
22775
22436
|
const revealHoverActive = hoverEffect === 'reveal' && (!isEditor || isPreviewMode);
|
|
22776
22437
|
|
|
22438
|
+
const hasBorderGradient = stroke > 0 && [borderColor, ...Object.values(stateOverrides ?? {}).map((o) => o?.borderColor)].some(isGradient);
|
|
22439
|
+
const borderGradientClass = hasBorderGradient ? \`\${P}-border-gradient\` : '';
|
|
22440
|
+
const strokeValue = scalingValue(stroke, isEditor);
|
|
22441
|
+
// Browsers draw a border at whole pixels, so the ring uses the same rounded width to line up with it on every side
|
|
22442
|
+
const ringStrokeValue = \`max(1px, round(down, \${strokeValue}, 1px))\`;
|
|
22443
|
+
|
|
22777
22444
|
const isFixedDimensions = dimensions === true;
|
|
22778
22445
|
const resolvedAlignment = type === 'a' ? (alignA ?? alignment) : alignment;
|
|
22779
22446
|
const effectiveAlignment = resolvedAlignment;
|
|
@@ -22815,7 +22482,18 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22815
22482
|
paddingBottom: scalingValue(padding.bottom, isEditor),
|
|
22816
22483
|
paddingLeft: scalingValue(padding.left, isEditor),
|
|
22817
22484
|
borderRadius: scalingValue(cornerRadius, isEditor),
|
|
22818
|
-
borderWidth:
|
|
22485
|
+
borderWidth: hasBorderGradient ? ringStrokeValue : strokeValue,
|
|
22486
|
+
// Like a CSS border: the background stops at it, and the ring paints over it
|
|
22487
|
+
...(hasBorderGradient ? {
|
|
22488
|
+
[\`--\${P}-stroke\`]: ringStrokeValue,
|
|
22489
|
+
[\`--\${P}-radius\`]: scalingValue(cornerRadius, isEditor),
|
|
22490
|
+
[\`--\${P}-roll-clip\`]: \`inset(\${[padding.top, padding.right, padding.bottom, padding.left].map((value) => \`calc(\${scalingValue(value, isEditor)} * -1)\`).join(' ')})\`,
|
|
22491
|
+
borderColor: 'transparent',
|
|
22492
|
+
backgroundClip: 'padding-box',
|
|
22493
|
+
} : {
|
|
22494
|
+
// A gradient background spans the border box, so it doesn't repeat under a see-through border
|
|
22495
|
+
backgroundOrigin: 'border-box',
|
|
22496
|
+
}),
|
|
22819
22497
|
...(!isIconTextType ? {
|
|
22820
22498
|
justifyContent: ALIGNMENT_MAP[effectiveAlignment],
|
|
22821
22499
|
textAlign: effectiveAlignment,
|
|
@@ -22893,7 +22571,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22893
22571
|
<div className={\`\${P}-root\`} style={colorVars}>
|
|
22894
22572
|
<div className={\`\${P}-wrapper \${stateClass} \${editingClass}\`.trim()}>
|
|
22895
22573
|
<div
|
|
22896
|
-
className={\`\${P}-button \${hoverEffectClass}\`.trim()}
|
|
22574
|
+
className={\`\${P}-button \${hoverEffectClass} \${borderGradientClass}\`.trim()}
|
|
22897
22575
|
style={buttonStyle}
|
|
22898
22576
|
onMouseEnter={handleRevealMouseEnter}
|
|
22899
22577
|
onMouseLeave={handleRevealMouseLeave}
|
|
@@ -22908,7 +22586,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22908
22586
|
</>
|
|
22909
22587
|
);
|
|
22910
22588
|
}
|
|
22911
|
-
`,
|
|
22589
|
+
`, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22912
22590
|
import cn from 'classnames';
|
|
22913
22591
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22914
22592
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -24090,7 +23768,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
24090
23768
|
</svg>
|
|
24091
23769
|
);
|
|
24092
23770
|
}
|
|
24093
|
-
`,
|
|
23771
|
+
`, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24094
23772
|
import cn from 'classnames';
|
|
24095
23773
|
import { CommonComponentProps } from '../props';
|
|
24096
23774
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24721,7 +24399,7 @@ type TestimonialsSettings = {
|
|
|
24721
24399
|
logoHeight: number;
|
|
24722
24400
|
captionMarginTop: number;
|
|
24723
24401
|
};
|
|
24724
|
-
`,
|
|
24402
|
+
`, z = `import cn from 'classnames';
|
|
24725
24403
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24726
24404
|
import { CommonComponentProps } from '../props';
|
|
24727
24405
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -25217,7 +24895,7 @@ type TestimonialsSettings = {
|
|
|
25217
24895
|
icon?: string | null;
|
|
25218
24896
|
};
|
|
25219
24897
|
};
|
|
25220
|
-
`,
|
|
24898
|
+
`, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
25221
24899
|
import type React from 'react';
|
|
25222
24900
|
import { createPortal } from 'react-dom';
|
|
25223
24901
|
import { CommonComponentProps } from '../props';
|
|
@@ -25750,31 +25428,30 @@ export function Waterfall({
|
|
|
25750
25428
|
</>
|
|
25751
25429
|
);
|
|
25752
25430
|
}
|
|
25753
|
-
`,
|
|
25754
|
-
[
|
|
25755
|
-
[
|
|
25756
|
-
[
|
|
25757
|
-
[
|
|
25758
|
-
[
|
|
25759
|
-
[
|
|
25760
|
-
[
|
|
25761
|
-
[
|
|
25762
|
-
[
|
|
25763
|
-
[
|
|
25764
|
-
[
|
|
25765
|
-
[
|
|
25766
|
-
[
|
|
25767
|
-
[
|
|
25768
|
-
[
|
|
25769
|
-
[
|
|
25770
|
-
[
|
|
25771
|
-
[
|
|
25772
|
-
[
|
|
25773
|
-
[
|
|
25774
|
-
[
|
|
25775
|
-
[
|
|
25776
|
-
[e.id]: G
|
|
25431
|
+
`, U = {
|
|
25432
|
+
[y.id]: S,
|
|
25433
|
+
[b.id]: w,
|
|
25434
|
+
[x.id]: C,
|
|
25435
|
+
[P.id]: $,
|
|
25436
|
+
[v.id]: I,
|
|
25437
|
+
[f.id]: E,
|
|
25438
|
+
[h.id]: T,
|
|
25439
|
+
[p.id]: R,
|
|
25440
|
+
[m.id]: M,
|
|
25441
|
+
[g.id]: L,
|
|
25442
|
+
[u.id]: k,
|
|
25443
|
+
[d.id]: A,
|
|
25444
|
+
[c.id]: N,
|
|
25445
|
+
[l.id]: H,
|
|
25446
|
+
[s.id]: O,
|
|
25447
|
+
[a.id]: _,
|
|
25448
|
+
[r.id]: F,
|
|
25449
|
+
[o.id]: W,
|
|
25450
|
+
[i.id]: D,
|
|
25451
|
+
[t.id]: B,
|
|
25452
|
+
[e.id]: z,
|
|
25453
|
+
[n.id]: V
|
|
25777
25454
|
};
|
|
25778
25455
|
export {
|
|
25779
|
-
|
|
25456
|
+
U as componentSources
|
|
25780
25457
|
};
|