@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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent--pzhQXVD.js"),t=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../props';
|
|
3
3
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
4
4
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -2683,7 +2683,7 @@ export function Burger({
|
|
|
2683
2683
|
</div>
|
|
2684
2684
|
);
|
|
2685
2685
|
}
|
|
2686
|
-
`,
|
|
2686
|
+
`,i=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2687
2687
|
import { createPortal } from 'react-dom';
|
|
2688
2688
|
import cn from 'classnames';
|
|
2689
2689
|
import { CommonComponentProps } from '../props';
|
|
@@ -3730,7 +3730,7 @@ export function Chronicles({
|
|
|
3730
3730
|
</>
|
|
3731
3731
|
);
|
|
3732
3732
|
}
|
|
3733
|
-
`,
|
|
3733
|
+
`,o=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3734
3734
|
import { CommonComponentProps } from '../props';
|
|
3735
3735
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3736
3736
|
|
|
@@ -4259,7 +4259,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4259
4259
|
</>
|
|
4260
4260
|
);
|
|
4261
4261
|
}
|
|
4262
|
-
`,
|
|
4262
|
+
`,r=`import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4263
4263
|
import cn from 'classnames';
|
|
4264
4264
|
import { CommonComponentProps } from '../props';
|
|
4265
4265
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5003,7 +5003,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5003
5003
|
</>
|
|
5004
5004
|
);
|
|
5005
5005
|
}
|
|
5006
|
-
`,
|
|
5006
|
+
`,a=`import React, { useMemo, useState } from 'react';
|
|
5007
5007
|
import { CommonComponentProps } from '../props';
|
|
5008
5008
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5009
5009
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5641,7 +5641,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5641
5641
|
};
|
|
5642
5642
|
|
|
5643
5643
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5644
|
-
`,
|
|
5644
|
+
`,e=`import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5645
5645
|
import '@splidejs/react-splide/css/core';
|
|
5646
5646
|
import { CommonComponentProps } from '../props';
|
|
5647
5647
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -5779,6 +5779,13 @@ function getCSS(P: string): string {
|
|
|
5779
5779
|
flex-direction: column;
|
|
5780
5780
|
align-items: center;
|
|
5781
5781
|
}
|
|
5782
|
+
.\${P}-custom-layout .\${P}-item-image-link {
|
|
5783
|
+
flex: 1 1 0%;
|
|
5784
|
+
min-height: 0;
|
|
5785
|
+
}
|
|
5786
|
+
.\${P}-custom-layout.\${P}-text-outside .\${P}-item-image-link {
|
|
5787
|
+
flex: none;
|
|
5788
|
+
}
|
|
5782
5789
|
.\${P}-item-text-link {
|
|
5783
5790
|
display: flex;
|
|
5784
5791
|
flex-direction: column;
|
|
@@ -7300,11 +7307,94 @@ function resolveLightboxImageDisplay(
|
|
|
7300
7307
|
return value?.display === 'cover' ? 'cover' : 'fit';
|
|
7301
7308
|
}
|
|
7302
7309
|
|
|
7310
|
+
function getCustomGridSpanWidth(layout: CustomGridLayout, span: number): number {
|
|
7311
|
+
return layout.columnWidth * span + layout.gutterWidth * Math.max(0, span - 1);
|
|
7312
|
+
}
|
|
7313
|
+
|
|
7314
|
+
type CustomGridSlot = {
|
|
7315
|
+
// first column the entry covers and how many, kept in the layout's columns
|
|
7316
|
+
column: number;
|
|
7317
|
+
span: number;
|
|
7318
|
+
width: number;
|
|
7319
|
+
top: number;
|
|
7320
|
+
height: number;
|
|
7321
|
+
gridColumn: string;
|
|
7322
|
+
gridRow: string;
|
|
7323
|
+
};
|
|
7324
|
+
|
|
7325
|
+
function getCustomGridBlocksBottom(layout: CustomGridLayout): number {
|
|
7326
|
+
return layout.blocks.reduce((bottom, block) => Math.max(bottom, Math.max(0, block.top) + Math.max(0, block.height)), 0);
|
|
7327
|
+
}
|
|
7328
|
+
|
|
7329
|
+
function getCustomGridVerticalGap(layout: CustomGridLayout): number {
|
|
7330
|
+
if (typeof layout.verticalGap === 'number') return Math.max(0, layout.verticalGap);
|
|
7331
|
+
return Math.max(0, (layout.repeatHeight ?? 0) - getCustomGridBlocksBottom(layout));
|
|
7332
|
+
}
|
|
7333
|
+
|
|
7334
|
+
// entries fill the layout's blocks in order, one group after another
|
|
7335
|
+
function getCustomGridSlot(layout: CustomGridLayout, index: number): CustomGridSlot {
|
|
7336
|
+
const block = layout.blocks[index % layout.blocks.length];
|
|
7337
|
+
const span = Math.min(Math.max(1, Math.round(block.span)), layout.columnsCount);
|
|
7338
|
+
const column = Math.min(Math.max(0, Math.round(block.column)), layout.columnsCount - span);
|
|
7339
|
+
return {
|
|
7340
|
+
column,
|
|
7341
|
+
span,
|
|
7342
|
+
width: getCustomGridSpanWidth(layout, span),
|
|
7343
|
+
top: Math.max(0, block.top),
|
|
7344
|
+
height: Math.max(0, block.height),
|
|
7345
|
+
gridColumn: \`\${column + 1} / span \${span}\`,
|
|
7346
|
+
gridRow: \`\${Math.floor(index / layout.blocks.length) + 1}\`,
|
|
7347
|
+
};
|
|
7348
|
+
}
|
|
7349
|
+
|
|
7350
|
+
// the first of the grid's beats at or under \`value\`, from the top of the group
|
|
7351
|
+
function snapDownToCustomGridBeat(layout: CustomGridLayout, value: number): number {
|
|
7352
|
+
const beat = layout.beat ?? 0;
|
|
7353
|
+
return beat > 0 ? Math.ceil(value / beat - 1e-6) * beat : value;
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
/**
|
|
7357
|
+
* With the text outside the blocks, every entry's text takes room under its block: an entry of its
|
|
7358
|
+
* group under it in the same columns keeps where it is drawn, moved along with the entry above,
|
|
7359
|
+
* unless that text reaches it, and then goes onto the first beat under the text. The group grows to
|
|
7360
|
+
* the first beat under its lowest text. Text heights, tops and group heights are in layout units,
|
|
7361
|
+
* like the blocks'.
|
|
7362
|
+
*/
|
|
7363
|
+
function getCustomGridOutsideTextPlacement(layout: CustomGridLayout, textHeights: number[]) {
|
|
7364
|
+
const slots = textHeights.map((_, index) => getCustomGridSlot(layout, index));
|
|
7365
|
+
const tops = slots.map(slot => slot.top);
|
|
7366
|
+
const groupHeights: number[] = [];
|
|
7367
|
+
for (let groupStart = 0; groupStart < slots.length; groupStart += layout.blocks.length) {
|
|
7368
|
+
const group = slots
|
|
7369
|
+
.map((slot, index) => ({ slot, index }))
|
|
7370
|
+
.slice(groupStart, groupStart + layout.blocks.length)
|
|
7371
|
+
.sort((a, b) => a.slot.top - b.slot.top);
|
|
7372
|
+
let bottom = getCustomGridBlocksBottom(layout);
|
|
7373
|
+
for (const { slot, index } of group) {
|
|
7374
|
+
let top = slot.top;
|
|
7375
|
+
for (const { slot: above, index: aboveIndex } of group) {
|
|
7376
|
+
const isAbove = above.top + above.height <= slot.top + 1e-6 && aboveIndex !== index;
|
|
7377
|
+
const sharesColumns = above.column < slot.column + slot.span && slot.column < above.column + above.span;
|
|
7378
|
+
if (isAbove && sharesColumns) {
|
|
7379
|
+
const textBottom = tops[aboveIndex] + above.height + textHeights[aboveIndex];
|
|
7380
|
+
const drawnTop = slot.top + tops[aboveIndex] - above.top;
|
|
7381
|
+
top = Math.max(top, drawnTop >= textBottom - 1e-6 ? drawnTop : snapDownToCustomGridBeat(layout, textBottom));
|
|
7382
|
+
}
|
|
7383
|
+
}
|
|
7384
|
+
tops[index] = top;
|
|
7385
|
+
bottom = Math.max(bottom, tops[index] + slot.height + textHeights[index]);
|
|
7386
|
+
}
|
|
7387
|
+
groupHeights.push(snapDownToCustomGridBeat(layout, bottom));
|
|
7388
|
+
}
|
|
7389
|
+
return { tops, groupHeights };
|
|
7390
|
+
}
|
|
7391
|
+
|
|
7303
7392
|
export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, metadata, activeEvent, layoutId, portalId }: GridProps) {
|
|
7304
7393
|
const { prefix: P } = useScopedStyles();
|
|
7305
7394
|
const {
|
|
7306
7395
|
type = 'a',
|
|
7307
7396
|
gridLayout,
|
|
7397
|
+
customGrid,
|
|
7308
7398
|
textBoxWidth = 100,
|
|
7309
7399
|
verticalGap,
|
|
7310
7400
|
entriesCount,
|
|
@@ -7352,6 +7442,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7352
7442
|
hover = 'none',
|
|
7353
7443
|
alignEntries = 'off',
|
|
7354
7444
|
align = 'top',
|
|
7445
|
+
textGrowth = 'inside',
|
|
7355
7446
|
} = settings;
|
|
7356
7447
|
|
|
7357
7448
|
const resolvedTitleTextStyle: TextStyles = {
|
|
@@ -7441,7 +7532,16 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7441
7532
|
const hoverEffectClass = hover !== 'none' && (!isEditor || isPreviewMode) ? \` \${P}-hover-\${hover}\` : '';
|
|
7442
7533
|
const wrapperStateClasses = \`\${stateClass}\${showTextOnHover ? \` \${P}-show-text-hover\` : ''}\${hoverEffectClass}\`.trim();
|
|
7443
7534
|
|
|
7444
|
-
|
|
7535
|
+
// a custom layout places entries itself, in place of the columns, gap and entries count: its
|
|
7536
|
+
// group of blocks repeats for as many entries as there are. Stored, it is only the preset it is
|
|
7537
|
+
// linked to; the CMS and the site put the blocks in before it gets here
|
|
7538
|
+
const customLayout = customGrid && Array.isArray(customGrid.blocks) && customGrid.blocks.length > 0 ? customGrid : undefined;
|
|
7539
|
+
const resEntriesCount = customLayout || entriesCount === 0 ? Infinity : entriesCount;
|
|
7540
|
+
// outside, the media fills the block and the text takes room of its own beyond it: below the
|
|
7541
|
+
// media, or above it when the type puts the text first, moving the entries under it down
|
|
7542
|
+
const isTextOutside = !!customLayout && textGrowth === 'outside';
|
|
7543
|
+
const itemInnerRefs = useRef<(HTMLDivElement | null)[]>([]);
|
|
7544
|
+
const [customTextHeights, setCustomTextHeights] = useState<number[]>([]);
|
|
7445
7545
|
|
|
7446
7546
|
const cropContent = (content ?? []).slice(0, resEntriesCount);
|
|
7447
7547
|
const lightboxMediaToPreload = useMemo(
|
|
@@ -7449,23 +7549,24 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7449
7549
|
[cropContent, lightbox],
|
|
7450
7550
|
);
|
|
7451
7551
|
|
|
7452
|
-
const size = gridLayout
|
|
7552
|
+
const size = gridLayout?.entryWidth ?? 0.2;
|
|
7453
7553
|
|
|
7454
|
-
const
|
|
7455
|
-
const
|
|
7456
|
-
const
|
|
7554
|
+
const imageDisplaySettings = typeof imageDisplay === 'string' ? { display: imageDisplay } : imageDisplay;
|
|
7555
|
+
const isCover = imageDisplaySettings?.display === 'cover';
|
|
7556
|
+
const ratioValue = imageDisplaySettings?.ratioValue ?? '1:1';
|
|
7557
|
+
const ratioReversed = imageDisplaySettings?.reversed ?? false;
|
|
7457
7558
|
const [rW, rH] = ratioValue.split(':').map(Number);
|
|
7458
7559
|
const effW = ratioReversed ? rH : rW;
|
|
7459
7560
|
const effH = ratioReversed ? rW : rH;
|
|
7460
7561
|
const aspectRatio = \`\${effW} / \${effH}\`;
|
|
7461
7562
|
|
|
7462
|
-
const columnsCount = gridLayout
|
|
7563
|
+
const columnsCount = gridLayout?.columnsCount ?? 1;
|
|
7463
7564
|
const entryWidthScaled = scalingValue(size ?? 0, isEditor);
|
|
7464
|
-
|
|
7465
|
-
const isFitSlider = !isCover && slider !== 'off';
|
|
7565
|
+
// a custom block sets the entry's height, so the fit slider has nothing to size it by
|
|
7566
|
+
const isFitSlider = !customLayout && !isCover && slider !== 'off';
|
|
7466
7567
|
|
|
7467
7568
|
const itemsInLastRow = cropContent.length % columnsCount || columnsCount;
|
|
7468
|
-
const isPartialLastRow = itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7569
|
+
const isPartialLastRow = !customLayout && itemsInLastRow < columnsCount && cropContent.length > 0;
|
|
7469
7570
|
const lastRowStartIndex = cropContent.length - itemsInLastRow;
|
|
7470
7571
|
const lastRowStartColumn = isPartialLastRow
|
|
7471
7572
|
? Math.floor((columnsCount - itemsInLastRow) / 2) + 1
|
|
@@ -7473,19 +7574,23 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7473
7574
|
|
|
7474
7575
|
const imageBorderRadius = imageCorners ? scalingValue(imageCorners, isEditor) : undefined;
|
|
7475
7576
|
|
|
7476
|
-
const
|
|
7477
|
-
width:
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7577
|
+
const getImageWrapperStyle = (entryWidth: string, slot?: CustomGridSlot): React.CSSProperties => ({
|
|
7578
|
+
width: entryWidth,
|
|
7579
|
+
// in a custom block the media takes whatever the entry's text leaves of the block's height,
|
|
7580
|
+
// or the whole block when the text goes outside it
|
|
7581
|
+
...(slot
|
|
7582
|
+
? isTextOutside
|
|
7583
|
+
? { height: scalingValue(slot.height, isEditor), flexShrink: 0, overflow: 'hidden' }
|
|
7584
|
+
: { flex: '1 1 0%', minHeight: 0, overflow: 'hidden' }
|
|
7585
|
+
: isCover
|
|
7586
|
+
? { aspectRatio, height: 'auto', overflow: 'hidden' }
|
|
7587
|
+
: { height: 'auto' }),
|
|
7481
7588
|
...(imageBorderRadius ? { borderRadius: imageBorderRadius, overflow: 'hidden' } : {}),
|
|
7482
|
-
};
|
|
7589
|
+
});
|
|
7483
7590
|
|
|
7484
7591
|
const imageWrapperClassName = \`\${P}-item-image-wrapper\${isFitSlider ? \` \${P}-item-image-wrapper-fit-slider\` : ''}\`.trim();
|
|
7485
7592
|
const isTextBeforeImage = type === 'd' || type === 'e' || type === 'f';
|
|
7486
|
-
const shouldAlignEntries = alignEntries === 'on';
|
|
7487
|
-
const textBoxWidthStyle = \`calc(\${scalingValue(size ?? 0, isEditor)} * (\${textBoxWidth} / 100))\`;
|
|
7488
|
-
const controlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
7593
|
+
const shouldAlignEntries = !customLayout && alignEntries === 'on';
|
|
7489
7594
|
|
|
7490
7595
|
const imageRadiusStyle = imageBorderRadius
|
|
7491
7596
|
? { borderRadius: imageBorderRadius, [MEDIA_RADIUS_VAR]: imageBorderRadius } as React.CSSProperties
|
|
@@ -7505,9 +7610,68 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7505
7610
|
width: 'auto',
|
|
7506
7611
|
height: 'auto',
|
|
7507
7612
|
maxWidth: '100%',
|
|
7613
|
+
...(customLayout ? { maxHeight: '100%' } : {}),
|
|
7508
7614
|
...imageRadiusStyle,
|
|
7509
7615
|
};
|
|
7510
7616
|
|
|
7617
|
+
// the text's height is only known once laid out: what an entry measures beyond its media, in
|
|
7618
|
+
// layout units, the layout's whole width taken as the wrapper's
|
|
7619
|
+
const customGridWidth = customLayout ? getCustomGridSpanWidth(customLayout, customLayout.columnsCount) : 0;
|
|
7620
|
+
useLayoutEffect(() => {
|
|
7621
|
+
if (!isTextOutside) {
|
|
7622
|
+
setCustomTextHeights(prev => (prev.length > 0 ? [] : prev));
|
|
7623
|
+
return;
|
|
7624
|
+
}
|
|
7625
|
+
const wrapper = containerRef.current;
|
|
7626
|
+
const inners = itemInnerRefs.current.slice(0, cropContent.length);
|
|
7627
|
+
const measure = () => {
|
|
7628
|
+
const unit = wrapper && customGridWidth > 0 ? wrapper.offsetWidth / customGridWidth : 0;
|
|
7629
|
+
const heights = inners.map((inner) => {
|
|
7630
|
+
const media = inner?.querySelector<HTMLElement>(\`.\${P}-item-image-wrapper\`);
|
|
7631
|
+
return inner && media && unit > 0 ? Math.max(0, inner.offsetHeight - media.offsetHeight) / unit : 0;
|
|
7632
|
+
});
|
|
7633
|
+
setCustomTextHeights(prev => (
|
|
7634
|
+
prev.length === heights.length && prev.every((height, index) => Math.abs(height - heights[index]) < 1e-5)
|
|
7635
|
+
? prev
|
|
7636
|
+
: heights
|
|
7637
|
+
));
|
|
7638
|
+
};
|
|
7639
|
+
measure();
|
|
7640
|
+
const ro = new ResizeObserver(measure);
|
|
7641
|
+
if (wrapper) ro.observe(wrapper);
|
|
7642
|
+
inners.forEach(inner => inner && ro.observe(inner));
|
|
7643
|
+
return () => ro.disconnect();
|
|
7644
|
+
}, [isTextOutside, cropContent.length, customGridWidth, P]);
|
|
7645
|
+
const customOutsideText = customLayout && isTextOutside
|
|
7646
|
+
? getCustomGridOutsideTextPlacement(customLayout, cropContent.map((_: unknown, index: number) => customTextHeights[index] ?? 0))
|
|
7647
|
+
: undefined;
|
|
7648
|
+
|
|
7649
|
+
const customRowsCount = customLayout ? Math.ceil(cropContent.length / customLayout.blocks.length) : 0;
|
|
7650
|
+
const customGroupHeight = customLayout ? scalingValue(getCustomGridBlocksBottom(customLayout), isEditor) : '';
|
|
7651
|
+
const wrapperLayoutStyle: React.CSSProperties = customLayout
|
|
7652
|
+
? {
|
|
7653
|
+
gridTemplateColumns: \`repeat(\${customLayout.columnsCount}, \${scalingValue(customLayout.columnWidth, isEditor)})\`,
|
|
7654
|
+
// every group keeps the height of its blocks, or of the beats its text outside them takes,
|
|
7655
|
+
// but the last, which ends where its entries do
|
|
7656
|
+
gridTemplateRows: customRowsCount > 1
|
|
7657
|
+
? customOutsideText
|
|
7658
|
+
? \`\${customOutsideText.groupHeights.slice(0, -1).map(height => \`minmax(\${scalingValue(height, isEditor)}, auto)\`).join(' ')} auto\`
|
|
7659
|
+
: \`repeat(\${customRowsCount - 1}, minmax(\${customGroupHeight}, auto)) auto\`
|
|
7660
|
+
: 'auto',
|
|
7661
|
+
rowGap: scalingValue(getCustomGridVerticalGap(customLayout), isEditor),
|
|
7662
|
+
columnGap: scalingValue(customLayout.gutterWidth, isEditor),
|
|
7663
|
+
width: scalingValue(getCustomGridSpanWidth(customLayout, customLayout.columnsCount), isEditor),
|
|
7664
|
+
}
|
|
7665
|
+
: {
|
|
7666
|
+
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7667
|
+
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7668
|
+
columnGap: scalingValue(gridLayout?.horizontalGap ?? 0, isEditor),
|
|
7669
|
+
width: scalingValue(gridLayout?.wrapperWidth ?? 0, isEditor),
|
|
7670
|
+
...(shouldAlignEntries
|
|
7671
|
+
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7672
|
+
: {}),
|
|
7673
|
+
};
|
|
7674
|
+
|
|
7511
7675
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
7512
7676
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
7513
7677
|
|
|
@@ -7577,16 +7741,8 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7577
7741
|
<div style={colorVars}>
|
|
7578
7742
|
<div
|
|
7579
7743
|
ref={containerRef}
|
|
7580
|
-
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7581
|
-
style={
|
|
7582
|
-
gridTemplateColumns: \`repeat(\${columnsCount}, \${entryWidthScaled})\`,
|
|
7583
|
-
rowGap: shouldAlignEntries ? 0 : scalingValue(verticalGap ?? 0, isEditor),
|
|
7584
|
-
columnGap: scalingValue(gridLayout.horizontalGap ?? 0, isEditor),
|
|
7585
|
-
width: scalingValue(gridLayout.wrapperWidth ?? 0, isEditor),
|
|
7586
|
-
...(shouldAlignEntries
|
|
7587
|
-
? { [\`--\${P}-align-entries-row-gap\`]: scalingValue(verticalGap ?? 0, isEditor) }
|
|
7588
|
-
: {}),
|
|
7589
|
-
}}>
|
|
7744
|
+
className={\`\${P}-wrapper \${P}-type-\${type}\${shouldAlignEntries ? \` \${P}-align-entries\` : ''}\${customLayout ? \` \${P}-custom-layout\` : ''}\${isTextOutside ? \` \${P}-text-outside\` : ''} \${P}-image-align-\${align} \${wrapperStateClasses}\`.trim()}
|
|
7745
|
+
style={wrapperLayoutStyle}>
|
|
7590
7746
|
{cropContent.map((item: any, index: number) => {
|
|
7591
7747
|
const hasTitle = hasText(item.title);
|
|
7592
7748
|
const hasSubtitle = hasText(item.subtitle);
|
|
@@ -7596,6 +7752,20 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7596
7752
|
const gridColumn = isPartialLastRow && index >= lastRowStartIndex
|
|
7597
7753
|
? \`\${lastRowStartColumn + (index - lastRowStartIndex)}\`
|
|
7598
7754
|
: undefined;
|
|
7755
|
+
const customSlot = customLayout ? getCustomGridSlot(customLayout, index) : undefined;
|
|
7756
|
+
const itemSize = customSlot?.width ?? size;
|
|
7757
|
+
const itemWidthScaled = scalingValue(itemSize, isEditor);
|
|
7758
|
+
const textBoxWidthStyle = \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
7759
|
+
const controlWidthStyle = scalingValue(itemSize * textBoxWidth / 100, isEditor);
|
|
7760
|
+
const imageWrapperStyle = getImageWrapperStyle(itemWidthScaled, customSlot);
|
|
7761
|
+
const itemStyle: React.CSSProperties | undefined = customSlot
|
|
7762
|
+
? {
|
|
7763
|
+
gridColumn: customSlot.gridColumn,
|
|
7764
|
+
gridRow: customSlot.gridRow,
|
|
7765
|
+
alignSelf: 'start',
|
|
7766
|
+
marginTop: scalingValue(customOutsideText?.tops[index] ?? customSlot.top, isEditor),
|
|
7767
|
+
}
|
|
7768
|
+
: gridColumn && !shouldAlignEntries ? { gridColumn } : undefined;
|
|
7599
7769
|
|
|
7600
7770
|
const typeCTextBlock = isTextBeforeImage ? (
|
|
7601
7771
|
<div className={\`\${P}-item-text-block\`}>
|
|
@@ -7743,7 +7913,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7743
7913
|
</div>
|
|
7744
7914
|
)}
|
|
7745
7915
|
<Splide
|
|
7746
|
-
key={\`\${transition}-\${
|
|
7916
|
+
key={\`\${transition}-\${itemSize}-\${direction}-\${sliderTiming}-\${containerWidth}-\${layoutId}\`}
|
|
7747
7917
|
className={\`\${P}-item-slider\`}
|
|
7748
7918
|
options={{
|
|
7749
7919
|
arrows: false,
|
|
@@ -7837,16 +8007,18 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
|
|
|
7837
8007
|
<div
|
|
7838
8008
|
key={index}
|
|
7839
8009
|
className={\`\${P}-item\`.trim()}
|
|
7840
|
-
style={
|
|
8010
|
+
style={itemStyle}
|
|
7841
8011
|
>
|
|
7842
8012
|
<div
|
|
7843
|
-
|
|
7844
|
-
|
|
8013
|
+
ref={(el) => { itemInnerRefs.current[index] = el; }}
|
|
8014
|
+
className={\`\${isEditMode
|
|
8015
|
+
? \`\${P}-item-inner\`
|
|
7845
8016
|
: \`\${P}-item-inner-hidden\`}\${shouldAlignEntries && isLastRow ? \` \${P}-item-inner-last-row\` : ''}\`.trim()}
|
|
7846
8017
|
style={{
|
|
7847
8018
|
width: (textBoxWidth ?? 0) > 100
|
|
7848
|
-
? \`calc(\${
|
|
7849
|
-
:
|
|
8019
|
+
? \`calc(\${itemWidthScaled} * (\${textBoxWidth} / 100))\`
|
|
8020
|
+
: itemWidthScaled,
|
|
8021
|
+
...(customSlot && !isTextOutside ? { height: scalingValue(customSlot.height, isEditor) } : {}),
|
|
7850
8022
|
...(gridColumn && shouldAlignEntries ? { gridColumn } : {}),
|
|
7851
8023
|
}}
|
|
7852
8024
|
>
|
|
@@ -7929,17 +8101,45 @@ type GridLayoutConfig = {
|
|
|
7929
8101
|
lockedParam?: 'wrapperWidth' | 'entryWidth' | 'horizontalGap' | null;
|
|
7930
8102
|
};
|
|
7931
8103
|
|
|
8104
|
+
type CustomGridBlock = {
|
|
8105
|
+
// first column the block covers, from 0
|
|
8106
|
+
column: number;
|
|
8107
|
+
span: number;
|
|
8108
|
+
// offset from the top of its group
|
|
8109
|
+
top: number;
|
|
8110
|
+
// height of the whole entry: its media fills what the text leaves
|
|
8111
|
+
height: number;
|
|
8112
|
+
};
|
|
8113
|
+
|
|
8114
|
+
// lengths are fractions of the layout width, like the article grid's
|
|
8115
|
+
type CustomGridLayout = {
|
|
8116
|
+
columnsCount: number;
|
|
8117
|
+
columnWidth: number;
|
|
8118
|
+
gutterWidth: number;
|
|
8119
|
+
maxWidth: number | null;
|
|
8120
|
+
// space between one group of blocks and the next
|
|
8121
|
+
verticalGap?: number;
|
|
8122
|
+
// the article grid's beat: entries the text outside the blocks pushes down land on it; 0, or
|
|
8123
|
+
// missing from layouts resolved before it, when there is none
|
|
8124
|
+
beat?: number;
|
|
8125
|
+
// layouts saved before the vertical gap kept the height of a whole group instead
|
|
8126
|
+
repeatHeight?: number;
|
|
8127
|
+
blocks: CustomGridBlock[];
|
|
8128
|
+
};
|
|
8129
|
+
|
|
7932
8130
|
type GridSettings = {
|
|
7933
8131
|
type: 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
7934
|
-
|
|
8132
|
+
// one of the two places entries: Neptune's columns, or a layout drawn in the custom grid builder
|
|
8133
|
+
gridLayout?: GridLayoutConfig;
|
|
8134
|
+
customGrid?: CustomGridLayout;
|
|
7935
8135
|
textBoxWidth: number;
|
|
7936
|
-
verticalGap
|
|
7937
|
-
entriesCount
|
|
8136
|
+
verticalGap?: number;
|
|
8137
|
+
entriesCount?: number;
|
|
7938
8138
|
lightbox: 'on' | 'off';
|
|
7939
|
-
imageDisplay: {
|
|
8139
|
+
imageDisplay: 'fit' | 'cover' | {
|
|
7940
8140
|
display: 'fit' | 'cover';
|
|
7941
|
-
ratioValue
|
|
7942
|
-
reversed
|
|
8141
|
+
ratioValue?: '1:1' | '2:3' | '3:4' | '4:5' | '16:9';
|
|
8142
|
+
reversed?: boolean;
|
|
7943
8143
|
};
|
|
7944
8144
|
imageCorners?: number;
|
|
7945
8145
|
lightboxImageDisplay?: 'fit' | 'cover' | { display?: 'fit' | 'cover' };
|
|
@@ -7949,8 +8149,10 @@ type GridSettings = {
|
|
|
7949
8149
|
transition: 'fade' | 'slide',
|
|
7950
8150
|
showText: 'always' | 'on hover';
|
|
7951
8151
|
hover?: 'none' | 'zoom-in' | 'greyscale' | 'scale-down';
|
|
7952
|
-
alignEntries
|
|
8152
|
+
alignEntries?: 'on' | 'off';
|
|
7953
8153
|
align?: 'top' | 'center' | 'bottom';
|
|
8154
|
+
// with a custom layout: whether a block holds the entry's text or only its media
|
|
8155
|
+
textGrowth?: 'inside' | 'outside';
|
|
7954
8156
|
titleMarginTop: number;
|
|
7955
8157
|
subtitleMarginTop: number;
|
|
7956
8158
|
titleColor: string;
|
|
@@ -25317,4 +25519,4 @@ export function Waterfall({
|
|
|
25317
25519
|
</>
|
|
25318
25520
|
);
|
|
25319
25521
|
}
|
|
25320
|
-
`,C={[n.BurgerComponent.id]:
|
|
25522
|
+
`,C={[n.BurgerComponent.id]:t,[n.ChroniclesComponent.id]:i,[n.ClickGallerieComponent.id]:o,[n.CustomGridComponent.id]:e,[n.FAQComponent.id]:r,[n.FormComponent.id]:a,[n.GridComponent.id]:e,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;
|