@cntrl-site/components 1.0.117 → 1.0.118-alpha.2
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--pzhQXVD.js +1 -0
- package/dist/{ChroniclesComponent-Szt0H-op.mjs → ChroniclesComponent-Ds59v_47.mjs} +512 -442
- package/dist/Components/Grid/CustomGridComponent.d.ts +41 -0
- package/dist/Components/Grid/Grid.d.ts +25 -7
- package/dist/Grid-B0NOfgEm.mjs +1713 -0
- package/dist/Grid-DNaBgqZo.js +415 -0
- package/dist/{components-DSHc15vW.mjs → components-MVf3iei3.mjs} +13 -12
- package/dist/{components-iORMB3kt.js → components-tuVRZ0WY.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +7 -6
- 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 +250 -48
- package/dist/sources.mjs +290 -87
- package/package.json +1 -1
- package/dist/ChroniclesComponent-CoOgQZx2.js +0 -1
- package/dist/Grid-C4hO8KCr.js +0 -408
- package/dist/Grid-Dud7PLS9.mjs +0 -1622
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-Ds59v_47.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';
|
|
@@ -2684,7 +2684,7 @@ export function Burger({
|
|
|
2684
2684
|
</div>
|
|
2685
2685
|
);
|
|
2686
2686
|
}
|
|
2687
|
-
`,
|
|
2687
|
+
`, $ = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2688
2688
|
import { createPortal } from 'react-dom';
|
|
2689
2689
|
import cn from 'classnames';
|
|
2690
2690
|
import { CommonComponentProps } from '../props';
|
|
@@ -3731,7 +3731,7 @@ export function Chronicles({
|
|
|
3731
3731
|
</>
|
|
3732
3732
|
);
|
|
3733
3733
|
}
|
|
3734
|
-
`,
|
|
3734
|
+
`, I = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3735
3735
|
import { CommonComponentProps } from '../props';
|
|
3736
3736
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3737
3737
|
|
|
@@ -4260,7 +4260,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4260
4260
|
</>
|
|
4261
4261
|
);
|
|
4262
4262
|
}
|
|
4263
|
-
`,
|
|
4263
|
+
`, E = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4264
4264
|
import cn from 'classnames';
|
|
4265
4265
|
import { CommonComponentProps } from '../props';
|
|
4266
4266
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5004,7 +5004,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5004
5004
|
</>
|
|
5005
5005
|
);
|
|
5006
5006
|
}
|
|
5007
|
-
`,
|
|
5007
|
+
`, T = `import React, { useMemo, useState } from 'react';
|
|
5008
5008
|
import { CommonComponentProps } from '../props';
|
|
5009
5009
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5010
5010
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5642,7 +5642,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5642
5642
|
};
|
|
5643
5643
|
|
|
5644
5644
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5645
|
-
`,
|
|
5645
|
+
`, n = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5646
5646
|
import '@splidejs/react-splide/css/core';
|
|
5647
5647
|
import { CommonComponentProps } from '../props';
|
|
5648
5648
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -5780,6 +5780,13 @@ function getCSS(P: string): string {
|
|
|
5780
5780
|
flex-direction: column;
|
|
5781
5781
|
align-items: center;
|
|
5782
5782
|
}
|
|
5783
|
+
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5784
|
+
flex: 1 1 0%;
|
|
5785
|
+
min-height: 0;
|
|
5786
|
+
}
|
|
5787
|
+
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
|
|
5788
|
+
flex: none;
|
|
5789
|
+
}
|
|
5783
5790
|
.\${P}-item-text-link {
|
|
5784
5791
|
display: flex;
|
|
5785
5792
|
flex-direction: column;
|
|
@@ -7301,11 +7308,94 @@ function resolveLightboxImageDisplay(
|
|
|
7301
7308
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7302
7309
|
}
|
|
7303
7310
|
|
|
7311
|
+
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7312
|
+
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7313
|
+
}
|
|
7314
|
+
|
|
7315
|
+
type CustomGridSlot = {
|
|
7316
|
+
// first column the entry covers and how many, kept in the layout's columns
|
|
7317
|
+
column: number;
|
|
7318
|
+
span: number;
|
|
7319
|
+
width: number;
|
|
7320
|
+
top: number;
|
|
7321
|
+
height: number;
|
|
7322
|
+
gridColumn: string;
|
|
7323
|
+
gridRow: string;
|
|
7324
|
+
};
|
|
7325
|
+
|
|
7326
|
+
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7327
|
+
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7328
|
+
}
|
|
7329
|
+
|
|
7330
|
+
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7331
|
+
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7332
|
+
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7333
|
+
}
|
|
7334
|
+
|
|
7335
|
+
// entries fill the layout's blocks in order, one group after another
|
|
7336
|
+
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7337
|
+
const block = layout.blocks[index % layout.blocks.length];
|
|
7338
|
+
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7339
|
+
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7340
|
+
return {
|
|
7341
|
+
column,
|
|
7342
|
+
span,
|
|
7343
|
+
width: getCustomGridSpanWidth(layout, span),
|
|
7344
|
+
top: Math.max(0, block.top),
|
|
7345
|
+
height: Math.max(0, block.height),
|
|
7346
|
+
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7347
|
+
gridRow: \`\${Math.floor(index / layout.blocks.length) + 1}\`,
|
|
7348
|
+
};
|
|
7349
|
+
}
|
|
7350
|
+
|
|
7351
|
+
// the first of the grid's beats at or under \`value\`, from the top of the group
|
|
7352
|
+
function snapDownToCustomGridBeat(layout: CustomGridLayout, value: number): number {
|
|
7353
|
+
const beat = layout.beat ?? 0;
|
|
7354
|
+
return beat > 0 ? Math.ceil(value / beat - 1e-6) * beat : value;
|
|
7355
|
+
}
|
|
7356
|
+
|
|
7357
|
+
/**
|
|
7358
|
+
* With the text outside the blocks, every entry's text takes room under its block: an entry of its
|
|
7359
|
+
* group under it in the same columns keeps where it is drawn, moved along with the entry above,
|
|
7360
|
+
* unless that text reaches it, and then goes onto the first beat under the text. The group grows to
|
|
7361
|
+
* the first beat under its lowest text. Text heights, tops and group heights are in layout units,
|
|
7362
|
+
* like the blocks'.
|
|
7363
|
+
*/
|
|
7364
|
+
function getCustomGridOutsideTextPlacement(layout: CustomGridLayout, textHeights: number[]) {
|
|
7365
|
+
const slots = textHeights.map((_, index) => getCustomGridSlot(layout, index));
|
|
7366
|
+
const tops = slots.map(slot => slot.top);
|
|
7367
|
+
const groupHeights: number[] = [];
|
|
7368
|
+
for (let groupStart = 0; groupStart < slots.length; groupStart += layout.blocks.length) {
|
|
7369
|
+
const group = slots
|
|
7370
|
+
.map((slot, index) => ({ slot, index }))
|
|
7371
|
+
.slice(groupStart, groupStart + layout.blocks.length)
|
|
7372
|
+
.sort((a, b) => a.slot.top - b.slot.top);
|
|
7373
|
+
let bottom = getCustomGridBlocksBottom(layout);
|
|
7374
|
+
for (const { slot, index } of group) {
|
|
7375
|
+
let top = slot.top;
|
|
7376
|
+
for (const { slot: above, index: aboveIndex } of group) {
|
|
7377
|
+
const isAbove = above.top + above.height <= slot.top + 1e-6 && aboveIndex !== index;
|
|
7378
|
+
const sharesColumns = above.column < slot.column + slot.span && slot.column < above.column + above.span;
|
|
7379
|
+
if (isAbove && sharesColumns) {
|
|
7380
|
+
const textBottom = tops[aboveIndex] + above.height + textHeights[aboveIndex];
|
|
7381
|
+
const drawnTop = slot.top + tops[aboveIndex] - above.top;
|
|
7382
|
+
top = Math.max(top, drawnTop >= textBottom - 1e-6 ? drawnTop : snapDownToCustomGridBeat(layout, textBottom));
|
|
7383
|
+
}
|
|
7384
|
+
}
|
|
7385
|
+
tops[index] = top;
|
|
7386
|
+
bottom = Math.max(bottom, tops[index] + slot.height + textHeights[index]);
|
|
7387
|
+
}
|
|
7388
|
+
groupHeights.push(snapDownToCustomGridBeat(layout, bottom));
|
|
7389
|
+
}
|
|
7390
|
+
return { tops, groupHeights };
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7304
7393
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7305
7394
|
const { prefix: P } = useScopedStyles();
|
|
7306
7395
|
const {
|
|
7307
7396
|
type = 'a',
|
|
7308
7397
|
gridLayout,
|
|
7398
|
+
customGrid,
|
|
7309
7399
|
textBoxWidth = 100,
|
|
7310
7400
|
verticalGap,
|
|
7311
7401
|
entriesCount,
|
|
@@ -7353,6 +7443,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7353
7443
|
hover = 'none',
|
|
7354
7444
|
alignEntries = 'off',
|
|
7355
7445
|
align = 'top',
|
|
7446
|
+
textGrowth = 'inside',
|
|
7356
7447
|
} = settings;
|
|
7357
7448
|
|
|
7358
7449
|
const resolvedTitleTextStyle: TextStyles = {
|
|
@@ -7442,7 +7533,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7442
7533
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7443
7534
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7444
7535
|
|
|
7445
|
-
|
|
7536
|
+
// a custom layout places entries itself, in place of the columns, gap and entries count: its
|
|
7537
|
+
// group of blocks repeats for as many entries as there are. Stored, it is only the preset it is
|
|
7538
|
+
// linked to; the CMS and the site put the blocks in before it gets here
|
|
7539
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7540
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7541
|
+
// outside, the media fills the block and the text takes room of its own beyond it: below the
|
|
7542
|
+
// media, or above it when the type puts the text first, moving the entries under it down
|
|
7543
|
+
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7544
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7545
|
+
const [customTextHeights, setCustomTextHeights] = useState<number[]>([]);
|
|
7446
7546
|
|
|
7447
7547
|
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7448
7548
|
const lightboxMediaToPreload = useMemo(
|
|
@@ -7450,23 +7550,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7450
7550
|
[cropContent, lightbox],
|
|
7451
7551
|
);
|
|
7452
7552
|
|
|
7453
|
-
const size = gridLayout
|
|
7553
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7454
7554
|
|
|
7455
|
-
const
|
|
7456
|
-
const
|
|
7457
|
-
const
|
|
7555
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7556
|
+
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7557
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7558
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7458
7559
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7459
7560
|
const effW = ratioReversed ? rH : rW;
|
|
7460
7561
|
const effH = ratioReversed ? rW : rH;
|
|
7461
7562
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7462
7563
|
|
|
7463
|
-
const columnsCount = gridLayout
|
|
7564
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7464
7565
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7465
|
-
|
|
7466
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7566
|
+
// a custom block sets the entry's height, so the fit slider has nothing to size it by
|
|
7567
|
+
const isFitSlider = !customLayout && !isCover && slider !== 'off';
|
|
7467
7568
|
|
|
7468
7569
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7469
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7570
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7470
7571
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7471
7572
|
const lastRowStartColumn = isPartialLastRow
|
|
7472
7573
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7474,19 +7575,23 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7474
7575
|
|
|
7475
7576
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7476
7577
|
|
|
7477
|
-
const
|
|
7478
|
-
width:
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7578
|
+
const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
|
|
7579
|
+
width: entryWidth,
|
|
7580
|
+
// in a custom block the media takes whatever the entry's text leaves of the block's height,
|
|
7581
|
+
// or the whole block when the text goes outside it
|
|
7582
|
+
...(slot
|
|
7583
|
+
? isTextOutside
|
|
7584
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7585
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7586
|
+
: isCover
|
|
7587
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7588
|
+
: { height: 'auto' }),
|
|
7482
7589
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7483
|
-
};
|
|
7590
|
+
});
|
|
7484
7591
|
|
|
7485
7592
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7486
7593
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7487
|
-
const shouldAlignEntries = alignEntries === 'on';
|
|
7488
|
-
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7489
|
-
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7594
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7490
7595
|
|
|
7491
7596
|
const imageRadiusStyle = imageBorderRadius
|
|
7492
7597
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7506,9 +7611,68 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7506
7611
|
width: 'auto',
|
|
7507
7612
|
height: 'auto',
|
|
7508
7613
|
maxWidth: '100%',
|
|
7614
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7509
7615
|
...imageRadiusStyle,
|
|
7510
7616
|
};
|
|
7511
7617
|
|
|
7618
|
+
// the text's height is only known once laid out: what an entry measures beyond its media, in
|
|
7619
|
+
// layout units, the layout's whole width taken as the wrapper's
|
|
7620
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7621
|
+
useLayoutEffect(() => {
|
|
7622
|
+
if (!isTextOutside) {
|
|
7623
|
+
setCustomTextHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7624
|
+
return;
|
|
7625
|
+
}
|
|
7626
|
+
const wrapper = containerRef.current;
|
|
7627
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7628
|
+
const measure = () => {
|
|
7629
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7630
|
+
const heights = inners.map((inner) => {
|
|
7631
|
+
const media = inner?.querySelector<HTMLElement>(\`.\${P}-item-image-wrapper\`);
|
|
7632
|
+
return inner && media && unit > 0 ? Math.max(0, inner.offsetHeight - media.offsetHeight) / unit : 0;
|
|
7633
|
+
});
|
|
7634
|
+
setCustomTextHeights(prev => (
|
|
7635
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7636
|
+
? prev
|
|
7637
|
+
: heights
|
|
7638
|
+
));
|
|
7639
|
+
};
|
|
7640
|
+
measure();
|
|
7641
|
+
const ro = new ResizeObserver(measure);
|
|
7642
|
+
if (wrapper) ro.observe(wrapper);
|
|
7643
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7644
|
+
return () => ro.disconnect();
|
|
7645
|
+
}, [isTextOutside, cropContent.length, customGridWidth, P]);
|
|
7646
|
+
const customOutsideText = customLayout && isTextOutside
|
|
7647
|
+
? getCustomGridOutsideTextPlacement(customLayout, cropContent.map((_: unknown, index: number) => customTextHeights[index] ?? 0))
|
|
7648
|
+
: undefined;
|
|
7649
|
+
|
|
7650
|
+
const customRowsCount = customLayout ? Math.ceil(cropContent.length / customLayout.blocks.length) : 0;
|
|
7651
|
+
const customGroupHeight = customLayout ? scalingValue(getCustomGridBlocksBottom(customLayout), isEditor) : '';
|
|
7652
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7653
|
+
? {
|
|
7654
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7655
|
+
// every group keeps the height of its blocks, or of the beats its text outside them takes,
|
|
7656
|
+
// but the last, which ends where its entries do
|
|
7657
|
+
gridTemplateRows: customRowsCount > 1
|
|
7658
|
+
? customOutsideText
|
|
7659
|
+
? \`\${customOutsideText.groupHeights.slice(0, -1).map(height => \`minmax(\${scalingValue(height, isEditor)}, auto)\`).join(' ')} auto\`
|
|
7660
|
+
: \`repeat(\${customRowsCount - 1}, minmax(\${customGroupHeight}, auto)) auto\`
|
|
7661
|
+
: 'auto',
|
|
7662
|
+
rowGap: scalingValue(getCustomGridVerticalGap(customLayout), isEditor),
|
|
7663
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7664
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7665
|
+
}
|
|
7666
|
+
: {
|
|
7667
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7668
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7669
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7670
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7671
|
+
...(shouldAlignEntries
|
|
7672
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7673
|
+
: {}),
|
|
7674
|
+
};
|
|
7675
|
+
|
|
7512
7676
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
7513
7677
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7514
7678
|
|
|
@@ -7578,16 +7742,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7578
7742
|
<div style={colorVars}>
|
|
7579
7743
|
<div
|
|
7580
7744
|
ref={containerRef}
|
|
7581
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7582
|
-
style={
|
|
7583
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7584
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7585
|
-
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7586
|
-
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7587
|
-
...(shouldAlignEntries
|
|
7588
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7589
|
-
: {}),
|
|
7590
|
-
}}>
|
|
7745
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7746
|
+
style={wrapperLayoutStyle}>
|
|
7591
7747
|
{cropContent.map((item: any, index: number) => {
|
|
7592
7748
|
const hasTitle = hasText(item.title);
|
|
7593
7749
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7597,6 +7753,20 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7597
7753
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7598
7754
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7599
7755
|
: undefined;
|
|
7756
|
+
const customSlot = customLayout ? getCustomGridSlot(customLayout, index) : undefined;
|
|
7757
|
+
const itemSize = customSlot?.width ?? size;
|
|
7758
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
7759
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
7760
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
7761
|
+
const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
|
|
7762
|
+
const itemStyle: React.CSSProperties | undefined = customSlot
|
|
7763
|
+
? {
|
|
7764
|
+
gridColumn: customSlot.gridColumn,
|
|
7765
|
+
gridRow: customSlot.gridRow,
|
|
7766
|
+
alignSelf: 'start',
|
|
7767
|
+
marginTop: scalingValue(customOutsideText?.tops[index] ?? customSlot.top, isEditor),
|
|
7768
|
+
}
|
|
7769
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7600
7770
|
|
|
7601
7771
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7602
7772
|
<div className={\`\${P}-item-text-block\`}>
|
|
@@ -7744,7 +7914,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7744
7914
|
</div>
|
|
7745
7915
|
)}
|
|
7746
7916
|
<Splide
|
|
7747
|
-
key={\`\${transition}-\${
|
|
7917
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7748
7918
|
className={\`\${P}-item-slider\`}
|
|
7749
7919
|
options={{
|
|
7750
7920
|
arrows: false,
|
|
@@ -7838,16 +8008,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7838
8008
|
<div
|
|
7839
8009
|
key={index}
|
|
7840
8010
|
className={\`\${P}-item\`.trim()}
|
|
7841
|
-
style={
|
|
8011
|
+
style={itemStyle}
|
|
7842
8012
|
>
|
|
7843
8013
|
<div
|
|
7844
|
-
|
|
7845
|
-
|
|
8014
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8015
|
+
className={\`\${isEditMode
|
|
8016
|
+
? \`\${P}-item-inner\`
|
|
7846
8017
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7847
8018
|
style={{
|
|
7848
8019
|
width: (textBoxWidth ?? 0) > 100
|
|
7849
|
-
? \`calc(\${
|
|
7850
|
-
:
|
|
8020
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8021
|
+
: itemWidthScaled,
|
|
8022
|
+
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7851
8023
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7852
8024
|
}}
|
|
7853
8025
|
>
|
|
@@ -7930,17 +8102,45 @@ type GridLayoutConfig = {
|
|
|
7930
8102
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7931
8103
|
};
|
|
7932
8104
|
|
|
8105
|
+
type CustomGridBlock = {
|
|
8106
|
+
// first column the block covers, from 0
|
|
8107
|
+
column: number;
|
|
8108
|
+
span: number;
|
|
8109
|
+
// offset from the top of its group
|
|
8110
|
+
top: number;
|
|
8111
|
+
// height of the whole entry: its media fills what the text leaves
|
|
8112
|
+
height: number;
|
|
8113
|
+
};
|
|
8114
|
+
|
|
8115
|
+
// lengths are fractions of the layout width, like the article grid's
|
|
8116
|
+
type CustomGridLayout = {
|
|
8117
|
+
columnsCount: number;
|
|
8118
|
+
columnWidth: number;
|
|
8119
|
+
gutterWidth: number;
|
|
8120
|
+
maxWidth: number | null;
|
|
8121
|
+
// space between one group of blocks and the next
|
|
8122
|
+
verticalGap?: number;
|
|
8123
|
+
// the article grid's beat: entries the text outside the blocks pushes down land on it; 0, or
|
|
8124
|
+
// missing from layouts resolved before it, when there is none
|
|
8125
|
+
beat?: number;
|
|
8126
|
+
// layouts saved before the vertical gap kept the height of a whole group instead
|
|
8127
|
+
repeatHeight?: number;
|
|
8128
|
+
blocks: CustomGridBlock[];
|
|
8129
|
+
};
|
|
8130
|
+
|
|
7933
8131
|
type GridSettings = {
|
|
7934
8132
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7935
|
-
|
|
8133
|
+
// one of the two places entries: Neptune's columns, or a layout drawn in the custom grid builder
|
|
8134
|
+
gridLayout?: GridLayoutConfig;
|
|
8135
|
+
customGrid?: CustomGridLayout;
|
|
7936
8136
|
textBoxWidth: number;
|
|
7937
|
-
verticalGap
|
|
7938
|
-
entriesCount
|
|
8137
|
+
verticalGap?: number;
|
|
8138
|
+
entriesCount?: number;
|
|
7939
8139
|
lightbox: 'on' | 'off';
|
|
7940
|
-
imageDisplay: {
|
|
8140
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7941
8141
|
display: 'fit' | 'cover';
|
|
7942
|
-
ratioValue
|
|
7943
|
-
reversed
|
|
8142
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8143
|
+
reversed?: boolean;
|
|
7944
8144
|
};
|
|
7945
8145
|
imageCorners?: number;
|
|
7946
8146
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7950,8 +8150,10 @@ type GridSettings = {
|
|
|
7950
8150
|
transition: 'fade' | 'slide',
|
|
7951
8151
|
showText: 'always' | 'on hover';
|
|
7952
8152
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7953
|
-
alignEntries
|
|
8153
|
+
alignEntries?: 'on' | 'off';
|
|
7954
8154
|
align?: 'top' | 'center' | 'bottom';
|
|
8155
|
+
// with a custom layout: whether a block holds the entry's text or only its media
|
|
8156
|
+
textGrowth?: 'inside' | 'outside';
|
|
7955
8157
|
titleMarginTop: number;
|
|
7956
8158
|
subtitleMarginTop: number;
|
|
7957
8159
|
titleColor: string;
|
|
@@ -7998,7 +8200,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
7998
8200
|
};
|
|
7999
8201
|
|
|
8000
8202
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8001
|
-
`,
|
|
8203
|
+
`, R = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8002
8204
|
import { CommonComponentProps } from '../props';
|
|
8003
8205
|
import { scalingValue } from '../utils/scalingValue';
|
|
8004
8206
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8571,7 +8773,7 @@ export function Helix({
|
|
|
8571
8773
|
</>
|
|
8572
8774
|
);
|
|
8573
8775
|
}
|
|
8574
|
-
`,
|
|
8776
|
+
`, M = `import { CommonComponentProps } from '../props';
|
|
8575
8777
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8576
8778
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8577
8779
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11023,7 +11225,7 @@ export function Hive({
|
|
|
11023
11225
|
</>
|
|
11024
11226
|
);
|
|
11025
11227
|
}
|
|
11026
|
-
`,
|
|
11228
|
+
`, L = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
11027
11229
|
import { createPortal } from 'react-dom';
|
|
11028
11230
|
import { CommonComponentProps } from '../props';
|
|
11029
11231
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11826,7 +12028,7 @@ export type LightboxJournalSettings = {
|
|
|
11826
12028
|
closeIconColor: string;
|
|
11827
12029
|
closeIconHoverColor: string;
|
|
11828
12030
|
};
|
|
11829
|
-
`,
|
|
12031
|
+
`, k = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11830
12032
|
import { createPortal } from 'react-dom';
|
|
11831
12033
|
import { CommonComponentProps } from '../props';
|
|
11832
12034
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12410,7 +12612,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12410
12612
|
</>
|
|
12411
12613
|
);
|
|
12412
12614
|
};
|
|
12413
|
-
`,
|
|
12615
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12414
12616
|
import { createPortal } from 'react-dom';
|
|
12415
12617
|
import { CommonComponentProps } from '../props';
|
|
12416
12618
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15515,7 +15717,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15515
15717
|
</>
|
|
15516
15718
|
);
|
|
15517
15719
|
}
|
|
15518
|
-
`,
|
|
15720
|
+
`, N = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15519
15721
|
import cn from 'classnames';
|
|
15520
15722
|
import { CommonComponentProps } from '../props';
|
|
15521
15723
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16373,7 +16575,7 @@ type MarqueeProps = {
|
|
|
16373
16575
|
isPreviewMode?: boolean;
|
|
16374
16576
|
isEditMode?: boolean;
|
|
16375
16577
|
} & CommonComponentProps;
|
|
16376
|
-
`,
|
|
16578
|
+
`, H = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16377
16579
|
import cn from 'classnames';
|
|
16378
16580
|
import { CommonComponentProps } from '../props';
|
|
16379
16581
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17316,7 +17518,7 @@ type MarqueeTextProps = {
|
|
|
17316
17518
|
isPreviewMode?: boolean;
|
|
17317
17519
|
isEditMode?: boolean;
|
|
17318
17520
|
} & CommonComponentProps;
|
|
17319
|
-
`,
|
|
17521
|
+
`, O = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17320
17522
|
import { createPortal } from 'react-dom';
|
|
17321
17523
|
import type React from 'react';
|
|
17322
17524
|
import { CommonComponentProps } from '../props';
|
|
@@ -19798,7 +20000,7 @@ export function Mercury({
|
|
|
19798
20000
|
</>
|
|
19799
20001
|
);
|
|
19800
20002
|
}
|
|
19801
|
-
`,
|
|
20003
|
+
`, _ = `import React, { useMemo, useState } from 'react';
|
|
19802
20004
|
import { CommonComponentProps } from '../props';
|
|
19803
20005
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19804
20006
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20377,7 +20579,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20377
20579
|
};
|
|
20378
20580
|
|
|
20379
20581
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20380
|
-
`,
|
|
20582
|
+
`, W = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20381
20583
|
import type React from 'react';
|
|
20382
20584
|
import { CommonComponentProps } from '../props';
|
|
20383
20585
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21844,7 +22046,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21844
22046
|
</>
|
|
21845
22047
|
);
|
|
21846
22048
|
}
|
|
21847
|
-
`,
|
|
22049
|
+
`, D = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21848
22050
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21849
22051
|
import { CommonComponentProps } from '../props';
|
|
21850
22052
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22476,7 +22678,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22476
22678
|
</>
|
|
22477
22679
|
);
|
|
22478
22680
|
}
|
|
22479
|
-
`,
|
|
22681
|
+
`, B = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22480
22682
|
import cn from 'classnames';
|
|
22481
22683
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22482
22684
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23658,7 +23860,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23658
23860
|
</svg>
|
|
23659
23861
|
);
|
|
23660
23862
|
}
|
|
23661
|
-
`,
|
|
23863
|
+
`, z = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23662
23864
|
import cn from 'classnames';
|
|
23663
23865
|
import { CommonComponentProps } from '../props';
|
|
23664
23866
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24289,7 +24491,7 @@ type TestimonialsSettings = {
|
|
|
24289
24491
|
logoHeight: number;
|
|
24290
24492
|
captionMarginTop: number;
|
|
24291
24493
|
};
|
|
24292
|
-
`,
|
|
24494
|
+
`, V = `import cn from 'classnames';
|
|
24293
24495
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24294
24496
|
import { CommonComponentProps } from '../props';
|
|
24295
24497
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24785,7 +24987,7 @@ type TestimonialsSettings = {
|
|
|
24785
24987
|
icon?: string | null;
|
|
24786
24988
|
};
|
|
24787
24989
|
};
|
|
24788
|
-
`,
|
|
24990
|
+
`, G = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24789
24991
|
import type React from 'react';
|
|
24790
24992
|
import { createPortal } from 'react-dom';
|
|
24791
24993
|
import { CommonComponentProps } from '../props';
|
|
@@ -25318,30 +25520,31 @@ export function Waterfall({
|
|
|
25318
25520
|
</>
|
|
25319
25521
|
);
|
|
25320
25522
|
}
|
|
25321
|
-
`,
|
|
25322
|
-
[
|
|
25323
|
-
[
|
|
25324
|
-
[
|
|
25325
|
-
[
|
|
25326
|
-
[
|
|
25327
|
-
[
|
|
25328
|
-
[
|
|
25329
|
-
[
|
|
25330
|
-
[
|
|
25331
|
-
[
|
|
25332
|
-
[
|
|
25333
|
-
[
|
|
25334
|
-
[
|
|
25335
|
-
[
|
|
25336
|
-
[
|
|
25337
|
-
[
|
|
25338
|
-
[
|
|
25339
|
-
[
|
|
25340
|
-
[
|
|
25341
|
-
[
|
|
25342
|
-
[
|
|
25343
|
-
[
|
|
25523
|
+
`, K = {
|
|
25524
|
+
[C.id]: w,
|
|
25525
|
+
[S.id]: $,
|
|
25526
|
+
[y.id]: I,
|
|
25527
|
+
[b.id]: n,
|
|
25528
|
+
[x.id]: E,
|
|
25529
|
+
[P.id]: T,
|
|
25530
|
+
[v.id]: n,
|
|
25531
|
+
[f.id]: R,
|
|
25532
|
+
[h.id]: M,
|
|
25533
|
+
[p.id]: L,
|
|
25534
|
+
[m.id]: k,
|
|
25535
|
+
[g.id]: A,
|
|
25536
|
+
[u.id]: N,
|
|
25537
|
+
[d.id]: H,
|
|
25538
|
+
[c.id]: O,
|
|
25539
|
+
[l.id]: _,
|
|
25540
|
+
[s.id]: W,
|
|
25541
|
+
[a.id]: F,
|
|
25542
|
+
[r.id]: D,
|
|
25543
|
+
[o.id]: B,
|
|
25544
|
+
[i.id]: z,
|
|
25545
|
+
[t.id]: V,
|
|
25546
|
+
[e.id]: G
|
|
25344
25547
|
};
|
|
25345
25548
|
export {
|
|
25346
|
-
|
|
25549
|
+
K as componentSources
|
|
25347
25550
|
};
|