@cntrl-site/components 1.0.118 → 1.0.120-alpha.0
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-kkKhL_qt.mjs → ChroniclesComponent-CeaJBqKz.mjs} +592 -513
- package/dist/ChroniclesComponent-DK6L2w5h.js +1 -0
- package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
- package/dist/Components/Grid/Grid.d.ts +31 -7
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +2 -0
- package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-BBAXRDLP.mjs} +2 -3
- package/dist/ControlSlider-BCkVFl4w.js +1 -0
- package/dist/Grid-By7t2l11.js +445 -0
- package/dist/Grid-If8uE2Sy.mjs +1865 -0
- package/dist/SimpleButton-BrIUFz_a.js +289 -0
- package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-GXckV2Tj.mjs} +198 -141
- package/dist/{components-CVetdKi7.js → components-Cp5lKUwh.js} +1 -1
- package/dist/{components-BLyOKMdK.mjs → components-DoYrYUvq.mjs} +14 -13
- package/dist/components.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +9 -8
- 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 +718 -246
- package/dist/sources.mjs +759 -286
- package/package.json +1 -1
- package/dist/ChroniclesComponent-DkG1aICD.js +0 -1
- package/dist/ControlSlider-C8ckUIDm.js +0 -1
- package/dist/Grid-C4hO8KCr.js +0 -408
- package/dist/Grid-Dud7PLS9.mjs +0 -1622
- 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 e, b as t, T as i, h as o, g as r, S as a, P as s, O as l, i as c, a as d, M as u, L as g, e as m, f as p, H as h, j as f, G as v, F as P, d as x, c as b, C as y, k as S, B as C } from "./ChroniclesComponent-CeaJBqKz.mjs";
|
|
2
|
+
const w = `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
|
+
`, $ = `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
|
+
`, I = `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
|
+
`, E = `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
|
+
`, T = `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,9 +5687,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5687
5687
|
};
|
|
5688
5688
|
|
|
5689
5689
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5690
|
-
`,
|
|
5691
|
-
import '@splidejs/react-splide/css/core';
|
|
5692
|
-
import { CommonComponentProps } from '../props';
|
|
5690
|
+
`, n = `import { CommonComponentProps } from '../props';
|
|
5693
5691
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
5694
5692
|
import {
|
|
5695
5693
|
buildColorVars,
|
|
@@ -5699,7 +5697,7 @@ import {
|
|
|
5699
5697
|
useLazyVideos,
|
|
5700
5698
|
useScopedStyles,
|
|
5701
5699
|
} from '../utils/index';
|
|
5702
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5700
|
+
import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
5703
5701
|
import { createPortal } from 'react-dom';
|
|
5704
5702
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
5705
5703
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
@@ -5816,15 +5814,23 @@ function getCSS(P: string): string {
|
|
|
5816
5814
|
width: 100%;
|
|
5817
5815
|
overflow: hidden;
|
|
5818
5816
|
}
|
|
5819
|
-
.\${P}-item-slider .splide__track {
|
|
5820
|
-
overflow: hidden;
|
|
5821
|
-
}
|
|
5822
5817
|
.\${P}-item-image-link {
|
|
5823
5818
|
width: 100%;
|
|
5824
5819
|
display: flex;
|
|
5825
5820
|
flex-direction: column;
|
|
5826
5821
|
align-items: center;
|
|
5827
5822
|
}
|
|
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
|
+
}
|
|
5828
5834
|
.\${P}-item-text-link {
|
|
5829
5835
|
display: flex;
|
|
5830
5836
|
flex-direction: column;
|
|
@@ -5845,18 +5851,47 @@ function getCSS(P: string): string {
|
|
|
5845
5851
|
display: block;
|
|
5846
5852
|
max-width: 100%;
|
|
5847
5853
|
}
|
|
5848
|
-
.\${P}-item-slider
|
|
5849
|
-
|
|
5850
|
-
.\${P}-item-slider .splide__list,
|
|
5851
|
-
.\${P}-item-slider .splide__slide {
|
|
5854
|
+
.\${P}-item-slider {
|
|
5855
|
+
position: relative;
|
|
5852
5856
|
width: 100%;
|
|
5853
5857
|
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;
|
|
5854
5870
|
}
|
|
5855
|
-
.\${P}-item-slider
|
|
5871
|
+
.\${P}-item-slider-list-fade {
|
|
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%;
|
|
5856
5880
|
display: flex;
|
|
5857
5881
|
justify-content: center;
|
|
5858
5882
|
align-items: center;
|
|
5859
5883
|
}
|
|
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
|
+
}
|
|
5860
5895
|
.\${P}-item-title {
|
|
5861
5896
|
white-space: normal;
|
|
5862
5897
|
overflow-wrap: anywhere;
|
|
@@ -6003,13 +6038,13 @@ function getCSS(P: string): string {
|
|
|
6003
6038
|
.\${P}-image-align-bottom .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6004
6039
|
align-items: flex-end;
|
|
6005
6040
|
}
|
|
6006
|
-
.\${P}-image-align-top .\${P}-item-slider
|
|
6041
|
+
.\${P}-image-align-top .\${P}-item-slider .\${P}-item-slide {
|
|
6007
6042
|
align-items: flex-start;
|
|
6008
6043
|
}
|
|
6009
|
-
.\${P}-image-align-center .\${P}-item-slider
|
|
6044
|
+
.\${P}-image-align-center .\${P}-item-slider .\${P}-item-slide {
|
|
6010
6045
|
align-items: center;
|
|
6011
6046
|
}
|
|
6012
|
-
.\${P}-image-align-bottom .\${P}-item-slider
|
|
6047
|
+
.\${P}-image-align-bottom .\${P}-item-slider .\${P}-item-slide {
|
|
6013
6048
|
align-items: flex-end;
|
|
6014
6049
|
}
|
|
6015
6050
|
.\${P}-align-entries .\${P}-item {
|
|
@@ -6090,13 +6125,13 @@ function getCSS(P: string): string {
|
|
|
6090
6125
|
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-image-wrapper:not(.\${P}-item-image-wrapper-fit-slider) {
|
|
6091
6126
|
align-items: flex-end;
|
|
6092
6127
|
}
|
|
6093
|
-
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider
|
|
6128
|
+
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6094
6129
|
align-items: flex-start;
|
|
6095
6130
|
}
|
|
6096
|
-
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider
|
|
6131
|
+
.\${P}-image-align-center.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6097
6132
|
align-items: center;
|
|
6098
6133
|
}
|
|
6099
|
-
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider
|
|
6134
|
+
.\${P}-image-align-bottom.\${P}-align-entries .\${P}-item-slider .\${P}-item-slide {
|
|
6100
6135
|
align-items: flex-end;
|
|
6101
6136
|
}
|
|
6102
6137
|
.\${P}-image-align-top.\${P}-align-entries .\${P}-item-image-link {
|
|
@@ -6164,27 +6199,9 @@ function pickRandomSlideDirection(): 'ltr' | 'ttb' {
|
|
|
6164
6199
|
return Math.random() < 0.5 ? 'ltr' : 'ttb';
|
|
6165
6200
|
}
|
|
6166
6201
|
|
|
6167
|
-
function
|
|
6168
|
-
|
|
6169
|
-
|
|
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
|
-
});
|
|
6202
|
+
function wrapSlideIndex(index: number, count: number): number {
|
|
6203
|
+
if (count <= 0) return 0;
|
|
6204
|
+
return ((index % count) + count) % count;
|
|
6188
6205
|
}
|
|
6189
6206
|
|
|
6190
6207
|
type GridProps = {
|
|
@@ -6224,6 +6241,8 @@ type LightboxProps = {
|
|
|
6224
6241
|
|
|
6225
6242
|
const LIGHTBOX_ANIM_MS = 500;
|
|
6226
6243
|
const SLIDER_TRANSITION_MS = 750;
|
|
6244
|
+
const SLIDER_EASING = 'cubic-bezier(0.25, 1, 0.5, 1)';
|
|
6245
|
+
const SLIDER_DEFAULT_INTERVAL_MS = 5000;
|
|
6227
6246
|
const LIGHTBOX_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
6228
6247
|
const SWIPE_CLOSE_THRESHOLD = 72;
|
|
6229
6248
|
const SWIPE_NAV_THRESHOLD = 50;
|
|
@@ -6313,7 +6332,7 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
|
|
|
6313
6332
|
return result;
|
|
6314
6333
|
}
|
|
6315
6334
|
|
|
6316
|
-
function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6335
|
+
const LightboxMediaPreloadPool = memo(function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
6317
6336
|
const [pool, setPool] = useState<HTMLDivElement | null>(null);
|
|
6318
6337
|
useLazyVideos(pool, { preload: 'metadata' });
|
|
6319
6338
|
// an embed's player is only ever framed where it shows
|
|
@@ -6352,7 +6371,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
|
|
|
6352
6371
|
))}
|
|
6353
6372
|
</div>
|
|
6354
6373
|
);
|
|
6355
|
-
}
|
|
6374
|
+
});
|
|
6356
6375
|
|
|
6357
6376
|
function unloadVideoElement(video: HTMLVideoElement) {
|
|
6358
6377
|
video.pause();
|
|
@@ -6360,15 +6379,121 @@ function unloadVideoElement(video: HTMLVideoElement) {
|
|
|
6360
6379
|
video.load();
|
|
6361
6380
|
}
|
|
6362
6381
|
|
|
6363
|
-
const
|
|
6382
|
+
const GRID_SLIDE_CLASS = 'cntrl-grid-slide';
|
|
6383
|
+
const GRID_SLIDE_PLAYING_CLASS = 'cntrl-grid-slide-playing';
|
|
6384
|
+
const GRID_SLIDE_VIDEOS = \`.\${GRID_SLIDE_CLASS} video\`;
|
|
6364
6385
|
|
|
6365
6386
|
function shouldPlaySlideVideo(video: HTMLVideoElement): boolean {
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6387
|
+
return video.closest(\`.\${GRID_SLIDE_PLAYING_CLASS}\`) !== null;
|
|
6388
|
+
}
|
|
6389
|
+
|
|
6390
|
+
type GridEntrySliderProps = {
|
|
6391
|
+
prefix: string;
|
|
6392
|
+
slides: React.ReactNode[];
|
|
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
|
+
);
|
|
6372
6497
|
}
|
|
6373
6498
|
|
|
6374
6499
|
function GridMediaItem({
|
|
@@ -6376,7 +6501,7 @@ function GridMediaItem({
|
|
|
6376
6501
|
className,
|
|
6377
6502
|
style,
|
|
6378
6503
|
hasLightbox,
|
|
6379
|
-
|
|
6504
|
+
isSliderSlide = false,
|
|
6380
6505
|
onMediaClick,
|
|
6381
6506
|
}: {
|
|
6382
6507
|
media: GridMedia;
|
|
@@ -6384,7 +6509,7 @@ function GridMediaItem({
|
|
|
6384
6509
|
style: React.CSSProperties;
|
|
6385
6510
|
/** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
|
|
6386
6511
|
hasLightbox: boolean;
|
|
6387
|
-
|
|
6512
|
+
isSliderSlide?: boolean;
|
|
6388
6513
|
onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
6389
6514
|
}) {
|
|
6390
6515
|
if (isEmbedMedia(media)) {
|
|
@@ -6416,7 +6541,7 @@ function GridMediaItem({
|
|
|
6416
6541
|
playsInline: true,
|
|
6417
6542
|
onClick: onMediaClick,
|
|
6418
6543
|
};
|
|
6419
|
-
return
|
|
6544
|
+
return isSliderSlide
|
|
6420
6545
|
? <video {...videoProps} preload='none' />
|
|
6421
6546
|
: <LazyVideo {...videoProps} autoPlay />;
|
|
6422
6547
|
}
|
|
@@ -6445,7 +6570,7 @@ function GridItemMediaWrapper({
|
|
|
6445
6570
|
children: React.ReactNode;
|
|
6446
6571
|
}) {
|
|
6447
6572
|
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
|
6448
|
-
useLazyVideos(wrapper, { autoPlay: true, selector:
|
|
6573
|
+
useLazyVideos(wrapper, { autoPlay: true, selector: GRID_SLIDE_VIDEOS, shouldPlay: shouldPlaySlideVideo });
|
|
6449
6574
|
|
|
6450
6575
|
return (
|
|
6451
6576
|
<div ref={setWrapper} className={className} style={style}>
|
|
@@ -7346,11 +7471,169 @@ function resolveLightboxImageDisplay(
|
|
|
7346
7471
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7347
7472
|
}
|
|
7348
7473
|
|
|
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
|
+
function placeCustomGridRows(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7576
|
+
const groupSize = layout.blocks.length;
|
|
7577
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7578
|
+
const rowTops = slots.slice(0, groupSize)
|
|
7579
|
+
.map(slot => slot.top)
|
|
7580
|
+
.sort((a, b) => a - b)
|
|
7581
|
+
.filter((top, index, sorted) => index === 0 || top - sorted[index - 1] > EDGE_TOLERANCE);
|
|
7582
|
+
const tops: number[] = [];
|
|
7583
|
+
let top = 0;
|
|
7584
|
+
let bottom = 0;
|
|
7585
|
+
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7586
|
+
for (const rowTop of rowTops) {
|
|
7587
|
+
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7588
|
+
.filter(entry => Math.abs(slots[entry].top - rowTop) <= EDGE_TOLERANCE);
|
|
7589
|
+
if (entries.length === 0) continue;
|
|
7590
|
+
entries.forEach((entry) => {
|
|
7591
|
+
tops[entry] = top;
|
|
7592
|
+
});
|
|
7593
|
+
bottom = Math.max(...entries.map(entry => top + heights[entry]));
|
|
7594
|
+
top = bottom + verticalGap;
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
return { tops, bottom };
|
|
7598
|
+
}
|
|
7599
|
+
|
|
7600
|
+
function placeCustomGridEntries(layout: CustomGridLayout, slots: CustomGridSlot[], heights: number[]) {
|
|
7601
|
+
if (layout.gridType === 'rows') return placeCustomGridRows(layout, slots, heights);
|
|
7602
|
+
const groupSize = layout.blocks.length;
|
|
7603
|
+
const verticalGap = getCustomGridVerticalGap(layout);
|
|
7604
|
+
const isMasonry = layout.masonry === 'on';
|
|
7605
|
+
const tops: number[] = [];
|
|
7606
|
+
const placed: { column: number; span: number; bottom: number; group: number }[] = [];
|
|
7607
|
+
const getBottom = (items: typeof placed) => items.reduce((bottom, item) => Math.max(bottom, item.bottom), 0);
|
|
7608
|
+
let groupStart = 0;
|
|
7609
|
+
for (let start = 0; start < slots.length; start += groupSize) {
|
|
7610
|
+
const group = start / groupSize;
|
|
7611
|
+
const entries = Array.from({ length: Math.min(groupSize, slots.length - start) }, (_, index) => start + index)
|
|
7612
|
+
.sort((a, b) => slots[a].top - slots[b].top || a - b);
|
|
7613
|
+
for (const entry of entries) {
|
|
7614
|
+
const slot = slots[entry];
|
|
7615
|
+
const sharesColumns = (other: { column: number; span: number }) => other.column < slot.column + slot.span
|
|
7616
|
+
&& slot.column < other.column + other.span;
|
|
7617
|
+
const above = entries.filter(other => other !== entry && tops[other] !== undefined && sharesColumns(slots[other])
|
|
7618
|
+
&& slots[other].top + slots[other].height <= slot.top + EDGE_TOLERANCE);
|
|
7619
|
+
const earlier = isMasonry ? placed.filter(item => item.group < group && sharesColumns(item)) : [];
|
|
7620
|
+
const candidates = above.map(other => tops[other] + heights[other] + slot.top - (slots[other].top + slots[other].height));
|
|
7621
|
+
if (earlier.length > 0) candidates.push(getBottom(earlier) + verticalGap);
|
|
7622
|
+
if (candidates.length === 0) candidates.push(groupStart + slot.top);
|
|
7623
|
+
tops[entry] = Math.max(...candidates);
|
|
7624
|
+
placed.push({ column: slot.column, span: slot.span, bottom: tops[entry] + heights[entry], group });
|
|
7625
|
+
}
|
|
7626
|
+
groupStart = getBottom(placed) + verticalGap;
|
|
7627
|
+
}
|
|
7628
|
+
return { tops, bottom: getBottom(placed) };
|
|
7629
|
+
}
|
|
7630
|
+
|
|
7349
7631
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7350
7632
|
const { prefix: P } = useScopedStyles();
|
|
7351
7633
|
const {
|
|
7352
7634
|
type = 'a',
|
|
7353
7635
|
gridLayout,
|
|
7636
|
+
customGrid,
|
|
7354
7637
|
textBoxWidth = 100,
|
|
7355
7638
|
verticalGap,
|
|
7356
7639
|
entriesCount,
|
|
@@ -7398,62 +7681,69 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7398
7681
|
hover = 'none',
|
|
7399
7682
|
alignEntries = 'off',
|
|
7400
7683
|
align = 'top',
|
|
7684
|
+
textGrowth = 'inside',
|
|
7401
7685
|
} = settings;
|
|
7402
7686
|
|
|
7403
|
-
const
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7687
|
+
const titleTextStyle = useMemo(() => ({
|
|
7688
|
+
...omitTextColors(textStylesToCss({
|
|
7689
|
+
fontSettings: {
|
|
7690
|
+
fontFamily: titleFontFamily,
|
|
7691
|
+
fontWeight: titleFontSettings?.fontWeight ?? 400,
|
|
7692
|
+
fontStyle: titleFontSettings?.fontStyle ?? 'normal',
|
|
7693
|
+
},
|
|
7694
|
+
fontSize: titleFontSize ?? 0.01,
|
|
7695
|
+
lineHeight: titleLineHeight,
|
|
7696
|
+
letterSpacing: titleLetterSpacing ?? 0,
|
|
7697
|
+
wordSpacing: titleWordSpacing ?? 0,
|
|
7698
|
+
textAppearance: titleTextAppearance,
|
|
7699
|
+
color: titleColor,
|
|
7700
|
+
}, isEditor)),
|
|
7701
|
+
...getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor),
|
|
7702
|
+
} as React.CSSProperties), [
|
|
7703
|
+
titleFontFamily, titleFontSettings, titleFontSize, titleLineHeight, titleLetterSpacing,
|
|
7704
|
+
titleWordSpacing, titleTextAppearance, titleColor, isEditor, P,
|
|
7705
|
+
]);
|
|
7420
7706
|
|
|
7421
|
-
const
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7707
|
+
const subtitleTextStyle = useMemo(() => ({
|
|
7708
|
+
...omitTextColors(textStylesToCss({
|
|
7709
|
+
fontSettings: {
|
|
7710
|
+
fontFamily: subtitleFontFamily,
|
|
7711
|
+
fontWeight: subtitleFontSettings?.fontWeight ?? 400,
|
|
7712
|
+
fontStyle: subtitleFontSettings?.fontStyle ?? 'normal',
|
|
7713
|
+
},
|
|
7714
|
+
fontSize: subtitleFontSize ?? 0.01,
|
|
7715
|
+
lineHeight: subtitleLineHeight,
|
|
7716
|
+
letterSpacing: subtitleLetterSpacing ?? 0,
|
|
7717
|
+
wordSpacing: subtitleWordSpacing ?? 0,
|
|
7718
|
+
textAppearance: subtitleTextAppearance,
|
|
7719
|
+
color: subtitleColor,
|
|
7720
|
+
}, isEditor)),
|
|
7721
|
+
...getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor),
|
|
7722
|
+
} as React.CSSProperties), [
|
|
7723
|
+
subtitleFontFamily, subtitleFontSettings, subtitleFontSize, subtitleLineHeight, subtitleLetterSpacing,
|
|
7724
|
+
subtitleWordSpacing, subtitleTextAppearance, subtitleColor, isEditor, P,
|
|
7725
|
+
]);
|
|
7438
7726
|
|
|
7439
|
-
const
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
const lightboxCounterFieldCss = {
|
|
7454
|
-
...lightboxCounterTypographyCss,
|
|
7727
|
+
const lightboxCounterFieldCss = useMemo(() => ({
|
|
7728
|
+
...omitTextColors(textStylesToCss({
|
|
7729
|
+
fontSettings: {
|
|
7730
|
+
fontFamily: lightboxCounterFontFamily,
|
|
7731
|
+
fontWeight: lightboxCounterFontSettings?.fontWeight ?? 400,
|
|
7732
|
+
fontStyle: lightboxCounterFontSettings?.fontStyle ?? 'normal',
|
|
7733
|
+
},
|
|
7734
|
+
fontSize: lightboxCounterFontSize ?? 0.01,
|
|
7735
|
+
lineHeight: lightboxCounterLineHeight,
|
|
7736
|
+
letterSpacing: lightboxCounterLetterSpacing ?? 0,
|
|
7737
|
+
wordSpacing: lightboxCounterWordSpacing ?? 0,
|
|
7738
|
+
textAppearance: lightboxCounterTextAppearance,
|
|
7739
|
+
color: lightboxCounterColor,
|
|
7740
|
+
}, isEditor)),
|
|
7455
7741
|
...getGridTextLeadingVars(lightboxCounterFontSize, lightboxCounterLineHeight, P, isEditor),
|
|
7456
|
-
} as React.CSSProperties
|
|
7742
|
+
} as React.CSSProperties), [
|
|
7743
|
+
lightboxCounterFontFamily, lightboxCounterFontSettings, lightboxCounterFontSize, lightboxCounterLineHeight,
|
|
7744
|
+
lightboxCounterLetterSpacing, lightboxCounterWordSpacing, lightboxCounterTextAppearance, lightboxCounterColor,
|
|
7745
|
+
isEditor, P,
|
|
7746
|
+
]);
|
|
7457
7747
|
|
|
7458
7748
|
const titleTextClassName = getGridTextClassName(
|
|
7459
7749
|
titleFontSize,
|
|
@@ -7467,8 +7757,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7467
7757
|
\`\${P}-item-subtitle\`,
|
|
7468
7758
|
\`\${P}-text-tight-leading\`,
|
|
7469
7759
|
);
|
|
7470
|
-
const titleTextLeadingVars = getGridTextLeadingVars(titleFontSize, titleLineHeight, P, isEditor);
|
|
7471
|
-
const subtitleTextLeadingVars = getGridTextLeadingVars(subtitleFontSize, subtitleLineHeight, P, isEditor);
|
|
7472
7760
|
const lightboxCounterClassName = getGridTextClassName(
|
|
7473
7761
|
lightboxCounterFontSize,
|
|
7474
7762
|
lightboxCounterLineHeight,
|
|
@@ -7476,42 +7764,58 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7476
7764
|
\`\${P}-text-tight-leading\`,
|
|
7477
7765
|
);
|
|
7478
7766
|
|
|
7479
|
-
const colorVars = buildColorVars(P, {
|
|
7767
|
+
const colorVars = useMemo(() => buildColorVars(P, {
|
|
7480
7768
|
titleColor,
|
|
7481
7769
|
subtitleColor,
|
|
7482
7770
|
lightboxCounterColor,
|
|
7483
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
7771
|
+
}, COLOR_VAR_MAP, STATE_KEYS), [P, titleColor, subtitleColor, lightboxCounterColor]);
|
|
7484
7772
|
|
|
7485
7773
|
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
7486
7774
|
const showTextOnHover = showText === 'on hover' && (!isEditor || isPreviewMode);
|
|
7487
7775
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7488
7776
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7489
7777
|
|
|
7490
|
-
const
|
|
7778
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7779
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7780
|
+
const isTextOutside = !!customLayout && (customLayout.textGrowth ?? textGrowth) === 'outside';
|
|
7781
|
+
const isAutoHeight = customLayout?.cellHeight === 'auto';
|
|
7782
|
+
const isPlacedLayout = isAutoHeight || customLayout?.masonry === 'on';
|
|
7783
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7784
|
+
const [customEntryHeights, setCustomEntryHeights] = useState<number[]>([]);
|
|
7491
7785
|
|
|
7492
|
-
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7786
|
+
const cropContent = useMemo<any[]>(() => (content ?? []).slice(0, resEntriesCount), [content, resEntriesCount]);
|
|
7493
7787
|
const lightboxMediaToPreload = useMemo(
|
|
7494
7788
|
() => (lightbox === 'on' ? collectGridLightboxMedia(cropContent) : []),
|
|
7495
7789
|
[cropContent, lightbox],
|
|
7496
7790
|
);
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7791
|
+
const entriesMedia = useMemo(() => cropContent.map((item: any) => {
|
|
7792
|
+
const displayItems = getGridDisplayItems(item.gallery);
|
|
7793
|
+
const lightboxItemsForEntry = displayItems
|
|
7794
|
+
.filter(entry => entry.lightboxMedia)
|
|
7795
|
+
.map(entry => entry.lightboxMedia!);
|
|
7796
|
+
const lightboxIndexes = displayItems.map(({ lightboxMedia }) => (lightboxMedia
|
|
7797
|
+
? lightboxItemsForEntry.findIndex(media => media.assetId === lightboxMedia.assetId)
|
|
7798
|
+
: -1));
|
|
7799
|
+
return { displayItems, lightboxItemsForEntry, lightboxIndexes };
|
|
7800
|
+
}), [cropContent]);
|
|
7801
|
+
|
|
7802
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7803
|
+
|
|
7804
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7805
|
+
const isCover = (customLayout?.mediaDisplay ?? imageDisplaySettings?.display) === 'cover';
|
|
7806
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7807
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7503
7808
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7504
7809
|
const effW = ratioReversed ? rH : rW;
|
|
7505
7810
|
const effH = ratioReversed ? rW : rH;
|
|
7506
7811
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7507
7812
|
|
|
7508
|
-
const columnsCount = gridLayout
|
|
7813
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7509
7814
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7510
|
-
const
|
|
7511
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7815
|
+
const isFitSlider = slider !== 'off' && (customLayout ? isAutoHeight : !isCover);
|
|
7512
7816
|
|
|
7513
7817
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7514
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7818
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7515
7819
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7516
7820
|
const lastRowStartColumn = isPartialLastRow
|
|
7517
7821
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7519,24 +7823,46 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7519
7823
|
|
|
7520
7824
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7521
7825
|
|
|
7522
|
-
const
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7826
|
+
const getImageWrapperStyle = (
|
|
7827
|
+
entryWidth: string,
|
|
7828
|
+
slot?: CustomGridSlot,
|
|
7829
|
+
media?: { aspect?: number; isEmpty: boolean },
|
|
7830
|
+
): React.CSSProperties => ({
|
|
7831
|
+
width: entryWidth,
|
|
7832
|
+
...(slot && isAutoHeight
|
|
7833
|
+
? {
|
|
7834
|
+
height: media?.isEmpty ? scalingValue(slot.height, isEditor) : 'auto',
|
|
7835
|
+
flexShrink: 0,
|
|
7836
|
+
overflow: 'hidden',
|
|
7837
|
+
...(media?.aspect && !isFitSlider ? { aspectRatio: \`\${media.aspect}\` } : {}),
|
|
7838
|
+
}
|
|
7839
|
+
: slot
|
|
7840
|
+
? isTextOutside
|
|
7841
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7842
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7843
|
+
: isCover
|
|
7844
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7845
|
+
: { height: 'auto' }),
|
|
7527
7846
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7528
|
-
};
|
|
7847
|
+
});
|
|
7529
7848
|
|
|
7530
7849
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7531
7850
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7532
|
-
const shouldAlignEntries = alignEntries === 'on';
|
|
7533
|
-
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7534
|
-
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7851
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7535
7852
|
|
|
7536
7853
|
const imageRadiusStyle = imageBorderRadius
|
|
7537
7854
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
7538
7855
|
: {};
|
|
7539
|
-
const imageStyle: React.CSSProperties =
|
|
7856
|
+
const imageStyle: React.CSSProperties = isAutoHeight
|
|
7857
|
+
? {
|
|
7858
|
+
objectFit: isFitSlider && !isCover ? 'contain' : 'cover',
|
|
7859
|
+
pointerEvents: 'auto',
|
|
7860
|
+
width: '100%',
|
|
7861
|
+
height: '100%',
|
|
7862
|
+
maxWidth: '100%',
|
|
7863
|
+
...imageRadiusStyle,
|
|
7864
|
+
}
|
|
7865
|
+
: isCover
|
|
7540
7866
|
? {
|
|
7541
7867
|
objectFit: 'cover',
|
|
7542
7868
|
pointerEvents: 'auto',
|
|
@@ -7551,31 +7877,92 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7551
7877
|
width: 'auto',
|
|
7552
7878
|
height: 'auto',
|
|
7553
7879
|
maxWidth: '100%',
|
|
7880
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7554
7881
|
...imageRadiusStyle,
|
|
7555
7882
|
};
|
|
7556
7883
|
|
|
7557
|
-
const
|
|
7558
|
-
const
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7884
|
+
const shouldMeasureEntries = (customLayout?.beat ?? 0) > 0 || isPlacedLayout;
|
|
7885
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7886
|
+
useLayoutEffect(() => {
|
|
7887
|
+
if (!shouldMeasureEntries) {
|
|
7888
|
+
setCustomEntryHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7889
|
+
return;
|
|
7890
|
+
}
|
|
7891
|
+
const wrapper = containerRef.current;
|
|
7892
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7893
|
+
const measure = () => {
|
|
7894
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7895
|
+
if (unit <= 0) return;
|
|
7896
|
+
const heights = inners.map(inner => (inner ? inner.offsetHeight / unit : 0));
|
|
7897
|
+
setCustomEntryHeights(prev => (
|
|
7898
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7899
|
+
? prev
|
|
7900
|
+
: heights
|
|
7901
|
+
));
|
|
7902
|
+
};
|
|
7903
|
+
measure();
|
|
7904
|
+
const ro = new ResizeObserver(measure);
|
|
7905
|
+
if (wrapper) ro.observe(wrapper);
|
|
7906
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7575
7907
|
return () => ro.disconnect();
|
|
7576
|
-
}, []);
|
|
7908
|
+
}, [shouldMeasureEntries, cropContent.length, customGridWidth, P]);
|
|
7909
|
+
const measuredEntryHeights = shouldMeasureEntries && customEntryHeights.length === cropContent.length
|
|
7910
|
+
? customEntryHeights
|
|
7911
|
+
: undefined;
|
|
7912
|
+
const customRows = useMemo(() => {
|
|
7913
|
+
if (!customLayout) return undefined;
|
|
7914
|
+
const rows = getCustomGridRows(customLayout, cropContent.length, measuredEntryHeights);
|
|
7915
|
+
return {
|
|
7916
|
+
gridRows: rows.gridRows,
|
|
7917
|
+
gridTemplateRows: rows.tracks.length
|
|
7918
|
+
? rows.tracks.map(track => (track === 'auto' ? 'auto' : scalingValue(track, isEditor))).join(' ')
|
|
7919
|
+
: 'auto',
|
|
7920
|
+
};
|
|
7921
|
+
}, [customLayout, cropContent.length, measuredEntryHeights, isEditor]);
|
|
7922
|
+
const customSlots = useMemo(
|
|
7923
|
+
() => (customLayout ? cropContent.map((_, index) => getCustomGridSlot(customLayout, index)) : undefined),
|
|
7924
|
+
[customLayout, cropContent.length],
|
|
7925
|
+
);
|
|
7926
|
+
const entryMediaAspects = useMemo(
|
|
7927
|
+
() => entriesMedia.map(({ displayItems }) => (
|
|
7928
|
+
isAutoHeight && displayItems.length > 0 ? getGridMediaAspect(displayItems[0].displayMedia) : undefined
|
|
7929
|
+
)),
|
|
7930
|
+
[entriesMedia, isAutoHeight],
|
|
7931
|
+
);
|
|
7932
|
+
const customPlacement = useMemo(() => {
|
|
7933
|
+
if (!customLayout || !customSlots || !isPlacedLayout) return undefined;
|
|
7934
|
+
const beat = customLayout.beat ?? 0;
|
|
7935
|
+
const heights = customSlots.map((slot, index) => {
|
|
7936
|
+
const aspects = entriesMedia[index].displayItems.map(({ displayMedia }) => getGridMediaAspect(displayMedia));
|
|
7937
|
+
const known = aspects.filter((aspect): aspect is number => aspect !== undefined);
|
|
7938
|
+
const estimate = isAutoHeight && known.length > 0 ? Math.max(...known.map(aspect => slot.width / aspect)) : slot.height;
|
|
7939
|
+
const height = measuredEntryHeights?.[index] ?? estimate;
|
|
7940
|
+
return beat > 0 ? Math.ceil(height / beat - 1e-3) * beat : height;
|
|
7941
|
+
});
|
|
7942
|
+
return placeCustomGridEntries(customLayout, customSlots, heights);
|
|
7943
|
+
}, [customLayout, customSlots, isPlacedLayout, isAutoHeight, entriesMedia, measuredEntryHeights]);
|
|
7944
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7945
|
+
? {
|
|
7946
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7947
|
+
gridTemplateRows: customRows?.gridTemplateRows ?? 'auto',
|
|
7948
|
+
rowGap: 0,
|
|
7949
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7950
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7951
|
+
...(customPlacement ? { position: 'relative', height: scalingValue(customPlacement.bottom, isEditor) } : {}),
|
|
7952
|
+
}
|
|
7953
|
+
: {
|
|
7954
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7955
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7956
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7957
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7958
|
+
...(shouldAlignEntries
|
|
7959
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7960
|
+
: {}),
|
|
7961
|
+
};
|
|
7577
7962
|
|
|
7578
|
-
const
|
|
7963
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
7964
|
+
|
|
7965
|
+
const getLightboxPortalStyle = (): React.CSSProperties => {
|
|
7579
7966
|
const style: Record<string, string> = { ...(colorVars as Record<string, string>) };
|
|
7580
7967
|
const articleWidth = containerRef.current
|
|
7581
7968
|
? getComputedStyle(containerRef.current).getPropertyValue('--cntrl-article-width').trim()
|
|
@@ -7584,7 +7971,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7584
7971
|
style['--cntrl-article-width'] = articleWidth;
|
|
7585
7972
|
}
|
|
7586
7973
|
return style as React.CSSProperties;
|
|
7587
|
-
}
|
|
7974
|
+
};
|
|
7588
7975
|
|
|
7589
7976
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7590
7977
|
const [lightboxItems, setLightboxItems] = useState<GridMedia[]>([]);
|
|
@@ -7623,16 +8010,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7623
8010
|
<div style={colorVars}>
|
|
7624
8011
|
<div
|
|
7625
8012
|
ref={containerRef}
|
|
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
|
-
}}>
|
|
8013
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''}\${isAutoHeight ? \` \${P}-auto-height\` : ''} \${P}-image-align-\${customLayout ? 'top' : align} \${wrapperStateClasses}\`.trim()}
|
|
8014
|
+
style={wrapperLayoutStyle}>
|
|
7636
8015
|
{cropContent.map((item: any, index: number) => {
|
|
7637
8016
|
const hasTitle = hasText(item.title);
|
|
7638
8017
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7642,11 +8021,40 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7642
8021
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7643
8022
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7644
8023
|
: undefined;
|
|
8024
|
+
const customSlot = customSlots?.[index];
|
|
8025
|
+
const itemSize = customSlot?.width ?? size;
|
|
8026
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
8027
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
8028
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
8029
|
+
const { displayItems, lightboxItemsForEntry, lightboxIndexes } = entriesMedia[index];
|
|
8030
|
+
const mediaAspect = slider === 'off' ? entryMediaAspects[index] : undefined;
|
|
8031
|
+
const imageWrapperStyle = getImageWrapperStyle(
|
|
8032
|
+
itemWidthScaled,
|
|
8033
|
+
customSlot,
|
|
8034
|
+
{ aspect: mediaAspect, isEmpty: displayItems.length === 0 },
|
|
8035
|
+
);
|
|
8036
|
+
const entryImageStyle = isAutoHeight && slider === 'off' && !mediaAspect
|
|
8037
|
+
? { ...imageStyle, height: 'auto' }
|
|
8038
|
+
: imageStyle;
|
|
8039
|
+
const itemStyle: React.CSSProperties | undefined = customSlot && customLayout && customPlacement
|
|
8040
|
+
? {
|
|
8041
|
+
position: 'absolute',
|
|
8042
|
+
left: scalingValue(customSlot.column * (customLayout.columnWidth + customLayout.gutterWidth), isEditor),
|
|
8043
|
+
top: scalingValue(customPlacement.tops[index], isEditor),
|
|
8044
|
+
width: itemWidthScaled,
|
|
8045
|
+
}
|
|
8046
|
+
: customSlot
|
|
8047
|
+
? {
|
|
8048
|
+
gridColumn: customSlot.gridColumn,
|
|
8049
|
+
gridRow: customRows?.gridRows[index],
|
|
8050
|
+
alignSelf: 'start',
|
|
8051
|
+
}
|
|
8052
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7645
8053
|
|
|
7646
8054
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7647
8055
|
<div className={\`\${P}-item-text-block\`}>
|
|
7648
8056
|
{hasTitle && (
|
|
7649
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8057
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7650
8058
|
{item.title}
|
|
7651
8059
|
</p>
|
|
7652
8060
|
)}
|
|
@@ -7661,7 +8069,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7661
8069
|
/>
|
|
7662
8070
|
)}
|
|
7663
8071
|
{hasSubtitle && (
|
|
7664
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8072
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7665
8073
|
{item.subtitle}
|
|
7666
8074
|
</p>
|
|
7667
8075
|
)}
|
|
@@ -7691,7 +8099,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7691
8099
|
/>
|
|
7692
8100
|
)}
|
|
7693
8101
|
{hasTitle && (
|
|
7694
|
-
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8102
|
+
<p className={titleTextClassName} style={{ width: textBoxWidthStyle, ...titleTextStyle }}>
|
|
7695
8103
|
{item.title}
|
|
7696
8104
|
</p>
|
|
7697
8105
|
)}
|
|
@@ -7721,7 +8129,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7721
8129
|
/>
|
|
7722
8130
|
)}
|
|
7723
8131
|
{hasSubtitle && (
|
|
7724
|
-
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...
|
|
8132
|
+
<p className={subtitleTextClassName} style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}>
|
|
7725
8133
|
{item.subtitle}
|
|
7726
8134
|
</p>
|
|
7727
8135
|
)}
|
|
@@ -7745,11 +8153,6 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7745
8153
|
</LinkWrapper>
|
|
7746
8154
|
);
|
|
7747
8155
|
|
|
7748
|
-
const displayItems = getGridDisplayItems(item.gallery);
|
|
7749
|
-
const lightboxItemsForEntry = displayItems
|
|
7750
|
-
.filter(entry => entry.lightboxMedia)
|
|
7751
|
-
.map(entry => entry.lightboxMedia!);
|
|
7752
|
-
|
|
7753
8156
|
const imageContent = (
|
|
7754
8157
|
<GridItemMediaWrapper className={imageWrapperClassName} style={imageWrapperStyle}>
|
|
7755
8158
|
{displayItems.length === 0
|
|
@@ -7757,15 +8160,13 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7757
8160
|
: slider === 'off'
|
|
7758
8161
|
?
|
|
7759
8162
|
(() => {
|
|
7760
|
-
const { displayMedia
|
|
7761
|
-
const lightboxIndex =
|
|
7762
|
-
? lightboxItemsForEntry.findIndex(item => item.assetId === lightboxMedia.assetId)
|
|
7763
|
-
: -1;
|
|
8163
|
+
const { displayMedia } = displayItems[0];
|
|
8164
|
+
const lightboxIndex = lightboxIndexes[0];
|
|
7764
8165
|
return (
|
|
7765
8166
|
<GridMediaItem
|
|
7766
8167
|
media={displayMedia}
|
|
7767
8168
|
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
7768
|
-
style={
|
|
8169
|
+
style={entryImageStyle}
|
|
7769
8170
|
hasLightbox={lightbox === 'on'}
|
|
7770
8171
|
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
7771
8172
|
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
@@ -7788,50 +8189,28 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7788
8189
|
))}
|
|
7789
8190
|
</div>
|
|
7790
8191
|
)}
|
|
7791
|
-
<
|
|
7792
|
-
key={\`\${transition}-\${
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
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;
|
|
8192
|
+
<GridEntrySlider
|
|
8193
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${layoutId}-\${displayItems.length}\`}
|
|
8194
|
+
prefix={P}
|
|
8195
|
+
isFade={transition === 'fade'}
|
|
8196
|
+
direction={direction}
|
|
8197
|
+
intervalMs={sliderTiming * 1000}
|
|
8198
|
+
slides={displayItems.map(({ displayMedia }, imgIndex) => {
|
|
8199
|
+
const lightboxIndex = lightboxIndexes[imgIndex];
|
|
7819
8200
|
return (
|
|
7820
|
-
<
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
/>
|
|
7831
|
-
</SplideSlide>
|
|
8201
|
+
<GridMediaItem
|
|
8202
|
+
media={displayMedia}
|
|
8203
|
+
className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
|
|
8204
|
+
style={imageStyle}
|
|
8205
|
+
hasLightbox={lightbox === 'on'}
|
|
8206
|
+
isSliderSlide
|
|
8207
|
+
onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
|
|
8208
|
+
? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
|
|
8209
|
+
: undefined}
|
|
8210
|
+
/>
|
|
7832
8211
|
);
|
|
7833
8212
|
})}
|
|
7834
|
-
|
|
8213
|
+
/>
|
|
7835
8214
|
</>
|
|
7836
8215
|
}
|
|
7837
8216
|
</GridItemMediaWrapper>
|
|
@@ -7849,7 +8228,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7849
8228
|
/>
|
|
7850
8229
|
<p
|
|
7851
8230
|
className={titleTextClassName}
|
|
7852
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8231
|
+
style={{ width: textBoxWidthStyle, ...titleTextStyle }}
|
|
7853
8232
|
>
|
|
7854
8233
|
{item.title}
|
|
7855
8234
|
</p>
|
|
@@ -7863,7 +8242,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7863
8242
|
/>
|
|
7864
8243
|
<p
|
|
7865
8244
|
className={subtitleTextClassName}
|
|
7866
|
-
style={{ width: textBoxWidthStyle, ...
|
|
8245
|
+
style={{ width: textBoxWidthStyle, ...subtitleTextStyle }}
|
|
7867
8246
|
>
|
|
7868
8247
|
{item.subtitle}
|
|
7869
8248
|
</p>
|
|
@@ -7883,16 +8262,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7883
8262
|
<div
|
|
7884
8263
|
key={index}
|
|
7885
8264
|
className={\`\${P}-item\`.trim()}
|
|
7886
|
-
style={
|
|
8265
|
+
style={itemStyle}
|
|
7887
8266
|
>
|
|
7888
8267
|
<div
|
|
7889
|
-
|
|
7890
|
-
|
|
8268
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8269
|
+
className={\`\${isEditMode
|
|
8270
|
+
? \`\${P}-item-inner\`
|
|
7891
8271
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7892
8272
|
style={{
|
|
7893
8273
|
width: (textBoxWidth ?? 0) > 100
|
|
7894
|
-
? \`calc(\${
|
|
7895
|
-
:
|
|
8274
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8275
|
+
: itemWidthScaled,
|
|
8276
|
+
...(customSlot && !isTextOutside && !isAutoHeight ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7896
8277
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7897
8278
|
}}
|
|
7898
8279
|
>
|
|
@@ -7938,7 +8319,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7938
8319
|
{(!isEditor || isPreviewMode) && lightboxOpen && typeof document !== 'undefined' && lightbox === 'on' && (() => {
|
|
7939
8320
|
const portalTarget = (portalId ? document.getElementById(portalId) : null) ?? document.body;
|
|
7940
8321
|
return createPortal(
|
|
7941
|
-
<div style={
|
|
8322
|
+
<div style={getLightboxPortalStyle()} data-selection="none">
|
|
7942
8323
|
<Lightbox
|
|
7943
8324
|
prefix={P}
|
|
7944
8325
|
items={lightboxItems}
|
|
@@ -7975,17 +8356,42 @@ type GridLayoutConfig = {
|
|
|
7975
8356
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7976
8357
|
};
|
|
7977
8358
|
|
|
8359
|
+
type CustomGridBlock = {
|
|
8360
|
+
column: number;
|
|
8361
|
+
span: number;
|
|
8362
|
+
top: number;
|
|
8363
|
+
height: number;
|
|
8364
|
+
};
|
|
8365
|
+
|
|
8366
|
+
type CustomGridLayout = {
|
|
8367
|
+
columnsCount: number;
|
|
8368
|
+
columnWidth: number;
|
|
8369
|
+
gutterWidth: number;
|
|
8370
|
+
maxWidth: number | null;
|
|
8371
|
+
verticalGap?: number;
|
|
8372
|
+
beat?: number;
|
|
8373
|
+
repeatHeight?: number;
|
|
8374
|
+
blocks: CustomGridBlock[];
|
|
8375
|
+
gridType?: 'masonry' | 'stacked' | 'rows' | 'freeform';
|
|
8376
|
+
cellHeight?: 'manual' | 'auto';
|
|
8377
|
+
masonry?: 'off' | 'on';
|
|
8378
|
+
rows?: number;
|
|
8379
|
+
mediaDisplay?: 'fit' | 'cover';
|
|
8380
|
+
textGrowth?: 'inside' | 'outside';
|
|
8381
|
+
};
|
|
8382
|
+
|
|
7978
8383
|
type GridSettings = {
|
|
7979
8384
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7980
|
-
gridLayout
|
|
8385
|
+
gridLayout?: GridLayoutConfig;
|
|
8386
|
+
customGrid?: CustomGridLayout;
|
|
7981
8387
|
textBoxWidth: number;
|
|
7982
|
-
verticalGap
|
|
7983
|
-
entriesCount
|
|
8388
|
+
verticalGap?: number;
|
|
8389
|
+
entriesCount?: number;
|
|
7984
8390
|
lightbox: 'on' | 'off';
|
|
7985
|
-
imageDisplay: {
|
|
8391
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7986
8392
|
display: 'fit' | 'cover';
|
|
7987
|
-
ratioValue
|
|
7988
|
-
reversed
|
|
8393
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8394
|
+
reversed?: boolean;
|
|
7989
8395
|
};
|
|
7990
8396
|
imageCorners?: number;
|
|
7991
8397
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7995,8 +8401,9 @@ type GridSettings = {
|
|
|
7995
8401
|
transition: 'fade' | 'slide',
|
|
7996
8402
|
showText: 'always' | 'on hover';
|
|
7997
8403
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7998
|
-
alignEntries
|
|
8404
|
+
alignEntries?: 'on' | 'off';
|
|
7999
8405
|
align?: 'top' | 'center' | 'bottom';
|
|
8406
|
+
textGrowth?: 'inside' | 'outside';
|
|
8000
8407
|
titleMarginTop: number;
|
|
8001
8408
|
subtitleMarginTop: number;
|
|
8002
8409
|
titleColor: string;
|
|
@@ -8043,7 +8450,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8043
8450
|
};
|
|
8044
8451
|
|
|
8045
8452
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8046
|
-
`,
|
|
8453
|
+
`, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8047
8454
|
import { CommonComponentProps } from '../props';
|
|
8048
8455
|
import { scalingValue } from '../utils/scalingValue';
|
|
8049
8456
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8616,7 +9023,7 @@ export function Helix({
|
|
|
8616
9023
|
</>
|
|
8617
9024
|
);
|
|
8618
9025
|
}
|
|
8619
|
-
`,
|
|
9026
|
+
`, M = `import { CommonComponentProps } from '../props';
|
|
8620
9027
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8621
9028
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8622
9029
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11068,7 +11475,7 @@ export function Hive({
|
|
|
11068
11475
|
</>
|
|
11069
11476
|
);
|
|
11070
11477
|
}
|
|
11071
|
-
`,
|
|
11478
|
+
`, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11072
11479
|
import { createPortal } from 'react-dom';
|
|
11073
11480
|
import { CommonComponentProps } from '../props';
|
|
11074
11481
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11871,7 +12278,7 @@ export type LightboxJournalSettings = {
|
|
|
11871
12278
|
closeIconColor: string;
|
|
11872
12279
|
closeIconHoverColor: string;
|
|
11873
12280
|
};
|
|
11874
|
-
`,
|
|
12281
|
+
`, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11875
12282
|
import { createPortal } from 'react-dom';
|
|
11876
12283
|
import { CommonComponentProps } from '../props';
|
|
11877
12284
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12455,7 +12862,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12455
12862
|
</>
|
|
12456
12863
|
);
|
|
12457
12864
|
};
|
|
12458
|
-
`,
|
|
12865
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12459
12866
|
import { createPortal } from 'react-dom';
|
|
12460
12867
|
import { CommonComponentProps } from '../props';
|
|
12461
12868
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15560,7 +15967,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15560
15967
|
</>
|
|
15561
15968
|
);
|
|
15562
15969
|
}
|
|
15563
|
-
`,
|
|
15970
|
+
`, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15564
15971
|
import cn from 'classnames';
|
|
15565
15972
|
import { CommonComponentProps } from '../props';
|
|
15566
15973
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16418,7 +16825,7 @@ type MarqueeProps = {
|
|
|
16418
16825
|
isPreviewMode?: boolean;
|
|
16419
16826
|
isEditMode?: boolean;
|
|
16420
16827
|
} & CommonComponentProps;
|
|
16421
|
-
`,
|
|
16828
|
+
`, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16422
16829
|
import cn from 'classnames';
|
|
16423
16830
|
import { CommonComponentProps } from '../props';
|
|
16424
16831
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17361,7 +17768,7 @@ type MarqueeTextProps = {
|
|
|
17361
17768
|
isPreviewMode?: boolean;
|
|
17362
17769
|
isEditMode?: boolean;
|
|
17363
17770
|
} & CommonComponentProps;
|
|
17364
|
-
`,
|
|
17771
|
+
`, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17365
17772
|
import { createPortal } from 'react-dom';
|
|
17366
17773
|
import type React from 'react';
|
|
17367
17774
|
import { CommonComponentProps } from '../props';
|
|
@@ -19843,7 +20250,7 @@ export function Mercury({
|
|
|
19843
20250
|
</>
|
|
19844
20251
|
);
|
|
19845
20252
|
}
|
|
19846
|
-
`,
|
|
20253
|
+
`, _ = `import React, { useMemo, useState } from 'react';
|
|
19847
20254
|
import { CommonComponentProps } from '../props';
|
|
19848
20255
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19849
20256
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20422,7 +20829,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20422
20829
|
};
|
|
20423
20830
|
|
|
20424
20831
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20425
|
-
`,
|
|
20832
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20426
20833
|
import type React from 'react';
|
|
20427
20834
|
import { CommonComponentProps } from '../props';
|
|
20428
20835
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21261,7 +21668,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21261
21668
|
</>
|
|
21262
21669
|
);
|
|
21263
21670
|
}
|
|
21264
|
-
`,
|
|
21671
|
+
`, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21265
21672
|
import cn from 'classnames';
|
|
21266
21673
|
import { CommonComponentProps } from '../props';
|
|
21267
21674
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -21889,7 +22296,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21889
22296
|
</>
|
|
21890
22297
|
);
|
|
21891
22298
|
}
|
|
21892
|
-
`,
|
|
22299
|
+
`, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21893
22300
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21894
22301
|
import { CommonComponentProps } from '../props';
|
|
21895
22302
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -21978,6 +22385,8 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
21978
22385
|
|
|
21979
22386
|
const STATE_KEYS = ['hover', 'active'] as const;
|
|
21980
22387
|
|
|
22388
|
+
const isGradient = (value?: string) => !!value && value.includes('gradient(');
|
|
22389
|
+
|
|
21981
22390
|
const ALIGNMENT_MAP = {
|
|
21982
22391
|
left: 'flex-start',
|
|
21983
22392
|
center: 'center',
|
|
@@ -22030,7 +22439,7 @@ function getCSS(P: string): string {
|
|
|
22030
22439
|
box-sizing: border-box;
|
|
22031
22440
|
border-style: solid;
|
|
22032
22441
|
border-color: var(--\${P}-border-color);
|
|
22033
|
-
background
|
|
22442
|
+
background: var(--\${P}-background-color);
|
|
22034
22443
|
color: var(--\${P}-text-color);
|
|
22035
22444
|
-webkit-backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
22036
22445
|
backdrop-filter: var(--\${P}-backdrop-blur, none);
|
|
@@ -22074,7 +22483,7 @@ function getCSS(P: string): string {
|
|
|
22074
22483
|
content: '';
|
|
22075
22484
|
position: absolute;
|
|
22076
22485
|
inset: 0;
|
|
22077
|
-
background
|
|
22486
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22078
22487
|
pointer-events: none;
|
|
22079
22488
|
z-index: 0;
|
|
22080
22489
|
transform: scaleY(0);
|
|
@@ -22101,7 +22510,7 @@ a:focus-visible .\${P}-hover-effect-reveal.\${P}-reveal-from-bottom::before,
|
|
|
22101
22510
|
content: '';
|
|
22102
22511
|
position: absolute;
|
|
22103
22512
|
inset: 0;
|
|
22104
|
-
background
|
|
22513
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22105
22514
|
pointer-events: none;
|
|
22106
22515
|
z-index: 0;
|
|
22107
22516
|
transform: translateX(-100%);
|
|
@@ -22117,7 +22526,7 @@ a:focus-visible .\${P}-hover-effect-swipe::before,
|
|
|
22117
22526
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-reveal,
|
|
22118
22527
|
\${effectFocus('swipe')},
|
|
22119
22528
|
.\${P}-wrapper.\${P}-state-hover .\${P}-hover-effect-swipe {
|
|
22120
|
-
background
|
|
22529
|
+
background: var(--\${P}-background-color);
|
|
22121
22530
|
}
|
|
22122
22531
|
.\${P}-hover-effect-content-roll {
|
|
22123
22532
|
position: relative;
|
|
@@ -22179,15 +22588,17 @@ a:focus-visible .\${P}-hover-effect-content-roll .\${P}-content-roll-layer-hover
|
|
|
22179
22588
|
opacity: 1;
|
|
22180
22589
|
}
|
|
22181
22590
|
\${buttonHoverOrFocus} {
|
|
22182
|
-
background
|
|
22591
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22183
22592
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22184
22593
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22594
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22185
22595
|
box-shadow: \${hoverBoxShadow};
|
|
22186
22596
|
}
|
|
22187
22597
|
.\${P}-wrapper.\${P}-state-hover .\${P}-button {
|
|
22188
|
-
background
|
|
22598
|
+
background: var(--\${P}-hover-background-color, var(--\${P}-background-color));
|
|
22189
22599
|
color: var(--\${P}-hover-text-color, var(--\${P}-text-color));
|
|
22190
22600
|
border-color: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22601
|
+
--\${P}-border-fill: var(--\${P}-hover-border-color, var(--\${P}-border-color));
|
|
22191
22602
|
box-shadow: \${hoverBoxShadow};
|
|
22192
22603
|
}
|
|
22193
22604
|
.\${P}-button:focus,
|
|
@@ -22198,17 +22609,61 @@ a:focus-visible:has(.\${P}-button) {
|
|
|
22198
22609
|
}
|
|
22199
22610
|
.\${P}-button:active,
|
|
22200
22611
|
a:active .\${P}-button {
|
|
22201
|
-
background
|
|
22612
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22202
22613
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22203
22614
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22615
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22204
22616
|
box-shadow: \${activeBoxShadow};
|
|
22205
22617
|
}
|
|
22206
22618
|
.\${P}-wrapper.\${P}-state-active .\${P}-button {
|
|
22207
|
-
background
|
|
22619
|
+
background: var(--\${P}-active-background-color, var(--\${P}-background-color));
|
|
22208
22620
|
color: var(--\${P}-active-text-color, var(--\${P}-text-color));
|
|
22209
22621
|
border-color: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22622
|
+
--\${P}-border-fill: var(--\${P}-active-border-color, var(--\${P}-border-color));
|
|
22210
22623
|
box-shadow: \${activeBoxShadow};
|
|
22211
22624
|
}
|
|
22625
|
+
/* Gradient border: CSS borders can't take gradients with radius, so the transparent border is covered by a masked ring. */
|
|
22626
|
+
.\${P}-border-gradient {
|
|
22627
|
+
position: relative;
|
|
22628
|
+
}
|
|
22629
|
+
.\${P}-border-gradient::after {
|
|
22630
|
+
content: '';
|
|
22631
|
+
position: absolute;
|
|
22632
|
+
inset: calc(var(--\${P}-stroke) * -1);
|
|
22633
|
+
padding: var(--\${P}-stroke);
|
|
22634
|
+
border-radius: inherit;
|
|
22635
|
+
background: var(--\${P}-border-fill, var(--\${P}-border-color));
|
|
22636
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
22637
|
+
-webkit-mask-composite: xor;
|
|
22638
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
22639
|
+
pointer-events: none;
|
|
22640
|
+
z-index: 2;
|
|
22641
|
+
}
|
|
22642
|
+
/* overflow would clip the ring, so these effects clip their moving parts instead */
|
|
22643
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal,
|
|
22644
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe,
|
|
22645
|
+
.\${P}-border-gradient.\${P}-hover-effect-content-roll {
|
|
22646
|
+
overflow: visible;
|
|
22647
|
+
}
|
|
22648
|
+
.\${P}-border-gradient.\${P}-hover-effect-reveal::before,
|
|
22649
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22650
|
+
border-radius: max(0px, calc(var(--\${P}-radius) - var(--\${P}-stroke)));
|
|
22651
|
+
}
|
|
22652
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22653
|
+
transform: none;
|
|
22654
|
+
clip-path: inset(0 100% 0 0);
|
|
22655
|
+
transition: clip-path 250ms;
|
|
22656
|
+
}
|
|
22657
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:hover::before,
|
|
22658
|
+
.\${P}-border-gradient.\${P}-hover-effect-swipe:focus-visible::before,
|
|
22659
|
+
a:focus-visible .\${P}-border-gradient.\${P}-hover-effect-swipe::before,
|
|
22660
|
+
.\${P}-wrapper.\${P}-state-hover .\${P}-border-gradient.\${P}-hover-effect-swipe::before {
|
|
22661
|
+
clip-path: inset(0);
|
|
22662
|
+
}
|
|
22663
|
+
/* clip the roll at the padding edge, where the button itself would have clipped it */
|
|
22664
|
+
.\${P}-border-gradient .\${P}-content-roll-viewport {
|
|
22665
|
+
clip-path: var(--\${P}-roll-clip);
|
|
22666
|
+
}
|
|
22212
22667
|
.\${P}-text {
|
|
22213
22668
|
display: block;
|
|
22214
22669
|
flex: 1;
|
|
@@ -22387,6 +22842,12 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22387
22842
|
const useContentRoll = hoverEffect === 'content-roll';
|
|
22388
22843
|
const revealHoverActive = hoverEffect === 'reveal' && (!isEditor || isPreviewMode);
|
|
22389
22844
|
|
|
22845
|
+
const hasBorderGradient = stroke > 0 && [borderColor, ...Object.values(stateOverrides ?? {}).map((o) => o?.borderColor)].some(isGradient);
|
|
22846
|
+
const borderGradientClass = hasBorderGradient ? \`\${P}-border-gradient\` : '';
|
|
22847
|
+
const strokeValue = scalingValue(stroke, isEditor);
|
|
22848
|
+
// Browsers draw a border at whole pixels, so the ring uses the same rounded width to line up with it on every side
|
|
22849
|
+
const ringStrokeValue = \`max(1px, round(down, \${strokeValue}, 1px))\`;
|
|
22850
|
+
|
|
22390
22851
|
const isFixedDimensions = dimensions === true;
|
|
22391
22852
|
const resolvedAlignment = type === 'a' ? (alignA ?? alignment) : alignment;
|
|
22392
22853
|
const effectiveAlignment = resolvedAlignment;
|
|
@@ -22428,7 +22889,18 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22428
22889
|
paddingBottom: scalingValue(padding.bottom, isEditor),
|
|
22429
22890
|
paddingLeft: scalingValue(padding.left, isEditor),
|
|
22430
22891
|
borderRadius: scalingValue(cornerRadius, isEditor),
|
|
22431
|
-
borderWidth:
|
|
22892
|
+
borderWidth: hasBorderGradient ? ringStrokeValue : strokeValue,
|
|
22893
|
+
// Like a CSS border: the background stops at it, and the ring paints over it
|
|
22894
|
+
...(hasBorderGradient ? {
|
|
22895
|
+
[\`--\${P}-stroke\`]: ringStrokeValue,
|
|
22896
|
+
[\`--\${P}-radius\`]: scalingValue(cornerRadius, isEditor),
|
|
22897
|
+
[\`--\${P}-roll-clip\`]: \`inset(\${[padding.top, padding.right, padding.bottom, padding.left].map((value) => \`calc(\${scalingValue(value, isEditor)} * -1)\`).join(' ')})\`,
|
|
22898
|
+
borderColor: 'transparent',
|
|
22899
|
+
backgroundClip: 'padding-box',
|
|
22900
|
+
} : {
|
|
22901
|
+
// A gradient background spans the border box, so it doesn't repeat under a see-through border
|
|
22902
|
+
backgroundOrigin: 'border-box',
|
|
22903
|
+
}),
|
|
22432
22904
|
...(!isIconTextType ? {
|
|
22433
22905
|
justifyContent: ALIGNMENT_MAP[effectiveAlignment],
|
|
22434
22906
|
textAlign: effectiveAlignment,
|
|
@@ -22506,7 +22978,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22506
22978
|
<div className={\`\${P}-root\`} style={colorVars}>
|
|
22507
22979
|
<div className={\`\${P}-wrapper \${stateClass} \${editingClass}\`.trim()}>
|
|
22508
22980
|
<div
|
|
22509
|
-
className={\`\${P}-button \${hoverEffectClass}\`.trim()}
|
|
22981
|
+
className={\`\${P}-button \${hoverEffectClass} \${borderGradientClass}\`.trim()}
|
|
22510
22982
|
style={buttonStyle}
|
|
22511
22983
|
onMouseEnter={handleRevealMouseEnter}
|
|
22512
22984
|
onMouseLeave={handleRevealMouseLeave}
|
|
@@ -22521,7 +22993,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22521
22993
|
</>
|
|
22522
22994
|
);
|
|
22523
22995
|
}
|
|
22524
|
-
`,
|
|
22996
|
+
`, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22525
22997
|
import cn from 'classnames';
|
|
22526
22998
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22527
22999
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23703,7 +24175,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23703
24175
|
</svg>
|
|
23704
24176
|
);
|
|
23705
24177
|
}
|
|
23706
|
-
`,
|
|
24178
|
+
`, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23707
24179
|
import cn from 'classnames';
|
|
23708
24180
|
import { CommonComponentProps } from '../props';
|
|
23709
24181
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24334,7 +24806,7 @@ type TestimonialsSettings = {
|
|
|
24334
24806
|
logoHeight: number;
|
|
24335
24807
|
captionMarginTop: number;
|
|
24336
24808
|
};
|
|
24337
|
-
`,
|
|
24809
|
+
`, V = `import cn from 'classnames';
|
|
24338
24810
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24339
24811
|
import { CommonComponentProps } from '../props';
|
|
24340
24812
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24830,7 +25302,7 @@ type TestimonialsSettings = {
|
|
|
24830
25302
|
icon?: string | null;
|
|
24831
25303
|
};
|
|
24832
25304
|
};
|
|
24833
|
-
`,
|
|
25305
|
+
`, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24834
25306
|
import type React from 'react';
|
|
24835
25307
|
import { createPortal } from 'react-dom';
|
|
24836
25308
|
import { CommonComponentProps } from '../props';
|
|
@@ -25363,30 +25835,31 @@ export function Waterfall({
|
|
|
25363
25835
|
</>
|
|
25364
25836
|
);
|
|
25365
25837
|
}
|
|
25366
|
-
`,
|
|
25367
|
-
[
|
|
25368
|
-
[
|
|
25369
|
-
[
|
|
25370
|
-
[
|
|
25371
|
-
[
|
|
25372
|
-
[
|
|
25373
|
-
[
|
|
25374
|
-
[
|
|
25375
|
-
[
|
|
25376
|
-
[
|
|
25377
|
-
[
|
|
25378
|
-
[
|
|
25379
|
-
[
|
|
25380
|
-
[
|
|
25381
|
-
[
|
|
25382
|
-
[
|
|
25383
|
-
[
|
|
25384
|
-
[
|
|
25385
|
-
[
|
|
25386
|
-
[
|
|
25387
|
-
[
|
|
25388
|
-
[
|
|
25838
|
+
`, K = {
|
|
25839
|
+
[C.id]: w,
|
|
25840
|
+
[S.id]: $,
|
|
25841
|
+
[y.id]: I,
|
|
25842
|
+
[b.id]: n,
|
|
25843
|
+
[x.id]: E,
|
|
25844
|
+
[P.id]: T,
|
|
25845
|
+
[v.id]: n,
|
|
25846
|
+
[f.id]: R,
|
|
25847
|
+
[h.id]: M,
|
|
25848
|
+
[p.id]: L,
|
|
25849
|
+
[m.id]: k,
|
|
25850
|
+
[g.id]: A,
|
|
25851
|
+
[u.id]: N,
|
|
25852
|
+
[d.id]: H,
|
|
25853
|
+
[c.id]: O,
|
|
25854
|
+
[l.id]: _,
|
|
25855
|
+
[s.id]: F,
|
|
25856
|
+
[a.id]: W,
|
|
25857
|
+
[r.id]: D,
|
|
25858
|
+
[o.id]: B,
|
|
25859
|
+
[i.id]: z,
|
|
25860
|
+
[t.id]: V,
|
|
25861
|
+
[e.id]: G
|
|
25389
25862
|
};
|
|
25390
25863
|
export {
|
|
25391
|
-
|
|
25864
|
+
K as componentSources
|
|
25392
25865
|
};
|