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