@cntrl-site/components 1.0.108 → 1.0.110

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.
Files changed (53) hide show
  1. package/dist/Chronicles-Cy2h3jlZ.mjs +724 -0
  2. package/dist/Chronicles-D0ojQzOP.js +196 -0
  3. package/dist/ChroniclesComponent-FFenN7yL.js +1 -0
  4. package/dist/{PretextComponent-BiS9XbZr.mjs → ChroniclesComponent-cZLqN307.mjs} +853 -425
  5. package/dist/{ClickGallerie-o2U6oyOF.mjs → ClickGallerie-Cjc_1Gxy.mjs} +1 -1
  6. package/dist/{ClickGallerie-CYQMgrIr.js → ClickGallerie-DYbc-rDp.js} +1 -1
  7. package/dist/Components/Chronicles/Chronicles.d.ts +120 -0
  8. package/dist/Components/Chronicles/ChroniclesComponent.d.ts +307 -0
  9. package/dist/Components/utils/buildValidUrl.d.ts +1 -0
  10. package/dist/Components/utils/index.d.ts +1 -0
  11. package/dist/{ControlSlider-Kkec-i14.js → ControlSlider-C8ckUIDm.js} +1 -1
  12. package/dist/{ControlSlider-LcZmviGX.mjs → ControlSlider-DqKfaKMG.mjs} +1 -1
  13. package/dist/{FAQ-CdwSft5p.mjs → FAQ-BS-vO0l-.mjs} +1 -1
  14. package/dist/{FAQ-BxhMo7T8.js → FAQ-Ct0YfqX1.js} +1 -1
  15. package/dist/{Grid-CFHTP3mb.js → Grid-CU1dsdoO.js} +1 -1
  16. package/dist/{Grid-e-gLfsji.mjs → Grid-qbqchSLi.mjs} +1 -1
  17. package/dist/{ImageRevealSlider-Df9sygk9.mjs → ImageRevealSlider-DifEXySR.mjs} +1 -1
  18. package/dist/{ImageRevealSlider-BuukTGAK.js → ImageRevealSlider-DlxudBUy.js} +1 -1
  19. package/dist/{Lightbox-C_fXsfdz.mjs → Lightbox-BY99NS14.mjs} +1 -1
  20. package/dist/{Lightbox-DaunVrkp.js → Lightbox-DZckgBzK.js} +1 -1
  21. package/dist/LinkWrapper-5kQHiGJQ.mjs +10 -0
  22. package/dist/LinkWrapper-CTqM1ucO.js +1 -0
  23. package/dist/{Marquee-DfIP-tIN.js → Marquee-DDKigLBo.js} +1 -1
  24. package/dist/{Marquee-DByooiWP.mjs → Marquee-_xVuf-zp.mjs} +1 -1
  25. package/dist/{MarqueeText-DsUiV6Zv.js → MarqueeText-B5hqB0HA.js} +1 -1
  26. package/dist/{MarqueeText-D6FNCe6P.mjs → MarqueeText-C2E6UDsb.mjs} +1 -1
  27. package/dist/{RichTextRenderer-BptwNpbJ.mjs → RichTextRenderer-D52Xto59.mjs} +1 -1
  28. package/dist/{RichTextRenderer-K90Dd7pt.js → RichTextRenderer-DEFXh5o6.js} +1 -1
  29. package/dist/{Slider20-fMVeRfgx.js → Slider20-BOmjDRf2.js} +1 -1
  30. package/dist/{Slider20-CCzixTiN.mjs → Slider20-DUi6qwnd.mjs} +1 -1
  31. package/dist/{TestimonialGrid-CiCagfBU.js → TestimonialGrid-BHZazEVX.js} +1 -1
  32. package/dist/{TestimonialGrid-CbsVxSn9.mjs → TestimonialGrid-C-8IDzWu.mjs} +1 -1
  33. package/dist/{TestimonialSingle-BWXynGjv.js → TestimonialSingle-BORQom3u.js} +1 -1
  34. package/dist/{TestimonialSingle-BVm3Amrl.mjs → TestimonialSingle-DrnyReim.mjs} +1 -1
  35. package/dist/buildValidUrl-BbtqqeHr.mjs +7 -0
  36. package/dist/buildValidUrl-CtJWFCPi.js +1 -0
  37. package/dist/{components-ljYgHKal.mjs → components-DtO0Ti47.mjs} +18 -17
  38. package/dist/components-f82884Bk.js +1 -0
  39. package/dist/elements.js +1 -1
  40. package/dist/elements.mjs +16 -15
  41. package/dist/elements.node.js +1 -1
  42. package/dist/elements.node.mjs +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/index.mjs +2 -2
  45. package/dist/sources.js +1036 -22
  46. package/dist/sources.mjs +1060 -45
  47. package/dist/utils.js +1 -1
  48. package/dist/utils.mjs +19 -17
  49. package/package.json +1 -1
  50. package/dist/LinkWrapper-Ca84iPtg.js +0 -1
  51. package/dist/LinkWrapper-DZs9hlOn.mjs +0 -13
  52. package/dist/PretextComponent-DWOy-dqD.js +0 -1
  53. 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("./PretextComponent-DWOy-dqD.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-FFenN7yL.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,1021 @@ 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
+ portalId?: string;
2822
+ } & CommonComponentProps;
2823
+
2824
+ function getColumnsSpace({ columns, columnGap, panelWidth, panelPadding }: ColumnLayoutSettings): number {
2825
+ return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - (columns - 1) * columnGap);
2826
+ }
2827
+
2828
+ export function getChroniclesEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ColumnWidthKey, number>> {
2829
+ const width = getColumnsSpace(settings) / settings.columns;
2830
+ return Object.fromEntries(CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => [key, width]));
2831
+ }
2832
+
2833
+ export function applyChroniclesColumnCountChange(
2834
+ nextSettings: Record<string, any>,
2835
+ prevSettings: Record<string, any>,
2836
+ ): Record<string, any> {
2837
+ if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
2838
+ return nextSettings;
2839
+ }
2840
+ return { ...nextSettings, ...getChroniclesEqualColumnWidths({ ...prevSettings, ...nextSettings } as ColumnLayoutSettings) };
2841
+ }
2842
+
2843
+ function resolveColumnWidths(settings: ColumnLayoutSettings): number[] {
2844
+ const space = getColumnsSpace(settings);
2845
+ const sized = CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => {
2846
+ const width = settings[key];
2847
+ return typeof width === 'number' ? Math.max(0, width) : space / settings.columns;
2848
+ });
2849
+ const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
2850
+ const scale = sizedTotal > space ? space / sizedTotal : 1;
2851
+ return [...sized.map((width) => width * scale), Math.max(0, space - sizedTotal * scale)];
2852
+ }
2853
+
2854
+ function getGridTemplateColumns(widths: number[]): string {
2855
+ const total = widths.reduce((sum, width) => sum + width, 0);
2856
+ return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
2857
+ }
2858
+
2859
+ // A row with an empty group continues the group above it.
2860
+ function groupRows(items: ChroniclesItem[]): ChroniclesGroup[] {
2861
+ const groups: ChroniclesGroup[] = [];
2862
+ items.forEach((item, index) => {
2863
+ const label = item.group?.trim() ?? '';
2864
+ const current = groups[groups.length - 1];
2865
+ if (!current || (label !== '' && label !== current.label)) {
2866
+ groups.push({ label, rows: [{ item, index }] });
2867
+ return;
2868
+ }
2869
+ current.rows.push({ item, index });
2870
+ });
2871
+ return groups;
2872
+ }
2873
+
2874
+ function getRowMedia(item: ChroniclesItem | undefined): ChroniclesMedia[] {
2875
+ return (item?.image ?? []).filter((media) => Boolean(media?.assetId));
2876
+ }
2877
+
2878
+ function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
2879
+ return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
2880
+ }
2881
+
2882
+ function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
2883
+ if (type) return type === 'video';
2884
+ return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
2885
+ }
2886
+
2887
+ // The element that sets the article variables rather than one that inherits them, so it can be watched for
2888
+ // their changes: the editor sets them on its page container when the layout changes.
2889
+ function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
2890
+ const width = element ? getComputedStyle(element).getPropertyValue('--cntrl-article-width').trim() : '';
2891
+ if (!width) return element;
2892
+ let container = element!;
2893
+ for (let el = container.parentElement; el; el = el.parentElement) {
2894
+ if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim() !== width) break;
2895
+ container = el;
2896
+ }
2897
+ return container;
2898
+ }
2899
+
2900
+ function getLayoutStyle(container: HTMLElement | null): CSSProperties {
2901
+ const layoutContainer = findLayoutContainer(container);
2902
+ if (!layoutContainer) return {};
2903
+ const computed = getComputedStyle(layoutContainer);
2904
+ return Object.fromEntries(
2905
+ LIGHTBOX_CSS_VARS
2906
+ .map((name) => [name, computed.getPropertyValue(name).trim()])
2907
+ .filter(([, value]) => value),
2908
+ );
2909
+ }
2910
+
2911
+ function resolveTextStyle(settings: ChroniclesSettings, prefix: TextStylePrefix): TextStyles {
2912
+ const read = <Key extends keyof TextStyleFields>(key: Key) => (
2913
+ (settings as Record<string, unknown>)[\`\${prefix}\${key}\`] as TextStyleFields[Key]
2914
+ );
2915
+ return {
2916
+ fontSettings: { fontFamily: read('FontFamily'), ...read('FontSettings') },
2917
+ fontSize: read('FontSize'),
2918
+ lineHeight: read('LineHeight'),
2919
+ letterSpacing: read('LetterSpacing'),
2920
+ wordSpacing: read('WordSpacing'),
2921
+ textAlign: read('TextAlign'),
2922
+ textAppearance: read('TextAppearance'),
2923
+ color: '#000000',
2924
+ };
2925
+ }
2926
+
2927
+ function getCSS(P: string): string {
2928
+ return \`
2929
+ .\${P}-trigger,
2930
+ .\${P}-close {
2931
+ display: inline-block;
2932
+ margin: 0;
2933
+ padding: 0;
2934
+ border: 0;
2935
+ background: none;
2936
+ cursor: pointer;
2937
+ white-space: nowrap;
2938
+ transition: color 150ms ease;
2939
+ -webkit-appearance: none;
2940
+ appearance: none;
2941
+ -webkit-tap-highlight-color: transparent;
2942
+ }
2943
+ .\${P}-trigger {
2944
+ color: var(--\${P}-trigger-color);
2945
+ transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
2946
+ }
2947
+ .\${P}-trigger-hidden {
2948
+ opacity: 0;
2949
+ }
2950
+ .\${P}-close {
2951
+ position: absolute;
2952
+ z-index: 2;
2953
+ color: var(--\${P}-close-color);
2954
+ }
2955
+ .\${P}-trigger:focus,
2956
+ .\${P}-close:focus {
2957
+ outline: none;
2958
+ }
2959
+ .\${P}-trigger:focus-visible,
2960
+ .\${P}-close:focus-visible {
2961
+ outline: 1px solid currentColor;
2962
+ outline-offset: 2px;
2963
+ }
2964
+ .\${P}-interactive .\${P}-trigger:hover {
2965
+ color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
2966
+ }
2967
+ .\${P}-close:hover {
2968
+ color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
2969
+ }
2970
+ .\${P}-editor .\${P}-trigger {
2971
+ cursor: default;
2972
+ }
2973
+ .\${P}-overlay {
2974
+ position: fixed;
2975
+ inset: 0;
2976
+ z-index: 9997;
2977
+ overflow: hidden;
2978
+ overscroll-behavior: none;
2979
+ opacity: 0;
2980
+ pointer-events: none;
2981
+ transition: opacity \${OVERLAY_ANIM_MS}ms ease;
2982
+ }
2983
+ .\${P}-inline-layer {
2984
+ position: fixed;
2985
+ inset: 0;
2986
+ z-index: 9997;
2987
+ overflow: hidden;
2988
+ pointer-events: none;
2989
+ }
2990
+ .\${P}-overlay-editor {
2991
+ inset: auto;
2992
+ top: var(--cntrl-article-top, 0);
2993
+ left: var(--cntrl-article-left, 0);
2994
+ width: var(--cntrl-article-width, 100vw) !important;
2995
+ height: var(--cntrl-viewport-height, 100vh) !important;
2996
+ }
2997
+ .\${P}-overlay-edit-mode {
2998
+ z-index: 1;
2999
+ }
3000
+ .\${P}-overlay-active {
3001
+ opacity: 1;
3002
+ pointer-events: auto;
3003
+ }
3004
+ .\${P}-backdrop {
3005
+ position: absolute;
3006
+ inset: 0;
3007
+ background-color: var(--\${P}-overlay-color);
3008
+ }
3009
+ .\${P}-media-layer {
3010
+ position: absolute;
3011
+ inset: 0;
3012
+ pointer-events: none;
3013
+ }
3014
+ .\${P}-media {
3015
+ position: absolute;
3016
+ inset: 0;
3017
+ width: 100%;
3018
+ height: 100%;
3019
+ object-fit: cover;
3020
+ opacity: 0;
3021
+ }
3022
+ .\${P}-media-contain {
3023
+ object-fit: contain;
3024
+ }
3025
+ .\${P}-media-visible,
3026
+ .\${P}-media-fading {
3027
+ transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
3028
+ }
3029
+ .\${P}-media-visible {
3030
+ z-index: 1;
3031
+ opacity: 1;
3032
+ }
3033
+ .\${P}-media-covered {
3034
+ opacity: 1;
3035
+ }
3036
+ .\${P}-media-fading {
3037
+ opacity: 0;
3038
+ }
3039
+ .\${P}-media-layer-instant .\${P}-media {
3040
+ transition: none;
3041
+ }
3042
+ .\${P}-panel {
3043
+ position: absolute;
3044
+ top: var(--\${P}-panel-y);
3045
+ left: var(--\${P}-panel-x);
3046
+ z-index: 1;
3047
+ box-sizing: border-box;
3048
+ max-width: 100%;
3049
+ max-height: 100%;
3050
+ overflow-y: auto;
3051
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
3052
+ background-color: var(--\${P}-panel-color);
3053
+ color: var(--\${P}-text-color);
3054
+ overscroll-behavior: contain;
3055
+ transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
3056
+ }
3057
+ .\${P}-overlay-active .\${P}-panel {
3058
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
3059
+ }
3060
+ .\${P}-panel-settled {
3061
+ transition: none;
3062
+ }
3063
+ .\${P}-panel-inline {
3064
+ position: relative;
3065
+ top: auto;
3066
+ left: auto;
3067
+ max-height: none;
3068
+ transform: none;
3069
+ transition: none;
3070
+ }
3071
+ .\${P}-panel-copy {
3072
+ position: absolute;
3073
+ pointer-events: none;
3074
+ }
3075
+ @media (prefers-reduced-motion: reduce) {
3076
+ .\${P}-panel {
3077
+ transition: none;
3078
+ }
3079
+ }
3080
+ .\${P}-group {
3081
+ display: grid;
3082
+ grid-template-columns: var(--\${P}-grid-columns);
3083
+ column-gap: var(--\${P}-column-gap);
3084
+ }
3085
+ .\${P}-group ~ .\${P}-group {
3086
+ margin-top: var(--\${P}-group-gap);
3087
+ }
3088
+ .\${P}-group-label {
3089
+ grid-column: 1;
3090
+ align-self: start;
3091
+ min-width: 0;
3092
+ overflow-wrap: anywhere;
3093
+ }
3094
+ .\${P}-row {
3095
+ grid-column: 2 / -1;
3096
+ display: grid;
3097
+ grid-template-columns: subgrid;
3098
+ align-items: baseline;
3099
+ }
3100
+ a.\${P}-row {
3101
+ color: inherit;
3102
+ text-decoration: none;
3103
+ }
3104
+ .\${P}-group-unlabeled .\${P}-row {
3105
+ grid-column: 1 / -1;
3106
+ }
3107
+ .\${P}-title {
3108
+ min-width: 0;
3109
+ overflow-wrap: anywhere;
3110
+ white-space: pre-line;
3111
+ transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
3112
+ }
3113
+ .\${P}-interactive .\${P}-row:hover .\${P}-title,
3114
+ .\${P}-row:focus-visible .\${P}-title,
3115
+ .\${P}-panel-copy .\${P}-row-active .\${P}-title {
3116
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
3117
+ }
3118
+ .\${P}-control-anchor {
3119
+ position: absolute;
3120
+ pointer-events: none;
3121
+ z-index: 2;
3122
+ }
3123
+ \`;
3124
+ }
3125
+
3126
+ type ChroniclesMediaItemProps = {
3127
+ P: string;
3128
+ media: ChroniclesMedia;
3129
+ isVisible: boolean;
3130
+ isLoaded: boolean;
3131
+ isCovered: boolean;
3132
+ isFading: boolean;
3133
+ onLoad: () => void;
3134
+ };
3135
+
3136
+ function ChroniclesMediaItem({ P, media, isVisible, isLoaded, isCovered, isFading, onLoad }: ChroniclesMediaItemProps) {
3137
+ const videoRef = useRef<HTMLVideoElement>(null);
3138
+ const isVideo = isVideoMedia(media);
3139
+ const className = cn(
3140
+ \`\${P}-media\`,
3141
+ media.objectFit === 'contain' && \`\${P}-media-contain\`,
3142
+ isVisible && isLoaded && \`\${P}-media-visible\`,
3143
+ isCovered && \`\${P}-media-covered\`,
3144
+ isFading && \`\${P}-media-fading\`,
3145
+ );
3146
+
3147
+ useEffect(() => {
3148
+ const video = videoRef.current;
3149
+ if (!video) return;
3150
+ if (isVisible) {
3151
+ video.play()?.catch(() => {});
3152
+ } else {
3153
+ video.pause();
3154
+ }
3155
+ }, [isVisible]);
3156
+
3157
+ if (isVideo) {
3158
+ return (
3159
+ <video
3160
+ ref={videoRef}
3161
+ className={className}
3162
+ src={media.assetId}
3163
+ muted
3164
+ loop
3165
+ playsInline
3166
+ preload="auto"
3167
+ onLoadedData={onLoad}
3168
+ />
3169
+ );
3170
+ }
3171
+
3172
+ return <img className={className} src={media.assetId} alt="" decoding="async" onLoad={onLoad} />;
3173
+ }
3174
+
3175
+ function renderColumnWidthControls(
3176
+ P: string,
3177
+ widths: number[],
3178
+ paddingLeft: number,
3179
+ columnGap: number,
3180
+ scaled: (value: number) => string,
3181
+ ) {
3182
+ const lastWidth = widths[widths.length - 1];
3183
+ let columnLeft = paddingLeft;
3184
+ return widths.slice(0, -1).map((width, index) => {
3185
+ const gapCenter = columnLeft + width + columnGap / 2;
3186
+ columnLeft += width + columnGap;
3187
+ return (
3188
+ <div
3189
+ key={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
3190
+ data-controls={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
3191
+ data-controls-axis="x"
3192
+ data-controls-variant="column-width"
3193
+ data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
3194
+ data-controls-max-fraction={String(width + lastWidth)}
3195
+ className={\`\${P}-control-anchor\`}
3196
+ style={{ top: 0, left: scaled(gapCenter - MIN_HANDLE_SIZE / 2), width: scaled(MIN_HANDLE_SIZE), height: '100%' }}
3197
+ />
3198
+ );
3199
+ });
3200
+ }
3201
+
3202
+ function renderPanelPaddingControls(
3203
+ P: string,
3204
+ panelWidth: number,
3205
+ padding: Padding,
3206
+ scaled: (value: number) => string,
3207
+ ) {
3208
+ return PADDING_CONTROLS.map((control) => {
3209
+ const size = scaled(Math.max(padding[control.side], MIN_HANDLE_SIZE));
3210
+ const isHorizontal = control.axis === 'x';
3211
+ return (
3212
+ <div
3213
+ key={control.side}
3214
+ data-controls={\`panelPadding.\${control.side}\`}
3215
+ data-controls-axis={control.axis}
3216
+ data-controls-variant={control.variant}
3217
+ data-controls-reverse={'reverse' in control ? '' : undefined}
3218
+ data-controls-min="0"
3219
+ data-controls-max-fraction={'opposite' in control ? String(Math.max(0, panelWidth - padding[control.opposite])) : undefined}
3220
+ className={\`\${P}-control-anchor\`}
3221
+ style={{
3222
+ [control.side]: 0,
3223
+ ...(isHorizontal ? { top: 0, width: size, height: '100%' } : { left: 0, width: '100%', height: size }),
3224
+ }}
3225
+ />
3226
+ );
3227
+ });
3228
+ }
3229
+
3230
+ export function Chronicles({
3231
+ settings,
3232
+ content,
3233
+ isEditor,
3234
+ isEditMode,
3235
+ isPreviewMode,
3236
+ portalId,
3237
+ currentState,
3238
+ unavailableStates,
3239
+ }: ChroniclesProps) {
3240
+ const { prefix: P } = useScopedStyles();
3241
+ const {
3242
+ type,
3243
+ triggerLabel,
3244
+ closeLabel,
3245
+ columns,
3246
+ columnGap,
3247
+ hoverInterval,
3248
+ panelPosition,
3249
+ panelWidth,
3250
+ panelPadding,
3251
+ panelRadius,
3252
+ groupGap,
3253
+ triggerColor,
3254
+ triggerHoverColor,
3255
+ closeColor,
3256
+ closeHoverColor,
3257
+ panelColor,
3258
+ textColor,
3259
+ textHoverColor,
3260
+ overlayColor,
3261
+ } = settings;
3262
+ const items = useMemo(() => content ?? [], [content]);
3263
+ const wrapperRef = useRef<HTMLDivElement>(null);
3264
+ const triggerRef = useRef<HTMLButtonElement>(null);
3265
+ const overlayRef = useRef<HTMLDivElement>(null);
3266
+ const closeRef = useRef<HTMLButtonElement>(null);
3267
+ const panelRef = useRef<HTMLDivElement>(null);
3268
+ const inlineLayerRef = useRef<HTMLDivElement>(null);
3269
+ const shownMediaRef = useRef<string | null>(null);
3270
+ const [isUserOpen, setIsUserOpen] = useState(false);
3271
+ const [isOverlayMounted, setIsOverlayMounted] = useState(false);
3272
+ const [isOverlayActive, setIsOverlayActive] = useState(false);
3273
+ const [isOverlaySettled, setIsOverlaySettled] = useState(false);
3274
+ const [activeIndex, setActiveIndex] = useState<number | null>(null);
3275
+ const [activeMediaIndex, setActiveMediaIndex] = useState(0);
3276
+ const [mountedRows, setMountedRows] = useState<Set<number>>(() => new Set());
3277
+ const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
3278
+ const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
3279
+ const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
3280
+ const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
3281
+ const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
3282
+ const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
3283
+ const [isMediaCut, setIsMediaCut] = useState(false);
3284
+
3285
+ const isEditorCanvas = isEditor && !isPreviewMode;
3286
+ const isInteractive = !isEditorCanvas;
3287
+ const isInline = type === 'a';
3288
+ const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
3289
+ const isOpen = !isInline && (isOpenPinned || ((isInteractive || isEditMode) && isUserOpen));
3290
+ const isListShown = isInteractive && (isInline || isOpen);
3291
+ const scaled = (value: number) => scalingValue(value, isEditor ?? false);
3292
+ const scopedCss = useMemo(() => getCSS(P), [P]);
3293
+ const panelOffset = PANEL_POSITION_OFFSETS[panelPosition];
3294
+ const columnWidths = resolveColumnWidths(settings);
3295
+ const titleKeys = TITLE_KEYS.slice(0, columns - 1);
3296
+ const hasGroupColumn = columns > 1;
3297
+ const groups = useMemo<ChroniclesGroup[]>(() => (
3298
+ hasGroupColumn ? groupRows(items) : [{ label: '', rows: items.map((item, index) => ({ item, index })) }]
3299
+ ), [items, hasGroupColumn]);
3300
+
3301
+ const activeMedia = activeIndex === null ? [] : getRowMedia(items[activeIndex]);
3302
+ const shownAsset = activeMedia[activeMediaIndex];
3303
+ const shownMedia = activeIndex !== null && shownAsset ? getMediaKey(activeIndex, activeMediaIndex, shownAsset.assetId) : null;
3304
+ const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
3305
+
3306
+ useLightboxScrollLock(isOpen && !isEditorCanvas);
3307
+
3308
+ useEffect(() => {
3309
+ if (isEditorCanvas && !isEditMode) setIsUserOpen(false);
3310
+ }, [isEditorCanvas, isEditMode]);
3311
+
3312
+ useEffect(() => {
3313
+ if (isOpen) {
3314
+ setLayoutStyle(getLayoutStyle(wrapperRef.current));
3315
+ setIsOverlayMounted(true);
3316
+ return;
3317
+ }
3318
+ setIsOverlayActive(false);
3319
+ setActiveIndex(null);
3320
+ const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
3321
+ return () => window.clearTimeout(timer);
3322
+ }, [isOpen]);
3323
+
3324
+ useEffect(() => {
3325
+ if (!isOpen || !isOverlayMounted) return;
3326
+ overlayRef.current?.getBoundingClientRect();
3327
+ const frame = requestAnimationFrame(() => setIsOverlayActive(true));
3328
+ return () => cancelAnimationFrame(frame);
3329
+ }, [isOpen, isOverlayMounted]);
3330
+
3331
+ useEffect(() => {
3332
+ if (!isOverlayActive) {
3333
+ setIsOverlaySettled(false);
3334
+ return;
3335
+ }
3336
+ const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
3337
+ return () => window.clearTimeout(timer);
3338
+ }, [isOverlayActive]);
3339
+
3340
+ const updateClosePosition = useCallback(() => {
3341
+ const trigger = triggerRef.current;
3342
+ const overlay = overlayRef.current;
3343
+ if (!trigger || !overlay) return;
3344
+ const triggerRect = trigger.getBoundingClientRect();
3345
+ const overlayRect = overlay.getBoundingClientRect();
3346
+ setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
3347
+ }, []);
3348
+
3349
+ const isLayerMounted = isOverlayMounted || (isInline && mountedRows.size > 0);
3350
+ useEffect(() => {
3351
+ const wrapper = wrapperRef.current;
3352
+ if (!isLayerMounted || !wrapper || typeof ResizeObserver === 'undefined') return;
3353
+ const update = () => setLayoutStyle((prev) => {
3354
+ const next = getLayoutStyle(wrapper);
3355
+ const isSame = LIGHTBOX_CSS_VARS.every((name) => (prev as Record<string, unknown>)[name] === (next as Record<string, unknown>)[name]);
3356
+ return isSame ? prev : next;
3357
+ });
3358
+ const observer = new ResizeObserver(update);
3359
+ observer.observe(wrapper);
3360
+ // the editor changes the variables a frame after a layout switch, without resizing either element then
3361
+ const styleObserver = new MutationObserver(update);
3362
+ const layoutContainer = findLayoutContainer(wrapper);
3363
+ if (layoutContainer && layoutContainer !== wrapper) {
3364
+ observer.observe(layoutContainer);
3365
+ styleObserver.observe(layoutContainer, { attributes: true, attributeFilter: ['style'] });
3366
+ }
3367
+ return () => {
3368
+ observer.disconnect();
3369
+ styleObserver.disconnect();
3370
+ };
3371
+ }, [isLayerMounted]);
3372
+
3373
+ useLayoutEffect(() => {
3374
+ if (!isOverlayMounted) return;
3375
+ updateClosePosition();
3376
+ window.addEventListener('resize', updateClosePosition);
3377
+ return () => window.removeEventListener('resize', updateClosePosition);
3378
+ }, [isOverlayMounted, layoutStyle, updateClosePosition]);
3379
+
3380
+ useEffect(() => {
3381
+ if (!isOpen || !isInteractive) return;
3382
+ closeRef.current?.focus({ preventScroll: true });
3383
+ const onKeyDown = (event: KeyboardEvent) => {
3384
+ if (event.key !== 'Escape') return;
3385
+ setIsUserOpen(false);
3386
+ triggerRef.current?.focus({ preventScroll: true });
3387
+ };
3388
+ document.addEventListener('keydown', onKeyDown);
3389
+ return () => document.removeEventListener('keydown', onKeyDown);
3390
+ }, [isOpen, isInteractive]);
3391
+
3392
+ useLayoutEffect(() => {
3393
+ if (!isInline || activeIndex === null) return;
3394
+ const panelEl = panelRef.current;
3395
+ const layer = inlineLayerRef.current;
3396
+ if (!panelEl || !layer) return;
3397
+ const panelRect = panelEl.getBoundingClientRect();
3398
+ const layerRect = layer.getBoundingClientRect();
3399
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
3400
+ }, [isInline, activeIndex]);
3401
+
3402
+ useEffect(() => {
3403
+ if (activeIndex !== null) return;
3404
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
3405
+ return () => window.clearTimeout(timer);
3406
+ }, [activeIndex]);
3407
+
3408
+ const isCopyShown = copyRect !== null;
3409
+ useEffect(() => {
3410
+ if (!isInline || !isCopyShown) return;
3411
+ const cut = () => {
3412
+ setIsMediaCut(true);
3413
+ setActiveIndex(null);
3414
+ setCopyRect(null);
3415
+ };
3416
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
3417
+ window.addEventListener('resize', cut);
3418
+ return () => {
3419
+ document.removeEventListener('scroll', cut, { capture: true });
3420
+ window.removeEventListener('resize', cut);
3421
+ };
3422
+ }, [isInline, isCopyShown]);
3423
+
3424
+ useEffect(() => {
3425
+ if (!isListShown) return;
3426
+ items.forEach((item) => getRowMedia(item).forEach((media) => {
3427
+ if (!isVideoMedia(media)) new Image().src = media.assetId;
3428
+ }));
3429
+ }, [isListShown, items]);
3430
+
3431
+ useEffect(() => {
3432
+ if (activeMedia.length < 2) return;
3433
+ const timer = window.setInterval(() => {
3434
+ setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
3435
+ }, hoverInterval);
3436
+ return () => window.clearInterval(timer);
3437
+ }, [activeIndex, activeMedia.length, hoverInterval]);
3438
+
3439
+ useLayoutEffect(() => {
3440
+ const previous = shownMediaRef.current;
3441
+ shownMediaRef.current = shownMedia;
3442
+ if (shownMedia === null) return;
3443
+ setLastShownMedia(shownMedia);
3444
+ setCoveredMedia(previous);
3445
+ }, [shownMedia]);
3446
+
3447
+ useEffect(() => {
3448
+ if (!isShownMediaLoaded || coveredMedia === null) return;
3449
+ const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
3450
+ return () => window.clearTimeout(timer);
3451
+ }, [isShownMediaLoaded, coveredMedia]);
3452
+
3453
+ const close = () => {
3454
+ if (!isInteractive) return;
3455
+ setIsUserOpen(false);
3456
+ triggerRef.current?.focus({ preventScroll: true });
3457
+ };
3458
+
3459
+ const showRowMedia = (index: number) => {
3460
+ if (!isInteractive || getRowMedia(items[index]).length === 0) {
3461
+ setActiveIndex(null);
3462
+ return;
3463
+ }
3464
+ setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
3465
+ if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
3466
+ if (activeIndex !== index) setActiveMediaIndex(0);
3467
+ setIsMediaCut(false);
3468
+ setActiveIndex(index);
3469
+ };
3470
+
3471
+ const hideRowMedia = (index: number) => {
3472
+ setActiveIndex((current) => (current === index ? null : current));
3473
+ };
3474
+
3475
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
3476
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
3477
+ event.preventDefault();
3478
+ }
3479
+ };
3480
+
3481
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
3482
+ const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
3483
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
3484
+ ));
3485
+ const labelLineHeight = columnTypographyCss[0].lineHeight;
3486
+ const titleLineHeight = columnTypographyCss[1]?.lineHeight;
3487
+ const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
3488
+ ? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
3489
+ : undefined;
3490
+
3491
+ const colorVars = buildColorVars(P, {
3492
+ triggerColor,
3493
+ triggerHoverColor,
3494
+ closeColor,
3495
+ closeHoverColor,
3496
+ panelColor,
3497
+ textColor,
3498
+ textHoverColor,
3499
+ overlayColor,
3500
+ }, COLOR_VAR_MAP, []);
3501
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
3502
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
3503
+
3504
+ const mediaLayer = (
3505
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
3506
+ {[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
3507
+ const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
3508
+ return (
3509
+ <ChroniclesMediaItem
3510
+ key={mediaKey}
3511
+ P={P}
3512
+ media={media}
3513
+ isVisible={mediaKey === shownMedia}
3514
+ isLoaded={loadedMedia.has(mediaKey)}
3515
+ isCovered={mediaKey === coveredMedia}
3516
+ isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
3517
+ onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
3518
+ />
3519
+ );
3520
+ }))}
3521
+ </div>
3522
+ );
3523
+
3524
+ const renderPanel = (isCopy: boolean) => {
3525
+ const showControls = !isCopy && showPanelControls;
3526
+ return (
3527
+ <div
3528
+ ref={isCopy ? undefined : panelRef}
3529
+ className={cn(
3530
+ \`\${P}-panel\`,
3531
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
3532
+ isInline && \`\${P}-panel-inline\`,
3533
+ isCopy && \`\${P}-panel-copy\`,
3534
+ )}
3535
+ style={{
3536
+ width: scaled(panelWidth),
3537
+ paddingTop: scaled(panelPadding.top),
3538
+ paddingRight: scaled(panelPadding.right),
3539
+ paddingBottom: scaled(panelPadding.bottom),
3540
+ paddingLeft: scaled(panelPadding.left),
3541
+ borderRadius: scaled(panelRadius),
3542
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
3543
+ [\`--\${P}-panel-x\`]: panelOffset.x,
3544
+ [\`--\${P}-panel-y\`]: panelOffset.y,
3545
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
3546
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
3547
+ ...(isCopy && copyRect),
3548
+ } as CSSProperties}
3549
+ data-lightbox-scrollable={isInline ? undefined : ''}
3550
+ aria-hidden={isCopy || undefined}
3551
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
3552
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
3553
+ >
3554
+ {showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
3555
+ {showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
3556
+ {groups.map((group, groupIndex) => (
3557
+ <Fragment key={groupIndex}>
3558
+ {showControls && groupIndex > 0 && (
3559
+ <div
3560
+ data-controls="groupGap"
3561
+ data-controls-paired=""
3562
+ data-controls-axis="y"
3563
+ data-controls-reverse=""
3564
+ data-controls-min="0"
3565
+ className={\`\${P}-control-anchor\`}
3566
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
3567
+ />
3568
+ )}
3569
+ <div
3570
+ className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
3571
+ style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
3572
+ >
3573
+ {hasGroupColumn && (
3574
+ <span
3575
+ className={\`\${P}-group-label\`}
3576
+ style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
3577
+ >
3578
+ {group.label}
3579
+ </span>
3580
+ )}
3581
+ {group.rows.map(({ item, index }) => {
3582
+ const rowLink = !isCopy && item.link?.value ? item.link : undefined;
3583
+ const RowElement = rowLink ? 'a' : 'div';
3584
+ const linkProps = rowLink ? {
3585
+ href: buildValidUrl(rowLink.value),
3586
+ ...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
3587
+ } : {};
3588
+ const isFocusable = !rowLink && isInteractive && getRowMedia(item).length > 0;
3589
+ const hoverProps = isCopy ? {} : {
3590
+ tabIndex: isFocusable ? 0 : undefined,
3591
+ onMouseEnter: () => showRowMedia(index),
3592
+ onMouseLeave: () => hideRowMedia(index),
3593
+ onFocus: () => showRowMedia(index),
3594
+ onBlur: () => hideRowMedia(index),
3595
+ };
3596
+ return (
3597
+ <RowElement
3598
+ key={index}
3599
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
3600
+ {...linkProps}
3601
+ {...hoverProps}
3602
+ >
3603
+ {!hasGroupColumn && (
3604
+ <div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
3605
+ )}
3606
+ {titleKeys.map((key, titleIndex) => (
3607
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
3608
+ ))}
3609
+ </RowElement>
3610
+ );
3611
+ })}
3612
+ </div>
3613
+ </Fragment>
3614
+ ))}
3615
+ </div>
3616
+ );
3617
+ };
3618
+
3619
+ const overlay = isOverlayMounted && !isInline ? (
3620
+ <div
3621
+ ref={overlayRef}
3622
+ className={cn(
3623
+ \`\${P}-overlay\`,
3624
+ isEditor && \`\${P}-overlay-editor\`,
3625
+ isEditMode && \`\${P}-overlay-edit-mode\`,
3626
+ isOverlayActive && \`\${P}-overlay-active\`,
3627
+ interactiveClass,
3628
+ )}
3629
+ style={{ ...colorVars, ...layoutStyle }}
3630
+ role="dialog"
3631
+ aria-modal="true"
3632
+ aria-label={triggerLabel}
3633
+ data-selection="none"
3634
+ >
3635
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
3636
+ {mediaLayer}
3637
+ <button
3638
+ ref={closeRef}
3639
+ type="button"
3640
+ className={\`\${P}-close\`}
3641
+ style={{
3642
+ ...triggerTypographyCss,
3643
+ top: closePosition?.top ?? 0,
3644
+ left: closePosition?.left ?? 0,
3645
+ visibility: closePosition ? 'visible' : 'hidden',
3646
+ }}
3647
+ onClick={close}
3648
+ >
3649
+ {closeLabel}
3650
+ </button>
3651
+ {renderPanel(false)}
3652
+ </div>
3653
+ ) : null;
3654
+
3655
+ const inlineLayer = isInline && mountedRows.size > 0 ? (
3656
+ <div
3657
+ ref={inlineLayerRef}
3658
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass)}
3659
+ style={{ ...colorVars, ...layoutStyle }}
3660
+ aria-hidden="true"
3661
+ data-selection="none"
3662
+ >
3663
+ {mediaLayer}
3664
+ {copyRect && renderPanel(true)}
3665
+ </div>
3666
+ ) : null;
3667
+ const portalContent = overlay ?? inlineLayer;
3668
+
3669
+ return (
3670
+ <>
3671
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
3672
+ <div
3673
+ ref={wrapperRef}
3674
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass)}
3675
+ style={colorVars}
3676
+ >
3677
+ {isInline ? renderPanel(false) : (
3678
+ <button
3679
+ ref={triggerRef}
3680
+ type="button"
3681
+ className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
3682
+ style={triggerTypographyCss}
3683
+ aria-haspopup="dialog"
3684
+ aria-expanded={isOpen}
3685
+ onClick={() => {
3686
+ if (isInteractive) setIsUserOpen(true);
3687
+ }}
3688
+ >
3689
+ {triggerLabel}
3690
+ </button>
3691
+ )}
3692
+ </div>
3693
+ {portalContent && typeof document !== 'undefined' && createPortal(
3694
+ portalContent,
3695
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
3696
+ )}
3697
+ </>
3698
+ );
3699
+ }
3700
+ `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2687
3701
  import { CommonComponentProps } from '../props';
2688
3702
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2689
3703
 
@@ -3212,7 +4226,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3212
4226
  </>
3213
4227
  );
3214
4228
  }
3215
- `,i=`import { useCallback, useEffect, useMemo, useState } from 'react';
4229
+ `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
3216
4230
  import cn from 'classnames';
3217
4231
  import { CommonComponentProps } from '../props';
3218
4232
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3960,7 +4974,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3960
4974
  </>
3961
4975
  );
3962
4976
  }
3963
- `,o=`import React, { useMemo, useState } from 'react';
4977
+ `,r=`import React, { useMemo, useState } from 'react';
3964
4978
  import { CommonComponentProps } from '../props';
3965
4979
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3966
4980
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4598,7 +5612,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4598
5612
  };
4599
5613
 
4600
5614
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4601
- `,r=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5615
+ `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
4602
5616
  import '@splidejs/react-splide/css/core';
4603
5617
  import { CommonComponentProps } from '../props';
4604
5618
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -6913,7 +7927,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6913
7927
  };
6914
7928
 
6915
7929
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6916
- `,a=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7930
+ `,s=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6917
7931
  import { CommonComponentProps } from '../props';
6918
7932
  import { scalingValue } from '../utils/scalingValue';
6919
7933
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -7486,7 +8500,7 @@ export function Helix({
7486
8500
  </>
7487
8501
  );
7488
8502
  }
7489
- `,s=`import { CommonComponentProps } from '../props';
8503
+ `,l=`import { CommonComponentProps } from '../props';
7490
8504
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7491
8505
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7492
8506
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -9938,7 +10952,7 @@ export function Hive({
9938
10952
  </>
9939
10953
  );
9940
10954
  }
9941
- `,l=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10955
+ `,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9942
10956
  import { createPortal } from 'react-dom';
9943
10957
  import { CommonComponentProps } from '../props';
9944
10958
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10703,7 +11717,7 @@ export type LightboxJournalSettings = {
10703
11717
  closeIconColor: string;
10704
11718
  closeIconHoverColor: string;
10705
11719
  };
10706
- `,c=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
11720
+ `,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
10707
11721
  import { createPortal } from 'react-dom';
10708
11722
  import { CommonComponentProps } from '../props';
10709
11723
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11249,7 +12263,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11249
12263
  </>
11250
12264
  );
11251
12265
  };
11252
- `,d=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12266
+ `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11253
12267
  import { createPortal } from 'react-dom';
11254
12268
  import { CommonComponentProps } from '../props';
11255
12269
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -14354,7 +15368,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14354
15368
  </>
14355
15369
  );
14356
15370
  }
14357
- `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15371
+ `,g=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14358
15372
  import cn from 'classnames';
14359
15373
  import { CommonComponentProps } from '../props';
14360
15374
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15212,7 +16226,7 @@ type MarqueeProps = {
15212
16226
  isPreviewMode?: boolean;
15213
16227
  isEditMode?: boolean;
15214
16228
  } & CommonComponentProps;
15215
- `,g=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16229
+ `,m=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15216
16230
  import cn from 'classnames';
15217
16231
  import { CommonComponentProps } from '../props';
15218
16232
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16155,7 +17169,7 @@ type MarqueeTextProps = {
16155
17169
  isPreviewMode?: boolean;
16156
17170
  isEditMode?: boolean;
16157
17171
  } & CommonComponentProps;
16158
- `,m=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17172
+ `,p=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16159
17173
  import { createPortal } from 'react-dom';
16160
17174
  import type React from 'react';
16161
17175
  import { CommonComponentProps } from '../props';
@@ -18637,7 +19651,7 @@ export function Mercury({
18637
19651
  </>
18638
19652
  );
18639
19653
  }
18640
- `,p=`import React, { useMemo, useState } from 'react';
19654
+ `,h=`import React, { useMemo, useState } from 'react';
18641
19655
  import { CommonComponentProps } from '../props';
18642
19656
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18643
19657
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19216,7 +20230,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19216
20230
  };
19217
20231
 
19218
20232
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19219
- `,h=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20233
+ `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19220
20234
  import type React from 'react';
19221
20235
  import { CommonComponentProps } from '../props';
19222
20236
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -20055,7 +21069,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
20055
21069
  </>
20056
21070
  );
20057
21071
  }
20058
- `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21072
+ `,v=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20059
21073
  import cn from 'classnames';
20060
21074
  import { CommonComponentProps } from '../props';
20061
21075
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20683,7 +21697,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20683
21697
  </>
20684
21698
  );
20685
21699
  }
20686
- `,v=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21700
+ `,P=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20687
21701
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20688
21702
  import { CommonComponentProps } from '../props';
20689
21703
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21315,7 +22329,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21315
22329
  </>
21316
22330
  );
21317
22331
  }
21318
- `,P=`import React, { useCallback, useEffect, useRef, useState } from 'react';
22332
+ `,x=`import React, { useCallback, useEffect, useRef, useState } from 'react';
21319
22333
  import cn from 'classnames';
21320
22334
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21321
22335
  import { scalingValue } from '../utils/scalingValue';
@@ -22497,7 +23511,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22497
23511
  </svg>
22498
23512
  );
22499
23513
  }
22500
- `,x=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23514
+ `,b=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22501
23515
  import cn from 'classnames';
22502
23516
  import { CommonComponentProps } from '../props';
22503
23517
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23128,7 +24142,7 @@ type TestimonialsSettings = {
23128
24142
  logoHeight: number;
23129
24143
  captionMarginTop: number;
23130
24144
  };
23131
- `,b=`import cn from 'classnames';
24145
+ `,y=`import cn from 'classnames';
23132
24146
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
23133
24147
  import { CommonComponentProps } from '../props';
23134
24148
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23624,7 +24638,7 @@ type TestimonialsSettings = {
23624
24638
  icon?: string | null;
23625
24639
  };
23626
24640
  };
23627
- `,y=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24641
+ `,S=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23628
24642
  import type React from 'react';
23629
24643
  import { createPortal } from 'react-dom';
23630
24644
  import { CommonComponentProps } from '../props';
@@ -24157,4 +25171,4 @@ export function Waterfall({
24157
25171
  </>
24158
25172
  );
24159
25173
  }
24160
- `,S={[n.BurgerComponent.id]:e,[n.ClickGallerieComponent.id]:t,[n.FAQComponent.id]:i,[n.FormComponent.id]:o,[n.GridComponent.id]:r,[n.HelixComponent.id]:a,[n.HiveComponent.id]:s,[n.LightboxJournalComponent.id]:l,[n.LightboxStripComponent.id]:c,[n.ListComponent.id]:d,[n.MarqueeComponent.id]:u,[n.MarqueeTextComponent.id]:g,[n.MercuryComponent.id]:m,[n.OnelinerFormComponent.id]:p,[n.PretextComponent.id]:h,[n.ScaleComponent.id]:f,[n.SimpleButtonComponent.id]:v,[n.Slider20Component.id]:P,[n.TestimonialGridComponent.id]:x,[n.TestimonialSingleComponent.id]:b,[n.WaterfallComponent.id]:y};exports.componentSources=S;
25174
+ `,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;