@cntrl-site/components 1.0.107 → 1.0.108-alpha.0

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 (50) hide show
  1. package/dist/Chronicles-DBM6UcTB.mjs +711 -0
  2. package/dist/Chronicles-DTjRzRhE.js +198 -0
  3. package/dist/{PretextComponent-BiS9XbZr.mjs → ChroniclesComponent-9Fi2A06B.mjs} +857 -425
  4. package/dist/ChroniclesComponent-DILYPR6b.js +1 -0
  5. package/dist/{ClickGallerie-CYQMgrIr.js → ClickGallerie-41L7IKhN.js} +1 -1
  6. package/dist/{ClickGallerie-o2U6oyOF.mjs → ClickGallerie-CBquEuXQ.mjs} +1 -1
  7. package/dist/Components/Chronicles/Chronicles.d.ts +120 -0
  8. package/dist/Components/Chronicles/ChroniclesComponent.d.ts +313 -0
  9. package/dist/Components/utils/LinkWrapper.d.ts +1 -0
  10. package/dist/{ControlSlider-Kkec-i14.js → ControlSlider-D91b53un.js} +1 -1
  11. package/dist/{ControlSlider-LcZmviGX.mjs → ControlSlider-mp-LvrTR.mjs} +1 -1
  12. package/dist/{FAQ-BxhMo7T8.js → FAQ-8goVE-aB.js} +1 -1
  13. package/dist/{FAQ-CdwSft5p.mjs → FAQ-KL9X1-xe.mjs} +1 -1
  14. package/dist/{Grid-CFHTP3mb.js → Grid-Dec4bMvK.js} +1 -1
  15. package/dist/{Grid-e-gLfsji.mjs → Grid-wxlTwFLb.mjs} +1 -1
  16. package/dist/{ImageRevealSlider-BuukTGAK.js → ImageRevealSlider-Bv092gwv.js} +1 -1
  17. package/dist/{ImageRevealSlider-Df9sygk9.mjs → ImageRevealSlider-K_nNoquq.mjs} +1 -1
  18. package/dist/{Lightbox-DaunVrkp.js → Lightbox-C2r7Wt_8.js} +1 -1
  19. package/dist/{Lightbox-C_fXsfdz.mjs → Lightbox-Cyvva2uu.mjs} +1 -1
  20. package/dist/LinkWrapper-CFEH047t.mjs +14 -0
  21. package/dist/LinkWrapper-CzFwFtgU.js +1 -0
  22. package/dist/{Marquee-DfIP-tIN.js → Marquee-BacOdRJ9.js} +1 -1
  23. package/dist/{Marquee-DByooiWP.mjs → Marquee-DGbeihUh.mjs} +1 -1
  24. package/dist/{MarqueeText-DsUiV6Zv.js → MarqueeText-BuEx2FCt.js} +1 -1
  25. package/dist/{MarqueeText-D6FNCe6P.mjs → MarqueeText-DTlCevPX.mjs} +1 -1
  26. package/dist/{RichTextRenderer-K90Dd7pt.js → RichTextRenderer-CUEc4FaL.js} +1 -1
  27. package/dist/{RichTextRenderer-BptwNpbJ.mjs → RichTextRenderer-DizfCZEz.mjs} +1 -1
  28. package/dist/{Slider20-fMVeRfgx.js → Slider20-BdeHmG8C.js} +1 -1
  29. package/dist/{Slider20-CCzixTiN.mjs → Slider20-DS-FTzQC.mjs} +1 -1
  30. package/dist/{TestimonialGrid-CiCagfBU.js → TestimonialGrid-B0JHzqhv.js} +1 -1
  31. package/dist/{TestimonialGrid-CbsVxSn9.mjs → TestimonialGrid-BOqSqVin.mjs} +1 -1
  32. package/dist/{TestimonialSingle-BVm3Amrl.mjs → TestimonialSingle-7-PMnQ7u.mjs} +1 -1
  33. package/dist/{TestimonialSingle-BWXynGjv.js → TestimonialSingle-Bx_V-cYE.js} +1 -1
  34. package/dist/components-BJdVsqb6.js +1 -0
  35. package/dist/{components-ljYgHKal.mjs → components-Qpn7IZ0W.mjs} +18 -17
  36. package/dist/elements.js +1 -1
  37. package/dist/elements.mjs +16 -15
  38. package/dist/elements.node.js +1 -1
  39. package/dist/elements.node.mjs +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.mjs +2 -2
  42. package/dist/sources.js +1012 -22
  43. package/dist/sources.mjs +1036 -45
  44. package/dist/utils.js +1 -1
  45. package/dist/utils.mjs +1 -1
  46. package/package.json +1 -1
  47. package/dist/LinkWrapper-Ca84iPtg.js +0 -1
  48. package/dist/LinkWrapper-DZs9hlOn.mjs +0 -13
  49. package/dist/PretextComponent-DWOy-dqD.js +0 -1
  50. 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-DILYPR6b.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,997 @@ 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, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
2691
+ import { buildValidUrl } from '../utils/LinkWrapper';
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 ChroniclesSettings = PrefixedTextStyle<TextStylePrefix> & Partial<Record<ColumnWidthKey, number>> & {
2792
+ type: 'a' | 'b';
2793
+ triggerLabel: string;
2794
+ closeLabel: string;
2795
+ columns: number;
2796
+ columnGap: number;
2797
+ hoverInterval: number;
2798
+ panelPosition: ChroniclesPanelPosition;
2799
+ panelWidth: number;
2800
+ panelPadding: Padding;
2801
+ panelRadius: number;
2802
+ groupGap: number;
2803
+ triggerColor: string;
2804
+ triggerHoverColor: string;
2805
+ closeColor: string;
2806
+ closeHoverColor: string;
2807
+ panelColor: string;
2808
+ textColor: string;
2809
+ textHoverColor: string;
2810
+ overlayColor: string;
2811
+ };
2812
+
2813
+ type ColumnLayoutSettings = Pick<ChroniclesSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding' | ColumnWidthKey>;
2814
+
2815
+ type ChroniclesProps = {
2816
+ settings: ChroniclesSettings;
2817
+ content?: ChroniclesItem[];
2818
+ isEditor?: boolean;
2819
+ isEditMode?: boolean;
2820
+ isPreviewMode?: boolean;
2821
+ activeEvent?: string;
2822
+ portalId?: string;
2823
+ } & CommonComponentProps;
2824
+
2825
+ function getColumnsSpace({ columns, columnGap, panelWidth, panelPadding }: ColumnLayoutSettings): number {
2826
+ return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - (columns - 1) * columnGap);
2827
+ }
2828
+
2829
+ export function getChroniclesEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ColumnWidthKey, number>> {
2830
+ const width = getColumnsSpace(settings) / settings.columns;
2831
+ return Object.fromEntries(CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => [key, width]));
2832
+ }
2833
+
2834
+ export function applyChroniclesColumnCountChange(
2835
+ nextSettings: Record<string, any>,
2836
+ prevSettings: Record<string, any>,
2837
+ ): Record<string, any> {
2838
+ if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
2839
+ return nextSettings;
2840
+ }
2841
+ return { ...nextSettings, ...getChroniclesEqualColumnWidths({ ...prevSettings, ...nextSettings } as ColumnLayoutSettings) };
2842
+ }
2843
+
2844
+ // The last column takes the remaining space; sized columns shrink together when they no longer fit.
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 = Boolean(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 || Boolean(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
+ // Activate a frame after mount so the appear transition has a start state.
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
+ useLayoutEffect(() => {
3350
+ if (!isOverlayMounted) return;
3351
+ updateClosePosition();
3352
+ window.addEventListener('resize', updateClosePosition);
3353
+ return () => window.removeEventListener('resize', updateClosePosition);
3354
+ }, [isOverlayMounted, updateClosePosition]);
3355
+
3356
+ useEffect(() => {
3357
+ if (!isOpen || !isInteractive) return;
3358
+ closeRef.current?.focus({ preventScroll: true });
3359
+ const onKeyDown = (event: KeyboardEvent) => {
3360
+ if (event.key === 'Escape') setIsUserOpen(false);
3361
+ };
3362
+ document.addEventListener('keydown', onKeyDown);
3363
+ return () => document.removeEventListener('keydown', onKeyDown);
3364
+ }, [isOpen, isInteractive]);
3365
+
3366
+ // Inline media covers the page, so a copy of the panel is laid over the real one.
3367
+ useLayoutEffect(() => {
3368
+ if (!isInline || activeIndex === null) return;
3369
+ const panelEl = panelRef.current;
3370
+ const layer = inlineLayerRef.current;
3371
+ if (!panelEl || !layer) return;
3372
+ const panelRect = panelEl.getBoundingClientRect();
3373
+ const layerRect = layer.getBoundingClientRect();
3374
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
3375
+ }, [isInline, activeIndex]);
3376
+
3377
+ useEffect(() => {
3378
+ if (activeIndex !== null) return;
3379
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
3380
+ return () => window.clearTimeout(timer);
3381
+ }, [activeIndex]);
3382
+
3383
+ const isCopyShown = copyRect !== null;
3384
+ useEffect(() => {
3385
+ if (!isInline || !isCopyShown) return;
3386
+ const cut = () => {
3387
+ setIsMediaCut(true);
3388
+ setActiveIndex(null);
3389
+ setCopyRect(null);
3390
+ };
3391
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
3392
+ window.addEventListener('resize', cut);
3393
+ return () => {
3394
+ document.removeEventListener('scroll', cut, { capture: true });
3395
+ window.removeEventListener('resize', cut);
3396
+ };
3397
+ }, [isInline, isCopyShown]);
3398
+
3399
+ useEffect(() => {
3400
+ if (!isListShown) return;
3401
+ items.forEach((item) => getRowMedia(item).forEach((media) => {
3402
+ if (!isVideoMedia(media)) new Image().src = media.assetId;
3403
+ }));
3404
+ }, [isListShown, items]);
3405
+
3406
+ useEffect(() => {
3407
+ if (activeMedia.length < 2) return;
3408
+ const timer = window.setInterval(() => {
3409
+ setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
3410
+ }, hoverInterval);
3411
+ return () => window.clearInterval(timer);
3412
+ }, [activeIndex, activeMedia.length, hoverInterval]);
3413
+
3414
+ // Keep the replaced media under the next one until it has faded in; runs before paint to avoid a gap frame.
3415
+ useLayoutEffect(() => {
3416
+ const previous = shownMediaRef.current;
3417
+ shownMediaRef.current = shownMedia;
3418
+ if (shownMedia === null) return;
3419
+ setLastShownMedia(shownMedia);
3420
+ setCoveredMedia(previous);
3421
+ }, [shownMedia]);
3422
+
3423
+ useEffect(() => {
3424
+ if (!isShownMediaLoaded || coveredMedia === null) return;
3425
+ const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
3426
+ return () => window.clearTimeout(timer);
3427
+ }, [isShownMediaLoaded, coveredMedia]);
3428
+
3429
+ const close = () => {
3430
+ if (!isInteractive) return;
3431
+ setIsUserOpen(false);
3432
+ triggerRef.current?.focus({ preventScroll: true });
3433
+ };
3434
+
3435
+ const showRowMedia = (index: number) => {
3436
+ if (!isInteractive || getRowMedia(items[index]).length === 0) {
3437
+ setActiveIndex(null);
3438
+ return;
3439
+ }
3440
+ setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
3441
+ if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
3442
+ if (activeIndex !== index) setActiveMediaIndex(0);
3443
+ setIsMediaCut(false);
3444
+ setActiveIndex(index);
3445
+ };
3446
+
3447
+ const hideRowMedia = (index: number) => {
3448
+ setActiveIndex((current) => (current === index ? null : current));
3449
+ };
3450
+
3451
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
3452
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
3453
+ event.preventDefault();
3454
+ }
3455
+ };
3456
+
3457
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
3458
+ const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
3459
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
3460
+ ));
3461
+ const labelLineHeight = columnTypographyCss[0].lineHeight;
3462
+ const titleLineHeight = columnTypographyCss[1]?.lineHeight;
3463
+ const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
3464
+ ? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
3465
+ : undefined;
3466
+
3467
+ const colorVars = buildColorVars(P, {
3468
+ triggerColor,
3469
+ triggerHoverColor,
3470
+ closeColor,
3471
+ closeHoverColor,
3472
+ panelColor,
3473
+ textColor,
3474
+ textHoverColor,
3475
+ overlayColor,
3476
+ }, COLOR_VAR_MAP, []);
3477
+ const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
3478
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
3479
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
3480
+
3481
+ const mediaLayer = (
3482
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
3483
+ {[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
3484
+ const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
3485
+ return (
3486
+ <ChroniclesMediaItem
3487
+ key={mediaKey}
3488
+ P={P}
3489
+ media={media}
3490
+ isVisible={mediaKey === shownMedia}
3491
+ isLoaded={loadedMedia.has(mediaKey)}
3492
+ isCovered={mediaKey === coveredMedia}
3493
+ isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
3494
+ onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
3495
+ />
3496
+ );
3497
+ }))}
3498
+ </div>
3499
+ );
3500
+
3501
+ const renderPanel = (isCopy: boolean) => {
3502
+ const showControls = !isCopy && showPanelControls;
3503
+ return (
3504
+ <div
3505
+ ref={isCopy ? undefined : panelRef}
3506
+ className={cn(
3507
+ \`\${P}-panel\`,
3508
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
3509
+ isInline && \`\${P}-panel-inline\`,
3510
+ isCopy && \`\${P}-panel-copy\`,
3511
+ )}
3512
+ style={{
3513
+ width: scaled(panelWidth),
3514
+ paddingTop: scaled(panelPadding.top),
3515
+ paddingRight: scaled(panelPadding.right),
3516
+ paddingBottom: scaled(panelPadding.bottom),
3517
+ paddingLeft: scaled(panelPadding.left),
3518
+ borderRadius: scaled(panelRadius),
3519
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
3520
+ [\`--\${P}-panel-x\`]: panelOffset.x,
3521
+ [\`--\${P}-panel-y\`]: panelOffset.y,
3522
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
3523
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
3524
+ ...(isCopy && copyRect),
3525
+ } as CSSProperties}
3526
+ data-lightbox-scrollable={isInline ? undefined : ''}
3527
+ aria-hidden={isCopy || undefined}
3528
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
3529
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
3530
+ >
3531
+ {showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
3532
+ {showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
3533
+ {groups.map((group, groupIndex) => (
3534
+ <Fragment key={groupIndex}>
3535
+ {showControls && groupIndex > 0 && (
3536
+ <div
3537
+ data-controls="groupGap"
3538
+ data-controls-paired=""
3539
+ data-controls-axis="y"
3540
+ data-controls-reverse=""
3541
+ data-controls-min="0"
3542
+ className={\`\${P}-control-anchor\`}
3543
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
3544
+ />
3545
+ )}
3546
+ <div
3547
+ className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
3548
+ style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
3549
+ >
3550
+ {hasGroupColumn && (
3551
+ <span
3552
+ className={\`\${P}-group-label\`}
3553
+ style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
3554
+ >
3555
+ {group.label}
3556
+ </span>
3557
+ )}
3558
+ {group.rows.map(({ item, index }) => {
3559
+ const rowLink = !isCopy && item.link?.value ? item.link : undefined;
3560
+ const RowElement = rowLink ? 'a' : 'div';
3561
+ const linkProps = rowLink ? {
3562
+ href: buildValidUrl(rowLink.value),
3563
+ ...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
3564
+ } : {};
3565
+ const hoverProps = isCopy ? {} : {
3566
+ onMouseEnter: () => showRowMedia(index),
3567
+ onMouseLeave: () => hideRowMedia(index),
3568
+ onFocus: () => showRowMedia(index),
3569
+ onBlur: () => hideRowMedia(index),
3570
+ };
3571
+ return (
3572
+ <RowElement
3573
+ key={index}
3574
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
3575
+ {...linkProps}
3576
+ {...hoverProps}
3577
+ >
3578
+ {!hasGroupColumn && (
3579
+ <div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
3580
+ )}
3581
+ {titleKeys.map((key, titleIndex) => (
3582
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
3583
+ ))}
3584
+ </RowElement>
3585
+ );
3586
+ })}
3587
+ </div>
3588
+ </Fragment>
3589
+ ))}
3590
+ </div>
3591
+ );
3592
+ };
3593
+
3594
+ const overlay = isOverlayMounted ? (
3595
+ <div
3596
+ ref={overlayRef}
3597
+ className={cn(
3598
+ \`\${P}-overlay\`,
3599
+ isEditor && \`\${P}-overlay-editor\`,
3600
+ isEditMode && \`\${P}-overlay-edit-mode\`,
3601
+ isOverlayActive && \`\${P}-overlay-active\`,
3602
+ interactiveClass,
3603
+ stateClass,
3604
+ )}
3605
+ style={{ ...colorVars, ...layoutStyle }}
3606
+ role="dialog"
3607
+ aria-modal="true"
3608
+ aria-label={triggerLabel}
3609
+ data-selection="none"
3610
+ >
3611
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
3612
+ {mediaLayer}
3613
+ <button
3614
+ ref={closeRef}
3615
+ type="button"
3616
+ className={\`\${P}-close\`}
3617
+ style={{
3618
+ ...triggerTypographyCss,
3619
+ top: closePosition?.top ?? 0,
3620
+ left: closePosition?.left ?? 0,
3621
+ visibility: closePosition ? 'visible' : 'hidden',
3622
+ }}
3623
+ onClick={close}
3624
+ >
3625
+ {closeLabel}
3626
+ </button>
3627
+ {renderPanel(false)}
3628
+ </div>
3629
+ ) : null;
3630
+
3631
+ const inlineLayer = isInline && mountedRows.size > 0 ? (
3632
+ <div
3633
+ ref={inlineLayerRef}
3634
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
3635
+ style={{ ...colorVars, ...layoutStyle }}
3636
+ aria-hidden="true"
3637
+ data-selection="none"
3638
+ >
3639
+ {mediaLayer}
3640
+ {copyRect && renderPanel(true)}
3641
+ </div>
3642
+ ) : null;
3643
+ const portalContent = overlay ?? inlineLayer;
3644
+
3645
+ return (
3646
+ <>
3647
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
3648
+ <div
3649
+ ref={wrapperRef}
3650
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
3651
+ style={colorVars}
3652
+ >
3653
+ {isInline ? renderPanel(false) : (
3654
+ <button
3655
+ ref={triggerRef}
3656
+ type="button"
3657
+ className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
3658
+ style={triggerTypographyCss}
3659
+ aria-haspopup="dialog"
3660
+ aria-expanded={isOpen}
3661
+ onClick={() => {
3662
+ if (isInteractive) setIsUserOpen(true);
3663
+ }}
3664
+ >
3665
+ {triggerLabel}
3666
+ </button>
3667
+ )}
3668
+ </div>
3669
+ {portalContent && typeof document !== 'undefined' && createPortal(
3670
+ portalContent,
3671
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
3672
+ )}
3673
+ </>
3674
+ );
3675
+ }
3676
+ `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2687
3677
  import { CommonComponentProps } from '../props';
2688
3678
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2689
3679
 
@@ -3212,7 +4202,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3212
4202
  </>
3213
4203
  );
3214
4204
  }
3215
- `,i=`import { useCallback, useEffect, useMemo, useState } from 'react';
4205
+ `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
3216
4206
  import cn from 'classnames';
3217
4207
  import { CommonComponentProps } from '../props';
3218
4208
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3960,7 +4950,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3960
4950
  </>
3961
4951
  );
3962
4952
  }
3963
- `,o=`import React, { useMemo, useState } from 'react';
4953
+ `,r=`import React, { useMemo, useState } from 'react';
3964
4954
  import { CommonComponentProps } from '../props';
3965
4955
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3966
4956
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4598,7 +5588,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4598
5588
  };
4599
5589
 
4600
5590
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4601
- `,r=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5591
+ `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
4602
5592
  import '@splidejs/react-splide/css/core';
4603
5593
  import { CommonComponentProps } from '../props';
4604
5594
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -6913,7 +7903,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6913
7903
  };
6914
7904
 
6915
7905
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6916
- `,a=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7906
+ `,s=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6917
7907
  import { CommonComponentProps } from '../props';
6918
7908
  import { scalingValue } from '../utils/scalingValue';
6919
7909
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -7486,7 +8476,7 @@ export function Helix({
7486
8476
  </>
7487
8477
  );
7488
8478
  }
7489
- `,s=`import { CommonComponentProps } from '../props';
8479
+ `,l=`import { CommonComponentProps } from '../props';
7490
8480
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7491
8481
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7492
8482
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -9938,7 +10928,7 @@ export function Hive({
9938
10928
  </>
9939
10929
  );
9940
10930
  }
9941
- `,l=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10931
+ `,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9942
10932
  import { createPortal } from 'react-dom';
9943
10933
  import { CommonComponentProps } from '../props';
9944
10934
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10703,7 +11693,7 @@ export type LightboxJournalSettings = {
10703
11693
  closeIconColor: string;
10704
11694
  closeIconHoverColor: string;
10705
11695
  };
10706
- `,c=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
11696
+ `,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
10707
11697
  import { createPortal } from 'react-dom';
10708
11698
  import { CommonComponentProps } from '../props';
10709
11699
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11249,7 +12239,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11249
12239
  </>
11250
12240
  );
11251
12241
  };
11252
- `,d=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12242
+ `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11253
12243
  import { createPortal } from 'react-dom';
11254
12244
  import { CommonComponentProps } from '../props';
11255
12245
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -14354,7 +15344,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14354
15344
  </>
14355
15345
  );
14356
15346
  }
14357
- `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15347
+ `,g=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14358
15348
  import cn from 'classnames';
14359
15349
  import { CommonComponentProps } from '../props';
14360
15350
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15212,7 +16202,7 @@ type MarqueeProps = {
15212
16202
  isPreviewMode?: boolean;
15213
16203
  isEditMode?: boolean;
15214
16204
  } & CommonComponentProps;
15215
- `,g=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16205
+ `,m=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15216
16206
  import cn from 'classnames';
15217
16207
  import { CommonComponentProps } from '../props';
15218
16208
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16155,7 +17145,7 @@ type MarqueeTextProps = {
16155
17145
  isPreviewMode?: boolean;
16156
17146
  isEditMode?: boolean;
16157
17147
  } & CommonComponentProps;
16158
- `,m=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17148
+ `,p=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16159
17149
  import { createPortal } from 'react-dom';
16160
17150
  import type React from 'react';
16161
17151
  import { CommonComponentProps } from '../props';
@@ -18637,7 +19627,7 @@ export function Mercury({
18637
19627
  </>
18638
19628
  );
18639
19629
  }
18640
- `,p=`import React, { useMemo, useState } from 'react';
19630
+ `,h=`import React, { useMemo, useState } from 'react';
18641
19631
  import { CommonComponentProps } from '../props';
18642
19632
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18643
19633
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19216,7 +20206,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19216
20206
  };
19217
20207
 
19218
20208
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19219
- `,h=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20209
+ `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19220
20210
  import type React from 'react';
19221
20211
  import { CommonComponentProps } from '../props';
19222
20212
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -20055,7 +21045,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
20055
21045
  </>
20056
21046
  );
20057
21047
  }
20058
- `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21048
+ `,v=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20059
21049
  import cn from 'classnames';
20060
21050
  import { CommonComponentProps } from '../props';
20061
21051
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20683,7 +21673,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20683
21673
  </>
20684
21674
  );
20685
21675
  }
20686
- `,v=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21676
+ `,P=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20687
21677
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20688
21678
  import { CommonComponentProps } from '../props';
20689
21679
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21315,7 +22305,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21315
22305
  </>
21316
22306
  );
21317
22307
  }
21318
- `,P=`import React, { useCallback, useEffect, useRef, useState } from 'react';
22308
+ `,x=`import React, { useCallback, useEffect, useRef, useState } from 'react';
21319
22309
  import cn from 'classnames';
21320
22310
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21321
22311
  import { scalingValue } from '../utils/scalingValue';
@@ -22497,7 +23487,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22497
23487
  </svg>
22498
23488
  );
22499
23489
  }
22500
- `,x=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23490
+ `,b=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22501
23491
  import cn from 'classnames';
22502
23492
  import { CommonComponentProps } from '../props';
22503
23493
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23128,7 +24118,7 @@ type TestimonialsSettings = {
23128
24118
  logoHeight: number;
23129
24119
  captionMarginTop: number;
23130
24120
  };
23131
- `,b=`import cn from 'classnames';
24121
+ `,y=`import cn from 'classnames';
23132
24122
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
23133
24123
  import { CommonComponentProps } from '../props';
23134
24124
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23624,7 +24614,7 @@ type TestimonialsSettings = {
23624
24614
  icon?: string | null;
23625
24615
  };
23626
24616
  };
23627
- `,y=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24617
+ `,S=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23628
24618
  import type React from 'react';
23629
24619
  import { createPortal } from 'react-dom';
23630
24620
  import { CommonComponentProps } from '../props';
@@ -24157,4 +25147,4 @@ export function Waterfall({
24157
25147
  </>
24158
25148
  );
24159
25149
  }
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;
25150
+ `,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;