@cntrl-site/components 1.0.108 → 1.0.109
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/Chronicles-Clc3aiGG.mjs +723 -0
- package/dist/Chronicles-DBqZzhwf.js +198 -0
- package/dist/ChroniclesComponent-4QMq3nfr.js +1 -0
- package/dist/{PretextComponent-BiS9XbZr.mjs → ChroniclesComponent-CwSeQzn1.mjs} +857 -425
- package/dist/{ClickGallerie-o2U6oyOF.mjs → ClickGallerie-Cjc_1Gxy.mjs} +1 -1
- package/dist/{ClickGallerie-CYQMgrIr.js → ClickGallerie-DYbc-rDp.js} +1 -1
- package/dist/Components/Chronicles/Chronicles.d.ts +121 -0
- package/dist/Components/Chronicles/ChroniclesComponent.d.ts +313 -0
- package/dist/Components/utils/buildValidUrl.d.ts +1 -0
- package/dist/Components/utils/index.d.ts +1 -0
- package/dist/{ControlSlider-Kkec-i14.js → ControlSlider-C8ckUIDm.js} +1 -1
- package/dist/{ControlSlider-LcZmviGX.mjs → ControlSlider-DqKfaKMG.mjs} +1 -1
- package/dist/{FAQ-CdwSft5p.mjs → FAQ-BS-vO0l-.mjs} +1 -1
- package/dist/{FAQ-BxhMo7T8.js → FAQ-Ct0YfqX1.js} +1 -1
- package/dist/{Grid-CFHTP3mb.js → Grid-CU1dsdoO.js} +1 -1
- package/dist/{Grid-e-gLfsji.mjs → Grid-qbqchSLi.mjs} +1 -1
- package/dist/{ImageRevealSlider-Df9sygk9.mjs → ImageRevealSlider-DifEXySR.mjs} +1 -1
- package/dist/{ImageRevealSlider-BuukTGAK.js → ImageRevealSlider-DlxudBUy.js} +1 -1
- package/dist/{Lightbox-C_fXsfdz.mjs → Lightbox-BY99NS14.mjs} +1 -1
- package/dist/{Lightbox-DaunVrkp.js → Lightbox-DZckgBzK.js} +1 -1
- package/dist/LinkWrapper-5kQHiGJQ.mjs +10 -0
- package/dist/LinkWrapper-CTqM1ucO.js +1 -0
- package/dist/{Marquee-DfIP-tIN.js → Marquee-DDKigLBo.js} +1 -1
- package/dist/{Marquee-DByooiWP.mjs → Marquee-_xVuf-zp.mjs} +1 -1
- package/dist/{MarqueeText-DsUiV6Zv.js → MarqueeText-B5hqB0HA.js} +1 -1
- package/dist/{MarqueeText-D6FNCe6P.mjs → MarqueeText-C2E6UDsb.mjs} +1 -1
- package/dist/{RichTextRenderer-BptwNpbJ.mjs → RichTextRenderer-D52Xto59.mjs} +1 -1
- package/dist/{RichTextRenderer-K90Dd7pt.js → RichTextRenderer-DEFXh5o6.js} +1 -1
- package/dist/{Slider20-fMVeRfgx.js → Slider20-BOmjDRf2.js} +1 -1
- package/dist/{Slider20-CCzixTiN.mjs → Slider20-DUi6qwnd.mjs} +1 -1
- package/dist/{TestimonialGrid-CiCagfBU.js → TestimonialGrid-BHZazEVX.js} +1 -1
- package/dist/{TestimonialGrid-CbsVxSn9.mjs → TestimonialGrid-C-8IDzWu.mjs} +1 -1
- package/dist/{TestimonialSingle-BWXynGjv.js → TestimonialSingle-BORQom3u.js} +1 -1
- package/dist/{TestimonialSingle-BVm3Amrl.mjs → TestimonialSingle-DrnyReim.mjs} +1 -1
- package/dist/buildValidUrl-BbtqqeHr.mjs +7 -0
- package/dist/buildValidUrl-CtJWFCPi.js +1 -0
- package/dist/components-CU9RB7sz.js +1 -0
- package/dist/{components-ljYgHKal.mjs → components-Dn_5L1zL.mjs} +18 -17
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +16 -15
- 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 +1028 -22
- package/dist/sources.mjs +1052 -45
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +19 -17
- package/package.json +1 -1
- package/dist/LinkWrapper-Ca84iPtg.js +0 -1
- package/dist/LinkWrapper-DZs9hlOn.mjs +0 -13
- package/dist/PretextComponent-DWOy-dqD.js +0 -1
- package/dist/components-CJlisugq.js +0 -1
package/dist/sources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-4QMq3nfr.js"),e=`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,1013 @@ export function Burger({
|
|
|
2683
2683
|
</div>
|
|
2684
2684
|
);
|
|
2685
2685
|
}
|
|
2686
|
-
`,t=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2686
|
+
`,t=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2687
|
+
import { createPortal } from 'react-dom';
|
|
2688
|
+
import cn from 'classnames';
|
|
2689
|
+
import { CommonComponentProps } from '../props';
|
|
2690
|
+
import { buildColorVars, buildValidUrl, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
2691
|
+
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
2692
|
+
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
2693
|
+
|
|
2694
|
+
export const CHRONICLES_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
|
|
2695
|
+
export const CHRONICLES_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
|
|
2696
|
+
export const CHRONICLES_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
|
|
2697
|
+
|
|
2698
|
+
const TITLE_KEYS = ['title', ...CHRONICLES_EXTRA_TITLE_KEYS] as const;
|
|
2699
|
+
|
|
2700
|
+
const PANEL_POSITION_OFFSETS = {
|
|
2701
|
+
center: { x: '50%', y: '50%' },
|
|
2702
|
+
'left-top': { x: '0%', y: '0%' },
|
|
2703
|
+
'top-center': { x: '50%', y: '0%' },
|
|
2704
|
+
'top-right': { x: '100%', y: '0%' },
|
|
2705
|
+
'left-center': { x: '0%', y: '50%' },
|
|
2706
|
+
'right-center': { x: '100%', y: '50%' },
|
|
2707
|
+
'left-bottom': { x: '0%', y: '100%' },
|
|
2708
|
+
'bottom-center': { x: '50%', y: '100%' },
|
|
2709
|
+
'right-bottom': { x: '100%', y: '100%' },
|
|
2710
|
+
} as const;
|
|
2711
|
+
|
|
2712
|
+
type ChroniclesPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
|
|
2713
|
+
|
|
2714
|
+
export const CHRONICLES_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ChroniclesPanelPosition[];
|
|
2715
|
+
|
|
2716
|
+
const OVERLAY_ANIM_MS = 300;
|
|
2717
|
+
const IMAGE_FADE_MS = 300;
|
|
2718
|
+
const MIN_HANDLE_SIZE = 0.004;
|
|
2719
|
+
const MIN_COLUMN_WIDTH_PX = 20;
|
|
2720
|
+
const VIDEO_EXTENSION_RE = /\\.(mp4|webm|ogg|mov)(\\?|$)/i;
|
|
2721
|
+
|
|
2722
|
+
const LIGHTBOX_CSS_VARS = [
|
|
2723
|
+
'--cntrl-article-width',
|
|
2724
|
+
'--cntrl-article-top',
|
|
2725
|
+
'--cntrl-article-left',
|
|
2726
|
+
'--cntrl-viewport-height',
|
|
2727
|
+
] as const;
|
|
2728
|
+
|
|
2729
|
+
const COLOR_VAR_MAP = {
|
|
2730
|
+
triggerColor: 'trigger-color',
|
|
2731
|
+
triggerHoverColor: 'trigger-hover-color',
|
|
2732
|
+
closeColor: 'close-color',
|
|
2733
|
+
closeHoverColor: 'close-hover-color',
|
|
2734
|
+
panelColor: 'panel-color',
|
|
2735
|
+
textColor: 'text-color',
|
|
2736
|
+
textHoverColor: 'text-hover-color',
|
|
2737
|
+
overlayColor: 'overlay-color',
|
|
2738
|
+
} as const;
|
|
2739
|
+
|
|
2740
|
+
const PADDING_CONTROLS = [
|
|
2741
|
+
{ side: 'top', axis: 'y', variant: 'row-padding' },
|
|
2742
|
+
{ side: 'bottom', axis: 'y', variant: 'row-padding', reverse: true },
|
|
2743
|
+
{ side: 'left', axis: 'x', variant: 'column-padding', opposite: 'right' },
|
|
2744
|
+
{ side: 'right', axis: 'x', variant: 'column-padding', opposite: 'left', reverse: true },
|
|
2745
|
+
] as const;
|
|
2746
|
+
|
|
2747
|
+
type Padding = { top: number; right: number; bottom: number; left: number };
|
|
2748
|
+
|
|
2749
|
+
type ColumnWidthKey = typeof CHRONICLES_COLUMN_WIDTH_KEYS[number];
|
|
2750
|
+
|
|
2751
|
+
type TextStylePrefix = 'trigger' | typeof CHRONICLES_COLUMN_STYLE_PREFIXES[number];
|
|
2752
|
+
|
|
2753
|
+
type ChroniclesMedia = {
|
|
2754
|
+
assetId: string;
|
|
2755
|
+
name?: string;
|
|
2756
|
+
type?: 'image' | 'video';
|
|
2757
|
+
objectFit?: 'cover' | 'contain';
|
|
2758
|
+
};
|
|
2759
|
+
|
|
2760
|
+
type ChroniclesItem = {
|
|
2761
|
+
group?: string;
|
|
2762
|
+
title?: string;
|
|
2763
|
+
title2?: string;
|
|
2764
|
+
title3?: string;
|
|
2765
|
+
title4?: string;
|
|
2766
|
+
image?: ChroniclesMedia[];
|
|
2767
|
+
link?: ContentLink;
|
|
2768
|
+
};
|
|
2769
|
+
|
|
2770
|
+
type ChroniclesGroup = {
|
|
2771
|
+
label: string;
|
|
2772
|
+
rows: { item: ChroniclesItem; index: number }[];
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2775
|
+
type TextStyleFields = {
|
|
2776
|
+
FontFamily: string;
|
|
2777
|
+
FontSettings: { fontWeight: number; fontStyle: string };
|
|
2778
|
+
FontSize: number;
|
|
2779
|
+
LineHeight: number;
|
|
2780
|
+
LetterSpacing: number;
|
|
2781
|
+
WordSpacing: number;
|
|
2782
|
+
TextAlign?: TextStyles['textAlign'];
|
|
2783
|
+
TextAppearance: TextStyles['textAppearance'];
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2786
|
+
type PrefixedTextStyle<Prefix extends string> = {
|
|
2787
|
+
[Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]: TextStyleFields[Key];
|
|
2788
|
+
};
|
|
2789
|
+
|
|
2790
|
+
type ColumnLayoutSettings = Partial<Record<ColumnWidthKey, number>> & {
|
|
2791
|
+
columns: number;
|
|
2792
|
+
columnGap: number;
|
|
2793
|
+
panelWidth: number;
|
|
2794
|
+
panelPadding: Padding;
|
|
2795
|
+
};
|
|
2796
|
+
|
|
2797
|
+
type ChroniclesSettings = PrefixedTextStyle<TextStylePrefix> & ColumnLayoutSettings & {
|
|
2798
|
+
type: 'a' | 'b';
|
|
2799
|
+
triggerLabel: string;
|
|
2800
|
+
closeLabel: string;
|
|
2801
|
+
hoverInterval: number;
|
|
2802
|
+
panelPosition: ChroniclesPanelPosition;
|
|
2803
|
+
panelRadius: number;
|
|
2804
|
+
groupGap: number;
|
|
2805
|
+
triggerColor: string;
|
|
2806
|
+
triggerHoverColor: string;
|
|
2807
|
+
closeColor: string;
|
|
2808
|
+
closeHoverColor: string;
|
|
2809
|
+
panelColor: string;
|
|
2810
|
+
textColor: string;
|
|
2811
|
+
textHoverColor: string;
|
|
2812
|
+
overlayColor: string;
|
|
2813
|
+
};
|
|
2814
|
+
|
|
2815
|
+
type ChroniclesProps = {
|
|
2816
|
+
settings: ChroniclesSettings;
|
|
2817
|
+
content?: ChroniclesItem[];
|
|
2818
|
+
isEditor?: boolean;
|
|
2819
|
+
isEditMode?: boolean;
|
|
2820
|
+
isPreviewMode?: boolean;
|
|
2821
|
+
activeEvent?: string;
|
|
2822
|
+
portalId?: string;
|
|
2823
|
+
} & CommonComponentProps;
|
|
2824
|
+
|
|
2825
|
+
function getColumnsSpace({ columns, columnGap, panelWidth, panelPadding }: ColumnLayoutSettings): number {
|
|
2826
|
+
return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - (columns - 1) * columnGap);
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
export function getChroniclesEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ColumnWidthKey, number>> {
|
|
2830
|
+
const width = getColumnsSpace(settings) / settings.columns;
|
|
2831
|
+
return Object.fromEntries(CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => [key, width]));
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
export function applyChroniclesColumnCountChange(
|
|
2835
|
+
nextSettings: Record<string, any>,
|
|
2836
|
+
prevSettings: Record<string, any>,
|
|
2837
|
+
): Record<string, any> {
|
|
2838
|
+
if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
|
|
2839
|
+
return nextSettings;
|
|
2840
|
+
}
|
|
2841
|
+
return { ...nextSettings, ...getChroniclesEqualColumnWidths({ ...prevSettings, ...nextSettings } as ColumnLayoutSettings) };
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
function resolveColumnWidths(settings: ColumnLayoutSettings): number[] {
|
|
2845
|
+
const space = getColumnsSpace(settings);
|
|
2846
|
+
const sized = CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => {
|
|
2847
|
+
const width = settings[key];
|
|
2848
|
+
return typeof width === 'number' ? Math.max(0, width) : space / settings.columns;
|
|
2849
|
+
});
|
|
2850
|
+
const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
|
|
2851
|
+
const scale = sizedTotal > space ? space / sizedTotal : 1;
|
|
2852
|
+
return [...sized.map((width) => width * scale), Math.max(0, space - sizedTotal * scale)];
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
function getGridTemplateColumns(widths: number[]): string {
|
|
2856
|
+
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
2857
|
+
return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// A row with an empty group continues the group above it.
|
|
2861
|
+
function groupRows(items: ChroniclesItem[]): ChroniclesGroup[] {
|
|
2862
|
+
const groups: ChroniclesGroup[] = [];
|
|
2863
|
+
items.forEach((item, index) => {
|
|
2864
|
+
const label = item.group?.trim() ?? '';
|
|
2865
|
+
const current = groups[groups.length - 1];
|
|
2866
|
+
if (!current || (label !== '' && label !== current.label)) {
|
|
2867
|
+
groups.push({ label, rows: [{ item, index }] });
|
|
2868
|
+
return;
|
|
2869
|
+
}
|
|
2870
|
+
current.rows.push({ item, index });
|
|
2871
|
+
});
|
|
2872
|
+
return groups;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
function getRowMedia(item: ChroniclesItem | undefined): ChroniclesMedia[] {
|
|
2876
|
+
return (item?.image ?? []).filter((media) => Boolean(media?.assetId));
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
|
|
2880
|
+
return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2883
|
+
function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
|
|
2884
|
+
if (type) return type === 'video';
|
|
2885
|
+
return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
2889
|
+
for (let el = element; el; el = el.parentElement) {
|
|
2890
|
+
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) return el;
|
|
2891
|
+
}
|
|
2892
|
+
return element;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
function getLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
2896
|
+
const layoutContainer = findLayoutContainer(container);
|
|
2897
|
+
if (!layoutContainer) return {};
|
|
2898
|
+
const computed = getComputedStyle(layoutContainer);
|
|
2899
|
+
return Object.fromEntries(
|
|
2900
|
+
LIGHTBOX_CSS_VARS
|
|
2901
|
+
.map((name) => [name, computed.getPropertyValue(name).trim()])
|
|
2902
|
+
.filter(([, value]) => value),
|
|
2903
|
+
);
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
function resolveTextStyle(settings: ChroniclesSettings, prefix: TextStylePrefix): TextStyles {
|
|
2907
|
+
const read = <Key extends keyof TextStyleFields>(key: Key) => (
|
|
2908
|
+
(settings as Record<string, unknown>)[\`\${prefix}\${key}\`] as TextStyleFields[Key]
|
|
2909
|
+
);
|
|
2910
|
+
return {
|
|
2911
|
+
fontSettings: { fontFamily: read('FontFamily'), ...read('FontSettings') },
|
|
2912
|
+
fontSize: read('FontSize'),
|
|
2913
|
+
lineHeight: read('LineHeight'),
|
|
2914
|
+
letterSpacing: read('LetterSpacing'),
|
|
2915
|
+
wordSpacing: read('WordSpacing'),
|
|
2916
|
+
textAlign: read('TextAlign'),
|
|
2917
|
+
textAppearance: read('TextAppearance'),
|
|
2918
|
+
color: '#000000',
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
function getCSS(P: string): string {
|
|
2923
|
+
return \`
|
|
2924
|
+
.\${P}-trigger,
|
|
2925
|
+
.\${P}-close {
|
|
2926
|
+
display: inline-block;
|
|
2927
|
+
margin: 0;
|
|
2928
|
+
padding: 0;
|
|
2929
|
+
border: 0;
|
|
2930
|
+
background: none;
|
|
2931
|
+
cursor: pointer;
|
|
2932
|
+
white-space: nowrap;
|
|
2933
|
+
transition: color 150ms ease;
|
|
2934
|
+
-webkit-appearance: none;
|
|
2935
|
+
appearance: none;
|
|
2936
|
+
-webkit-tap-highlight-color: transparent;
|
|
2937
|
+
}
|
|
2938
|
+
.\${P}-trigger {
|
|
2939
|
+
color: var(--\${P}-trigger-color);
|
|
2940
|
+
transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
2941
|
+
}
|
|
2942
|
+
.\${P}-trigger-hidden {
|
|
2943
|
+
opacity: 0;
|
|
2944
|
+
}
|
|
2945
|
+
.\${P}-close {
|
|
2946
|
+
position: absolute;
|
|
2947
|
+
z-index: 2;
|
|
2948
|
+
color: var(--\${P}-close-color);
|
|
2949
|
+
}
|
|
2950
|
+
.\${P}-trigger:focus,
|
|
2951
|
+
.\${P}-close:focus {
|
|
2952
|
+
outline: none;
|
|
2953
|
+
}
|
|
2954
|
+
.\${P}-trigger:focus-visible,
|
|
2955
|
+
.\${P}-close:focus-visible {
|
|
2956
|
+
outline: 1px solid currentColor;
|
|
2957
|
+
outline-offset: 2px;
|
|
2958
|
+
}
|
|
2959
|
+
.\${P}-interactive .\${P}-trigger:hover,
|
|
2960
|
+
.\${P}-state-hover .\${P}-trigger {
|
|
2961
|
+
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
2962
|
+
}
|
|
2963
|
+
.\${P}-close:hover {
|
|
2964
|
+
color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
|
|
2965
|
+
}
|
|
2966
|
+
.\${P}-editor .\${P}-trigger {
|
|
2967
|
+
cursor: default;
|
|
2968
|
+
}
|
|
2969
|
+
.\${P}-overlay {
|
|
2970
|
+
position: fixed;
|
|
2971
|
+
inset: 0;
|
|
2972
|
+
z-index: 9997;
|
|
2973
|
+
overflow: hidden;
|
|
2974
|
+
overscroll-behavior: none;
|
|
2975
|
+
opacity: 0;
|
|
2976
|
+
pointer-events: none;
|
|
2977
|
+
transition: opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
2978
|
+
}
|
|
2979
|
+
.\${P}-inline-layer {
|
|
2980
|
+
position: fixed;
|
|
2981
|
+
inset: 0;
|
|
2982
|
+
z-index: 9997;
|
|
2983
|
+
overflow: hidden;
|
|
2984
|
+
pointer-events: none;
|
|
2985
|
+
}
|
|
2986
|
+
.\${P}-overlay-editor {
|
|
2987
|
+
inset: auto;
|
|
2988
|
+
top: var(--cntrl-article-top, 0);
|
|
2989
|
+
left: var(--cntrl-article-left, 0);
|
|
2990
|
+
width: var(--cntrl-article-width, 100vw) !important;
|
|
2991
|
+
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
2992
|
+
}
|
|
2993
|
+
.\${P}-overlay-edit-mode {
|
|
2994
|
+
z-index: 1;
|
|
2995
|
+
}
|
|
2996
|
+
.\${P}-overlay-active {
|
|
2997
|
+
opacity: 1;
|
|
2998
|
+
pointer-events: auto;
|
|
2999
|
+
}
|
|
3000
|
+
.\${P}-backdrop {
|
|
3001
|
+
position: absolute;
|
|
3002
|
+
inset: 0;
|
|
3003
|
+
background-color: var(--\${P}-overlay-color);
|
|
3004
|
+
}
|
|
3005
|
+
.\${P}-media-layer {
|
|
3006
|
+
position: absolute;
|
|
3007
|
+
inset: 0;
|
|
3008
|
+
pointer-events: none;
|
|
3009
|
+
}
|
|
3010
|
+
.\${P}-media {
|
|
3011
|
+
position: absolute;
|
|
3012
|
+
inset: 0;
|
|
3013
|
+
width: 100%;
|
|
3014
|
+
height: 100%;
|
|
3015
|
+
object-fit: cover;
|
|
3016
|
+
opacity: 0;
|
|
3017
|
+
}
|
|
3018
|
+
.\${P}-media-contain {
|
|
3019
|
+
object-fit: contain;
|
|
3020
|
+
}
|
|
3021
|
+
.\${P}-media-visible,
|
|
3022
|
+
.\${P}-media-fading {
|
|
3023
|
+
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
3024
|
+
}
|
|
3025
|
+
.\${P}-media-visible {
|
|
3026
|
+
z-index: 1;
|
|
3027
|
+
opacity: 1;
|
|
3028
|
+
}
|
|
3029
|
+
.\${P}-media-covered {
|
|
3030
|
+
opacity: 1;
|
|
3031
|
+
}
|
|
3032
|
+
.\${P}-media-fading {
|
|
3033
|
+
opacity: 0;
|
|
3034
|
+
}
|
|
3035
|
+
.\${P}-media-layer-instant .\${P}-media {
|
|
3036
|
+
transition: none;
|
|
3037
|
+
}
|
|
3038
|
+
.\${P}-panel {
|
|
3039
|
+
position: absolute;
|
|
3040
|
+
top: var(--\${P}-panel-y);
|
|
3041
|
+
left: var(--\${P}-panel-x);
|
|
3042
|
+
z-index: 1;
|
|
3043
|
+
box-sizing: border-box;
|
|
3044
|
+
max-width: 100%;
|
|
3045
|
+
max-height: 100%;
|
|
3046
|
+
overflow-y: auto;
|
|
3047
|
+
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
|
|
3048
|
+
background-color: var(--\${P}-panel-color);
|
|
3049
|
+
color: var(--\${P}-text-color);
|
|
3050
|
+
overscroll-behavior: contain;
|
|
3051
|
+
transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
3052
|
+
}
|
|
3053
|
+
.\${P}-overlay-active .\${P}-panel {
|
|
3054
|
+
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
|
|
3055
|
+
}
|
|
3056
|
+
.\${P}-panel-settled {
|
|
3057
|
+
transition: none;
|
|
3058
|
+
}
|
|
3059
|
+
.\${P}-panel-inline {
|
|
3060
|
+
position: relative;
|
|
3061
|
+
top: auto;
|
|
3062
|
+
left: auto;
|
|
3063
|
+
max-height: none;
|
|
3064
|
+
transform: none;
|
|
3065
|
+
transition: none;
|
|
3066
|
+
}
|
|
3067
|
+
.\${P}-panel-copy {
|
|
3068
|
+
position: absolute;
|
|
3069
|
+
pointer-events: none;
|
|
3070
|
+
}
|
|
3071
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3072
|
+
.\${P}-panel {
|
|
3073
|
+
transition: none;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
.\${P}-group {
|
|
3077
|
+
display: grid;
|
|
3078
|
+
grid-template-columns: var(--\${P}-grid-columns);
|
|
3079
|
+
column-gap: var(--\${P}-column-gap);
|
|
3080
|
+
}
|
|
3081
|
+
.\${P}-group ~ .\${P}-group {
|
|
3082
|
+
margin-top: var(--\${P}-group-gap);
|
|
3083
|
+
}
|
|
3084
|
+
.\${P}-group-label {
|
|
3085
|
+
grid-column: 1;
|
|
3086
|
+
align-self: start;
|
|
3087
|
+
min-width: 0;
|
|
3088
|
+
overflow-wrap: anywhere;
|
|
3089
|
+
}
|
|
3090
|
+
.\${P}-row {
|
|
3091
|
+
grid-column: 2 / -1;
|
|
3092
|
+
display: grid;
|
|
3093
|
+
grid-template-columns: subgrid;
|
|
3094
|
+
align-items: baseline;
|
|
3095
|
+
}
|
|
3096
|
+
a.\${P}-row {
|
|
3097
|
+
color: inherit;
|
|
3098
|
+
text-decoration: none;
|
|
3099
|
+
}
|
|
3100
|
+
.\${P}-group-unlabeled .\${P}-row {
|
|
3101
|
+
grid-column: 1 / -1;
|
|
3102
|
+
}
|
|
3103
|
+
.\${P}-title {
|
|
3104
|
+
min-width: 0;
|
|
3105
|
+
overflow-wrap: anywhere;
|
|
3106
|
+
white-space: pre-line;
|
|
3107
|
+
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
3108
|
+
}
|
|
3109
|
+
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
3110
|
+
.\${P}-row:focus-visible .\${P}-title,
|
|
3111
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title,
|
|
3112
|
+
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
3113
|
+
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
3114
|
+
}
|
|
3115
|
+
.\${P}-control-anchor {
|
|
3116
|
+
position: absolute;
|
|
3117
|
+
pointer-events: none;
|
|
3118
|
+
z-index: 2;
|
|
3119
|
+
}
|
|
3120
|
+
\`;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
type ChroniclesMediaItemProps = {
|
|
3124
|
+
P: string;
|
|
3125
|
+
media: ChroniclesMedia;
|
|
3126
|
+
isVisible: boolean;
|
|
3127
|
+
isLoaded: boolean;
|
|
3128
|
+
isCovered: boolean;
|
|
3129
|
+
isFading: boolean;
|
|
3130
|
+
onLoad: () => void;
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
function ChroniclesMediaItem({ P, media, isVisible, isLoaded, isCovered, isFading, onLoad }: ChroniclesMediaItemProps) {
|
|
3134
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
|
3135
|
+
const isVideo = isVideoMedia(media);
|
|
3136
|
+
const className = cn(
|
|
3137
|
+
\`\${P}-media\`,
|
|
3138
|
+
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
3139
|
+
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
3140
|
+
isCovered && \`\${P}-media-covered\`,
|
|
3141
|
+
isFading && \`\${P}-media-fading\`,
|
|
3142
|
+
);
|
|
3143
|
+
|
|
3144
|
+
useEffect(() => {
|
|
3145
|
+
const video = videoRef.current;
|
|
3146
|
+
if (!video) return;
|
|
3147
|
+
if (isVisible) {
|
|
3148
|
+
video.play()?.catch(() => {});
|
|
3149
|
+
} else {
|
|
3150
|
+
video.pause();
|
|
3151
|
+
}
|
|
3152
|
+
}, [isVisible]);
|
|
3153
|
+
|
|
3154
|
+
if (isVideo) {
|
|
3155
|
+
return (
|
|
3156
|
+
<video
|
|
3157
|
+
ref={videoRef}
|
|
3158
|
+
className={className}
|
|
3159
|
+
src={media.assetId}
|
|
3160
|
+
muted
|
|
3161
|
+
loop
|
|
3162
|
+
playsInline
|
|
3163
|
+
preload="auto"
|
|
3164
|
+
onLoadedData={onLoad}
|
|
3165
|
+
/>
|
|
3166
|
+
);
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
return <img className={className} src={media.assetId} alt="" decoding="async" onLoad={onLoad} />;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
function renderColumnWidthControls(
|
|
3173
|
+
P: string,
|
|
3174
|
+
widths: number[],
|
|
3175
|
+
paddingLeft: number,
|
|
3176
|
+
columnGap: number,
|
|
3177
|
+
scaled: (value: number) => string,
|
|
3178
|
+
) {
|
|
3179
|
+
const lastWidth = widths[widths.length - 1];
|
|
3180
|
+
let columnLeft = paddingLeft;
|
|
3181
|
+
return widths.slice(0, -1).map((width, index) => {
|
|
3182
|
+
const gapCenter = columnLeft + width + columnGap / 2;
|
|
3183
|
+
columnLeft += width + columnGap;
|
|
3184
|
+
return (
|
|
3185
|
+
<div
|
|
3186
|
+
key={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
|
|
3187
|
+
data-controls={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
|
|
3188
|
+
data-controls-axis="x"
|
|
3189
|
+
data-controls-variant="column-width"
|
|
3190
|
+
data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
|
|
3191
|
+
data-controls-max-fraction={String(width + lastWidth)}
|
|
3192
|
+
className={\`\${P}-control-anchor\`}
|
|
3193
|
+
style={{ top: 0, left: scaled(gapCenter - MIN_HANDLE_SIZE / 2), width: scaled(MIN_HANDLE_SIZE), height: '100%' }}
|
|
3194
|
+
/>
|
|
3195
|
+
);
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
function renderPanelPaddingControls(
|
|
3200
|
+
P: string,
|
|
3201
|
+
panelWidth: number,
|
|
3202
|
+
padding: Padding,
|
|
3203
|
+
scaled: (value: number) => string,
|
|
3204
|
+
) {
|
|
3205
|
+
return PADDING_CONTROLS.map((control) => {
|
|
3206
|
+
const size = scaled(Math.max(padding[control.side], MIN_HANDLE_SIZE));
|
|
3207
|
+
const isHorizontal = control.axis === 'x';
|
|
3208
|
+
return (
|
|
3209
|
+
<div
|
|
3210
|
+
key={control.side}
|
|
3211
|
+
data-controls={\`panelPadding.\${control.side}\`}
|
|
3212
|
+
data-controls-axis={control.axis}
|
|
3213
|
+
data-controls-variant={control.variant}
|
|
3214
|
+
data-controls-reverse={'reverse' in control ? '' : undefined}
|
|
3215
|
+
data-controls-min="0"
|
|
3216
|
+
data-controls-max-fraction={'opposite' in control ? String(Math.max(0, panelWidth - padding[control.opposite])) : undefined}
|
|
3217
|
+
className={\`\${P}-control-anchor\`}
|
|
3218
|
+
style={{
|
|
3219
|
+
[control.side]: 0,
|
|
3220
|
+
...(isHorizontal ? { top: 0, width: size, height: '100%' } : { left: 0, width: '100%', height: size }),
|
|
3221
|
+
}}
|
|
3222
|
+
/>
|
|
3223
|
+
);
|
|
3224
|
+
});
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
export function Chronicles({
|
|
3228
|
+
settings,
|
|
3229
|
+
content,
|
|
3230
|
+
isEditor,
|
|
3231
|
+
isEditMode,
|
|
3232
|
+
isPreviewMode,
|
|
3233
|
+
activeEvent,
|
|
3234
|
+
portalId,
|
|
3235
|
+
currentState,
|
|
3236
|
+
unavailableStates,
|
|
3237
|
+
}: ChroniclesProps) {
|
|
3238
|
+
const { prefix: P } = useScopedStyles();
|
|
3239
|
+
const {
|
|
3240
|
+
type,
|
|
3241
|
+
triggerLabel,
|
|
3242
|
+
closeLabel,
|
|
3243
|
+
columns,
|
|
3244
|
+
columnGap,
|
|
3245
|
+
hoverInterval,
|
|
3246
|
+
panelPosition,
|
|
3247
|
+
panelWidth,
|
|
3248
|
+
panelPadding,
|
|
3249
|
+
panelRadius,
|
|
3250
|
+
groupGap,
|
|
3251
|
+
triggerColor,
|
|
3252
|
+
triggerHoverColor,
|
|
3253
|
+
closeColor,
|
|
3254
|
+
closeHoverColor,
|
|
3255
|
+
panelColor,
|
|
3256
|
+
textColor,
|
|
3257
|
+
textHoverColor,
|
|
3258
|
+
overlayColor,
|
|
3259
|
+
} = settings;
|
|
3260
|
+
const items = useMemo(() => content ?? [], [content]);
|
|
3261
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
3262
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
3263
|
+
const overlayRef = useRef<HTMLDivElement>(null);
|
|
3264
|
+
const closeRef = useRef<HTMLButtonElement>(null);
|
|
3265
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
3266
|
+
const inlineLayerRef = useRef<HTMLDivElement>(null);
|
|
3267
|
+
const shownMediaRef = useRef<string | null>(null);
|
|
3268
|
+
const [isUserOpen, setIsUserOpen] = useState(false);
|
|
3269
|
+
const [isOverlayMounted, setIsOverlayMounted] = useState(false);
|
|
3270
|
+
const [isOverlayActive, setIsOverlayActive] = useState(false);
|
|
3271
|
+
const [isOverlaySettled, setIsOverlaySettled] = useState(false);
|
|
3272
|
+
const [activeIndex, setActiveIndex] = useState<number | null>(null);
|
|
3273
|
+
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
3274
|
+
const [mountedRows, setMountedRows] = useState<Set<number>>(() => new Set());
|
|
3275
|
+
const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
|
|
3276
|
+
const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
|
|
3277
|
+
const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
|
|
3278
|
+
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
3279
|
+
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
3280
|
+
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
3281
|
+
const [isMediaCut, setIsMediaCut] = useState(false);
|
|
3282
|
+
|
|
3283
|
+
const isEditorCanvas = isEditor && !isPreviewMode;
|
|
3284
|
+
const isInteractive = !isEditorCanvas;
|
|
3285
|
+
const isInline = type === 'a';
|
|
3286
|
+
const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
|
|
3287
|
+
const isOpen = !isInline && (isOpenPinned || ((isInteractive || isEditMode) && isUserOpen));
|
|
3288
|
+
const isListShown = isInteractive && (isInline || isOpen);
|
|
3289
|
+
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
3290
|
+
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
3291
|
+
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition];
|
|
3292
|
+
const columnWidths = resolveColumnWidths(settings);
|
|
3293
|
+
const titleKeys = TITLE_KEYS.slice(0, columns - 1);
|
|
3294
|
+
const hasGroupColumn = columns > 1;
|
|
3295
|
+
const groups = useMemo<ChroniclesGroup[]>(() => (
|
|
3296
|
+
hasGroupColumn ? groupRows(items) : [{ label: '', rows: items.map((item, index) => ({ item, index })) }]
|
|
3297
|
+
), [items, hasGroupColumn]);
|
|
3298
|
+
|
|
3299
|
+
const activeMedia = activeIndex === null ? [] : getRowMedia(items[activeIndex]);
|
|
3300
|
+
const shownAsset = activeMedia[activeMediaIndex];
|
|
3301
|
+
const shownMedia = activeIndex !== null && shownAsset ? getMediaKey(activeIndex, activeMediaIndex, shownAsset.assetId) : null;
|
|
3302
|
+
const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
|
|
3303
|
+
|
|
3304
|
+
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
3305
|
+
|
|
3306
|
+
useEffect(() => {
|
|
3307
|
+
if (isEditorCanvas && !isEditMode) setIsUserOpen(false);
|
|
3308
|
+
}, [isEditorCanvas, isEditMode]);
|
|
3309
|
+
|
|
3310
|
+
useEffect(() => {
|
|
3311
|
+
if (isOpen) {
|
|
3312
|
+
setLayoutStyle(getLayoutStyle(wrapperRef.current));
|
|
3313
|
+
setIsOverlayMounted(true);
|
|
3314
|
+
return;
|
|
3315
|
+
}
|
|
3316
|
+
setIsOverlayActive(false);
|
|
3317
|
+
setActiveIndex(null);
|
|
3318
|
+
const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
|
|
3319
|
+
return () => window.clearTimeout(timer);
|
|
3320
|
+
}, [isOpen]);
|
|
3321
|
+
|
|
3322
|
+
useEffect(() => {
|
|
3323
|
+
if (!isOpen || !isOverlayMounted) return;
|
|
3324
|
+
overlayRef.current?.getBoundingClientRect();
|
|
3325
|
+
const frame = requestAnimationFrame(() => setIsOverlayActive(true));
|
|
3326
|
+
return () => cancelAnimationFrame(frame);
|
|
3327
|
+
}, [isOpen, isOverlayMounted]);
|
|
3328
|
+
|
|
3329
|
+
useEffect(() => {
|
|
3330
|
+
if (!isOverlayActive) {
|
|
3331
|
+
setIsOverlaySettled(false);
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
|
|
3335
|
+
return () => window.clearTimeout(timer);
|
|
3336
|
+
}, [isOverlayActive]);
|
|
3337
|
+
|
|
3338
|
+
const updateClosePosition = useCallback(() => {
|
|
3339
|
+
const trigger = triggerRef.current;
|
|
3340
|
+
const overlay = overlayRef.current;
|
|
3341
|
+
if (!trigger || !overlay) return;
|
|
3342
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
3343
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
3344
|
+
setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
|
|
3345
|
+
}, []);
|
|
3346
|
+
|
|
3347
|
+
const isLayerMounted = isOverlayMounted || (isInline && mountedRows.size > 0);
|
|
3348
|
+
useEffect(() => {
|
|
3349
|
+
const wrapper = wrapperRef.current;
|
|
3350
|
+
if (!isLayerMounted || !wrapper || typeof ResizeObserver === 'undefined') return;
|
|
3351
|
+
const update = () => setLayoutStyle((prev) => {
|
|
3352
|
+
const next = getLayoutStyle(wrapper);
|
|
3353
|
+
const isSame = LIGHTBOX_CSS_VARS.every((name) => (prev as Record<string, unknown>)[name] === (next as Record<string, unknown>)[name]);
|
|
3354
|
+
return isSame ? prev : next;
|
|
3355
|
+
});
|
|
3356
|
+
const observer = new ResizeObserver(update);
|
|
3357
|
+
observer.observe(wrapper);
|
|
3358
|
+
const layoutContainer = findLayoutContainer(wrapper);
|
|
3359
|
+
if (layoutContainer && layoutContainer !== wrapper) observer.observe(layoutContainer);
|
|
3360
|
+
return () => observer.disconnect();
|
|
3361
|
+
}, [isLayerMounted]);
|
|
3362
|
+
|
|
3363
|
+
useLayoutEffect(() => {
|
|
3364
|
+
if (!isOverlayMounted) return;
|
|
3365
|
+
updateClosePosition();
|
|
3366
|
+
window.addEventListener('resize', updateClosePosition);
|
|
3367
|
+
return () => window.removeEventListener('resize', updateClosePosition);
|
|
3368
|
+
}, [isOverlayMounted, layoutStyle, updateClosePosition]);
|
|
3369
|
+
|
|
3370
|
+
useEffect(() => {
|
|
3371
|
+
if (!isOpen || !isInteractive) return;
|
|
3372
|
+
closeRef.current?.focus({ preventScroll: true });
|
|
3373
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
3374
|
+
if (event.key !== 'Escape') return;
|
|
3375
|
+
setIsUserOpen(false);
|
|
3376
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
3377
|
+
};
|
|
3378
|
+
document.addEventListener('keydown', onKeyDown);
|
|
3379
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
3380
|
+
}, [isOpen, isInteractive]);
|
|
3381
|
+
|
|
3382
|
+
useLayoutEffect(() => {
|
|
3383
|
+
if (!isInline || activeIndex === null) return;
|
|
3384
|
+
const panelEl = panelRef.current;
|
|
3385
|
+
const layer = inlineLayerRef.current;
|
|
3386
|
+
if (!panelEl || !layer) return;
|
|
3387
|
+
const panelRect = panelEl.getBoundingClientRect();
|
|
3388
|
+
const layerRect = layer.getBoundingClientRect();
|
|
3389
|
+
setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
|
|
3390
|
+
}, [isInline, activeIndex]);
|
|
3391
|
+
|
|
3392
|
+
useEffect(() => {
|
|
3393
|
+
if (activeIndex !== null) return;
|
|
3394
|
+
const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
|
|
3395
|
+
return () => window.clearTimeout(timer);
|
|
3396
|
+
}, [activeIndex]);
|
|
3397
|
+
|
|
3398
|
+
const isCopyShown = copyRect !== null;
|
|
3399
|
+
useEffect(() => {
|
|
3400
|
+
if (!isInline || !isCopyShown) return;
|
|
3401
|
+
const cut = () => {
|
|
3402
|
+
setIsMediaCut(true);
|
|
3403
|
+
setActiveIndex(null);
|
|
3404
|
+
setCopyRect(null);
|
|
3405
|
+
};
|
|
3406
|
+
document.addEventListener('scroll', cut, { capture: true, passive: true });
|
|
3407
|
+
window.addEventListener('resize', cut);
|
|
3408
|
+
return () => {
|
|
3409
|
+
document.removeEventListener('scroll', cut, { capture: true });
|
|
3410
|
+
window.removeEventListener('resize', cut);
|
|
3411
|
+
};
|
|
3412
|
+
}, [isInline, isCopyShown]);
|
|
3413
|
+
|
|
3414
|
+
useEffect(() => {
|
|
3415
|
+
if (!isListShown) return;
|
|
3416
|
+
items.forEach((item) => getRowMedia(item).forEach((media) => {
|
|
3417
|
+
if (!isVideoMedia(media)) new Image().src = media.assetId;
|
|
3418
|
+
}));
|
|
3419
|
+
}, [isListShown, items]);
|
|
3420
|
+
|
|
3421
|
+
useEffect(() => {
|
|
3422
|
+
if (activeMedia.length < 2) return;
|
|
3423
|
+
const timer = window.setInterval(() => {
|
|
3424
|
+
setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
|
|
3425
|
+
}, hoverInterval);
|
|
3426
|
+
return () => window.clearInterval(timer);
|
|
3427
|
+
}, [activeIndex, activeMedia.length, hoverInterval]);
|
|
3428
|
+
|
|
3429
|
+
useLayoutEffect(() => {
|
|
3430
|
+
const previous = shownMediaRef.current;
|
|
3431
|
+
shownMediaRef.current = shownMedia;
|
|
3432
|
+
if (shownMedia === null) return;
|
|
3433
|
+
setLastShownMedia(shownMedia);
|
|
3434
|
+
setCoveredMedia(previous);
|
|
3435
|
+
}, [shownMedia]);
|
|
3436
|
+
|
|
3437
|
+
useEffect(() => {
|
|
3438
|
+
if (!isShownMediaLoaded || coveredMedia === null) return;
|
|
3439
|
+
const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
|
|
3440
|
+
return () => window.clearTimeout(timer);
|
|
3441
|
+
}, [isShownMediaLoaded, coveredMedia]);
|
|
3442
|
+
|
|
3443
|
+
const close = () => {
|
|
3444
|
+
if (!isInteractive) return;
|
|
3445
|
+
setIsUserOpen(false);
|
|
3446
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
3447
|
+
};
|
|
3448
|
+
|
|
3449
|
+
const showRowMedia = (index: number) => {
|
|
3450
|
+
if (!isInteractive || getRowMedia(items[index]).length === 0) {
|
|
3451
|
+
setActiveIndex(null);
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
3454
|
+
setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
|
|
3455
|
+
if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
|
|
3456
|
+
if (activeIndex !== index) setActiveMediaIndex(0);
|
|
3457
|
+
setIsMediaCut(false);
|
|
3458
|
+
setActiveIndex(index);
|
|
3459
|
+
};
|
|
3460
|
+
|
|
3461
|
+
const hideRowMedia = (index: number) => {
|
|
3462
|
+
setActiveIndex((current) => (current === index ? null : current));
|
|
3463
|
+
};
|
|
3464
|
+
|
|
3465
|
+
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
3466
|
+
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
3467
|
+
event.preventDefault();
|
|
3468
|
+
}
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3471
|
+
const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
|
|
3472
|
+
const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
|
|
3473
|
+
omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
|
|
3474
|
+
));
|
|
3475
|
+
const labelLineHeight = columnTypographyCss[0].lineHeight;
|
|
3476
|
+
const titleLineHeight = columnTypographyCss[1]?.lineHeight;
|
|
3477
|
+
const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
|
|
3478
|
+
? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
|
|
3479
|
+
: undefined;
|
|
3480
|
+
|
|
3481
|
+
const colorVars = buildColorVars(P, {
|
|
3482
|
+
triggerColor,
|
|
3483
|
+
triggerHoverColor,
|
|
3484
|
+
closeColor,
|
|
3485
|
+
closeHoverColor,
|
|
3486
|
+
panelColor,
|
|
3487
|
+
textColor,
|
|
3488
|
+
textHoverColor,
|
|
3489
|
+
overlayColor,
|
|
3490
|
+
}, COLOR_VAR_MAP, []);
|
|
3491
|
+
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
3492
|
+
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
3493
|
+
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
3494
|
+
|
|
3495
|
+
const mediaLayer = (
|
|
3496
|
+
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
3497
|
+
{[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
|
|
3498
|
+
const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
|
|
3499
|
+
return (
|
|
3500
|
+
<ChroniclesMediaItem
|
|
3501
|
+
key={mediaKey}
|
|
3502
|
+
P={P}
|
|
3503
|
+
media={media}
|
|
3504
|
+
isVisible={mediaKey === shownMedia}
|
|
3505
|
+
isLoaded={loadedMedia.has(mediaKey)}
|
|
3506
|
+
isCovered={mediaKey === coveredMedia}
|
|
3507
|
+
isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
|
|
3508
|
+
onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
|
|
3509
|
+
/>
|
|
3510
|
+
);
|
|
3511
|
+
}))}
|
|
3512
|
+
</div>
|
|
3513
|
+
);
|
|
3514
|
+
|
|
3515
|
+
const renderPanel = (isCopy: boolean) => {
|
|
3516
|
+
const showControls = !isCopy && showPanelControls;
|
|
3517
|
+
return (
|
|
3518
|
+
<div
|
|
3519
|
+
ref={isCopy ? undefined : panelRef}
|
|
3520
|
+
className={cn(
|
|
3521
|
+
\`\${P}-panel\`,
|
|
3522
|
+
isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
|
|
3523
|
+
isInline && \`\${P}-panel-inline\`,
|
|
3524
|
+
isCopy && \`\${P}-panel-copy\`,
|
|
3525
|
+
)}
|
|
3526
|
+
style={{
|
|
3527
|
+
width: scaled(panelWidth),
|
|
3528
|
+
paddingTop: scaled(panelPadding.top),
|
|
3529
|
+
paddingRight: scaled(panelPadding.right),
|
|
3530
|
+
paddingBottom: scaled(panelPadding.bottom),
|
|
3531
|
+
paddingLeft: scaled(panelPadding.left),
|
|
3532
|
+
borderRadius: scaled(panelRadius),
|
|
3533
|
+
[\`--\${P}-group-gap\`]: scaled(groupGap),
|
|
3534
|
+
[\`--\${P}-panel-x\`]: panelOffset.x,
|
|
3535
|
+
[\`--\${P}-panel-y\`]: panelOffset.y,
|
|
3536
|
+
[\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
|
|
3537
|
+
[\`--\${P}-column-gap\`]: scaled(columnGap),
|
|
3538
|
+
...(isCopy && copyRect),
|
|
3539
|
+
} as CSSProperties}
|
|
3540
|
+
data-lightbox-scrollable={isInline ? undefined : ''}
|
|
3541
|
+
aria-hidden={isCopy || undefined}
|
|
3542
|
+
onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
|
|
3543
|
+
onClickCapture={isCopy ? undefined : onPanelClickCapture}
|
|
3544
|
+
>
|
|
3545
|
+
{showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
|
|
3546
|
+
{showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
|
|
3547
|
+
{groups.map((group, groupIndex) => (
|
|
3548
|
+
<Fragment key={groupIndex}>
|
|
3549
|
+
{showControls && groupIndex > 0 && (
|
|
3550
|
+
<div
|
|
3551
|
+
data-controls="groupGap"
|
|
3552
|
+
data-controls-paired=""
|
|
3553
|
+
data-controls-axis="y"
|
|
3554
|
+
data-controls-reverse=""
|
|
3555
|
+
data-controls-min="0"
|
|
3556
|
+
className={\`\${P}-control-anchor\`}
|
|
3557
|
+
style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
|
|
3558
|
+
/>
|
|
3559
|
+
)}
|
|
3560
|
+
<div
|
|
3561
|
+
className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
|
|
3562
|
+
style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
|
|
3563
|
+
>
|
|
3564
|
+
{hasGroupColumn && (
|
|
3565
|
+
<span
|
|
3566
|
+
className={\`\${P}-group-label\`}
|
|
3567
|
+
style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
|
|
3568
|
+
>
|
|
3569
|
+
{group.label}
|
|
3570
|
+
</span>
|
|
3571
|
+
)}
|
|
3572
|
+
{group.rows.map(({ item, index }) => {
|
|
3573
|
+
const rowLink = !isCopy && item.link?.value ? item.link : undefined;
|
|
3574
|
+
const RowElement = rowLink ? 'a' : 'div';
|
|
3575
|
+
const linkProps = rowLink ? {
|
|
3576
|
+
href: buildValidUrl(rowLink.value),
|
|
3577
|
+
...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
|
|
3578
|
+
} : {};
|
|
3579
|
+
const isFocusable = !rowLink && isInteractive && getRowMedia(item).length > 0;
|
|
3580
|
+
const hoverProps = isCopy ? {} : {
|
|
3581
|
+
tabIndex: isFocusable ? 0 : undefined,
|
|
3582
|
+
onMouseEnter: () => showRowMedia(index),
|
|
3583
|
+
onMouseLeave: () => hideRowMedia(index),
|
|
3584
|
+
onFocus: () => showRowMedia(index),
|
|
3585
|
+
onBlur: () => hideRowMedia(index),
|
|
3586
|
+
};
|
|
3587
|
+
return (
|
|
3588
|
+
<RowElement
|
|
3589
|
+
key={index}
|
|
3590
|
+
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
3591
|
+
{...linkProps}
|
|
3592
|
+
{...hoverProps}
|
|
3593
|
+
>
|
|
3594
|
+
{!hasGroupColumn && (
|
|
3595
|
+
<div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
|
|
3596
|
+
)}
|
|
3597
|
+
{titleKeys.map((key, titleIndex) => (
|
|
3598
|
+
<div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
|
|
3599
|
+
))}
|
|
3600
|
+
</RowElement>
|
|
3601
|
+
);
|
|
3602
|
+
})}
|
|
3603
|
+
</div>
|
|
3604
|
+
</Fragment>
|
|
3605
|
+
))}
|
|
3606
|
+
</div>
|
|
3607
|
+
);
|
|
3608
|
+
};
|
|
3609
|
+
|
|
3610
|
+
const overlay = isOverlayMounted && !isInline ? (
|
|
3611
|
+
<div
|
|
3612
|
+
ref={overlayRef}
|
|
3613
|
+
className={cn(
|
|
3614
|
+
\`\${P}-overlay\`,
|
|
3615
|
+
isEditor && \`\${P}-overlay-editor\`,
|
|
3616
|
+
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
3617
|
+
isOverlayActive && \`\${P}-overlay-active\`,
|
|
3618
|
+
interactiveClass,
|
|
3619
|
+
stateClass,
|
|
3620
|
+
)}
|
|
3621
|
+
style={{ ...colorVars, ...layoutStyle }}
|
|
3622
|
+
role="dialog"
|
|
3623
|
+
aria-modal="true"
|
|
3624
|
+
aria-label={triggerLabel}
|
|
3625
|
+
data-selection="none"
|
|
3626
|
+
>
|
|
3627
|
+
<div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
|
|
3628
|
+
{mediaLayer}
|
|
3629
|
+
<button
|
|
3630
|
+
ref={closeRef}
|
|
3631
|
+
type="button"
|
|
3632
|
+
className={\`\${P}-close\`}
|
|
3633
|
+
style={{
|
|
3634
|
+
...triggerTypographyCss,
|
|
3635
|
+
top: closePosition?.top ?? 0,
|
|
3636
|
+
left: closePosition?.left ?? 0,
|
|
3637
|
+
visibility: closePosition ? 'visible' : 'hidden',
|
|
3638
|
+
}}
|
|
3639
|
+
onClick={close}
|
|
3640
|
+
>
|
|
3641
|
+
{closeLabel}
|
|
3642
|
+
</button>
|
|
3643
|
+
{renderPanel(false)}
|
|
3644
|
+
</div>
|
|
3645
|
+
) : null;
|
|
3646
|
+
|
|
3647
|
+
const inlineLayer = isInline && mountedRows.size > 0 ? (
|
|
3648
|
+
<div
|
|
3649
|
+
ref={inlineLayerRef}
|
|
3650
|
+
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
|
|
3651
|
+
style={{ ...colorVars, ...layoutStyle }}
|
|
3652
|
+
aria-hidden="true"
|
|
3653
|
+
data-selection="none"
|
|
3654
|
+
>
|
|
3655
|
+
{mediaLayer}
|
|
3656
|
+
{copyRect && renderPanel(true)}
|
|
3657
|
+
</div>
|
|
3658
|
+
) : null;
|
|
3659
|
+
const portalContent = overlay ?? inlineLayer;
|
|
3660
|
+
|
|
3661
|
+
return (
|
|
3662
|
+
<>
|
|
3663
|
+
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
3664
|
+
<div
|
|
3665
|
+
ref={wrapperRef}
|
|
3666
|
+
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
|
|
3667
|
+
style={colorVars}
|
|
3668
|
+
>
|
|
3669
|
+
{isInline ? renderPanel(false) : (
|
|
3670
|
+
<button
|
|
3671
|
+
ref={triggerRef}
|
|
3672
|
+
type="button"
|
|
3673
|
+
className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
|
|
3674
|
+
style={triggerTypographyCss}
|
|
3675
|
+
aria-haspopup="dialog"
|
|
3676
|
+
aria-expanded={isOpen}
|
|
3677
|
+
onClick={() => {
|
|
3678
|
+
if (isInteractive) setIsUserOpen(true);
|
|
3679
|
+
}}
|
|
3680
|
+
>
|
|
3681
|
+
{triggerLabel}
|
|
3682
|
+
</button>
|
|
3683
|
+
)}
|
|
3684
|
+
</div>
|
|
3685
|
+
{portalContent && typeof document !== 'undefined' && createPortal(
|
|
3686
|
+
portalContent,
|
|
3687
|
+
(portalId ? document.getElementById(portalId) : null) ?? document.body,
|
|
3688
|
+
)}
|
|
3689
|
+
</>
|
|
3690
|
+
);
|
|
3691
|
+
}
|
|
3692
|
+
`,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2687
3693
|
import { CommonComponentProps } from '../props';
|
|
2688
3694
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
2689
3695
|
|
|
@@ -3212,7 +4218,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3212
4218
|
</>
|
|
3213
4219
|
);
|
|
3214
4220
|
}
|
|
3215
|
-
`,
|
|
4221
|
+
`,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3216
4222
|
import cn from 'classnames';
|
|
3217
4223
|
import { CommonComponentProps } from '../props';
|
|
3218
4224
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -3960,7 +4966,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
3960
4966
|
</>
|
|
3961
4967
|
);
|
|
3962
4968
|
}
|
|
3963
|
-
`,
|
|
4969
|
+
`,r=`import React, { useMemo, useState } from 'react';
|
|
3964
4970
|
import { CommonComponentProps } from '../props';
|
|
3965
4971
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
3966
4972
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -4598,7 +5604,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
4598
5604
|
};
|
|
4599
5605
|
|
|
4600
5606
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
4601
|
-
`,
|
|
5607
|
+
`,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
4602
5608
|
import '@splidejs/react-splide/css/core';
|
|
4603
5609
|
import { CommonComponentProps } from '../props';
|
|
4604
5610
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -6913,7 +7919,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
6913
7919
|
};
|
|
6914
7920
|
|
|
6915
7921
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
6916
|
-
`,
|
|
7922
|
+
`,s=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
6917
7923
|
import { CommonComponentProps } from '../props';
|
|
6918
7924
|
import { scalingValue } from '../utils/scalingValue';
|
|
6919
7925
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -7486,7 +8492,7 @@ export function Helix({
|
|
|
7486
8492
|
</>
|
|
7487
8493
|
);
|
|
7488
8494
|
}
|
|
7489
|
-
`,
|
|
8495
|
+
`,l=`import { CommonComponentProps } from '../props';
|
|
7490
8496
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7491
8497
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7492
8498
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -9938,7 +10944,7 @@ export function Hive({
|
|
|
9938
10944
|
</>
|
|
9939
10945
|
);
|
|
9940
10946
|
}
|
|
9941
|
-
`,
|
|
10947
|
+
`,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
9942
10948
|
import { createPortal } from 'react-dom';
|
|
9943
10949
|
import { CommonComponentProps } from '../props';
|
|
9944
10950
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -10703,7 +11709,7 @@ export type LightboxJournalSettings = {
|
|
|
10703
11709
|
closeIconColor: string;
|
|
10704
11710
|
closeIconHoverColor: string;
|
|
10705
11711
|
};
|
|
10706
|
-
`,
|
|
11712
|
+
`,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
10707
11713
|
import { createPortal } from 'react-dom';
|
|
10708
11714
|
import { CommonComponentProps } from '../props';
|
|
10709
11715
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11249,7 +12255,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
11249
12255
|
</>
|
|
11250
12256
|
);
|
|
11251
12257
|
};
|
|
11252
|
-
`,
|
|
12258
|
+
`,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
11253
12259
|
import { createPortal } from 'react-dom';
|
|
11254
12260
|
import { CommonComponentProps } from '../props';
|
|
11255
12261
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -14354,7 +15360,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
14354
15360
|
</>
|
|
14355
15361
|
);
|
|
14356
15362
|
}
|
|
14357
|
-
`,
|
|
15363
|
+
`,g=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
14358
15364
|
import cn from 'classnames';
|
|
14359
15365
|
import { CommonComponentProps } from '../props';
|
|
14360
15366
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15212,7 +16218,7 @@ type MarqueeProps = {
|
|
|
15212
16218
|
isPreviewMode?: boolean;
|
|
15213
16219
|
isEditMode?: boolean;
|
|
15214
16220
|
} & CommonComponentProps;
|
|
15215
|
-
`,
|
|
16221
|
+
`,m=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
15216
16222
|
import cn from 'classnames';
|
|
15217
16223
|
import { CommonComponentProps } from '../props';
|
|
15218
16224
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16155,7 +17161,7 @@ type MarqueeTextProps = {
|
|
|
16155
17161
|
isPreviewMode?: boolean;
|
|
16156
17162
|
isEditMode?: boolean;
|
|
16157
17163
|
} & CommonComponentProps;
|
|
16158
|
-
`,
|
|
17164
|
+
`,p=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
16159
17165
|
import { createPortal } from 'react-dom';
|
|
16160
17166
|
import type React from 'react';
|
|
16161
17167
|
import { CommonComponentProps } from '../props';
|
|
@@ -18637,7 +19643,7 @@ export function Mercury({
|
|
|
18637
19643
|
</>
|
|
18638
19644
|
);
|
|
18639
19645
|
}
|
|
18640
|
-
`,
|
|
19646
|
+
`,h=`import React, { useMemo, useState } from 'react';
|
|
18641
19647
|
import { CommonComponentProps } from '../props';
|
|
18642
19648
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
18643
19649
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -19216,7 +20222,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
19216
20222
|
};
|
|
19217
20223
|
|
|
19218
20224
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
19219
|
-
`,
|
|
20225
|
+
`,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
19220
20226
|
import type React from 'react';
|
|
19221
20227
|
import { CommonComponentProps } from '../props';
|
|
19222
20228
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -20055,7 +21061,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
20055
21061
|
</>
|
|
20056
21062
|
);
|
|
20057
21063
|
}
|
|
20058
|
-
`,
|
|
21064
|
+
`,v=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20059
21065
|
import cn from 'classnames';
|
|
20060
21066
|
import { CommonComponentProps } from '../props';
|
|
20061
21067
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -20683,7 +21689,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20683
21689
|
</>
|
|
20684
21690
|
);
|
|
20685
21691
|
}
|
|
20686
|
-
`,
|
|
21692
|
+
`,P=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
20687
21693
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
20688
21694
|
import { CommonComponentProps } from '../props';
|
|
20689
21695
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -21315,7 +22321,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
21315
22321
|
</>
|
|
21316
22322
|
);
|
|
21317
22323
|
}
|
|
21318
|
-
`,
|
|
22324
|
+
`,x=`import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
21319
22325
|
import cn from 'classnames';
|
|
21320
22326
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
21321
22327
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -22497,7 +23503,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
22497
23503
|
</svg>
|
|
22498
23504
|
);
|
|
22499
23505
|
}
|
|
22500
|
-
`,
|
|
23506
|
+
`,b=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
22501
23507
|
import cn from 'classnames';
|
|
22502
23508
|
import { CommonComponentProps } from '../props';
|
|
22503
23509
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -23128,7 +24134,7 @@ type TestimonialsSettings = {
|
|
|
23128
24134
|
logoHeight: number;
|
|
23129
24135
|
captionMarginTop: number;
|
|
23130
24136
|
};
|
|
23131
|
-
`,
|
|
24137
|
+
`,y=`import cn from 'classnames';
|
|
23132
24138
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23133
24139
|
import { CommonComponentProps } from '../props';
|
|
23134
24140
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -23624,7 +24630,7 @@ type TestimonialsSettings = {
|
|
|
23624
24630
|
icon?: string | null;
|
|
23625
24631
|
};
|
|
23626
24632
|
};
|
|
23627
|
-
`,
|
|
24633
|
+
`,S=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
23628
24634
|
import type React from 'react';
|
|
23629
24635
|
import { createPortal } from 'react-dom';
|
|
23630
24636
|
import { CommonComponentProps } from '../props';
|
|
@@ -24157,4 +25163,4 @@ export function Waterfall({
|
|
|
24157
25163
|
</>
|
|
24158
25164
|
);
|
|
24159
25165
|
}
|
|
24160
|
-
`,
|
|
25166
|
+
`,C={[n.BurgerComponent.id]:e,[n.ChroniclesComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[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;
|