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

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-D7E1yVzl.mjs +721 -0
  2. package/dist/Chronicles-hsVYwlUI.js +198 -0
  3. package/dist/ChroniclesComponent-9M_JIJlG.js +1 -0
  4. package/dist/{PretextComponent-BiS9XbZr.mjs → ChroniclesComponent-DrFDru99.mjs} +857 -425
  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-BDWmQ4M_.js +1 -0
  35. package/dist/{components-ljYgHKal.mjs → components-D6aHWqNw.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 +1031 -22
  43. package/dist/sources.mjs +1055 -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-9M_JIJlG.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,1016 @@ 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
+ // The editor switches layouts by changing the article vars, so the copied vars must follow them.
3350
+ const isLayerMounted = isOverlayMounted || (isInline && mountedRows.size > 0);
3351
+ useEffect(() => {
3352
+ const wrapper = wrapperRef.current;
3353
+ if (!isLayerMounted || !wrapper || typeof ResizeObserver === 'undefined') return;
3354
+ const update = () => setLayoutStyle((prev) => {
3355
+ const next = getLayoutStyle(wrapper);
3356
+ const isSame = LIGHTBOX_CSS_VARS.every((name) => (prev as Record<string, unknown>)[name] === (next as Record<string, unknown>)[name]);
3357
+ return isSame ? prev : next;
3358
+ });
3359
+ const observer = new ResizeObserver(update);
3360
+ observer.observe(wrapper);
3361
+ const layoutContainer = findLayoutContainer(wrapper);
3362
+ if (layoutContainer && layoutContainer !== wrapper) observer.observe(layoutContainer);
3363
+ return () => observer.disconnect();
3364
+ }, [isLayerMounted]);
3365
+
3366
+ useLayoutEffect(() => {
3367
+ if (!isOverlayMounted) return;
3368
+ updateClosePosition();
3369
+ window.addEventListener('resize', updateClosePosition);
3370
+ return () => window.removeEventListener('resize', updateClosePosition);
3371
+ }, [isOverlayMounted, layoutStyle, updateClosePosition]);
3372
+
3373
+ useEffect(() => {
3374
+ if (!isOpen || !isInteractive) return;
3375
+ closeRef.current?.focus({ preventScroll: true });
3376
+ const onKeyDown = (event: KeyboardEvent) => {
3377
+ if (event.key === 'Escape') setIsUserOpen(false);
3378
+ };
3379
+ document.addEventListener('keydown', onKeyDown);
3380
+ return () => document.removeEventListener('keydown', onKeyDown);
3381
+ }, [isOpen, isInteractive]);
3382
+
3383
+ // Inline media covers the page, so a copy of the panel is laid over the real one.
3384
+ useLayoutEffect(() => {
3385
+ if (!isInline || activeIndex === null) return;
3386
+ const panelEl = panelRef.current;
3387
+ const layer = inlineLayerRef.current;
3388
+ if (!panelEl || !layer) return;
3389
+ const panelRect = panelEl.getBoundingClientRect();
3390
+ const layerRect = layer.getBoundingClientRect();
3391
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
3392
+ }, [isInline, activeIndex]);
3393
+
3394
+ useEffect(() => {
3395
+ if (activeIndex !== null) return;
3396
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
3397
+ return () => window.clearTimeout(timer);
3398
+ }, [activeIndex]);
3399
+
3400
+ const isCopyShown = copyRect !== null;
3401
+ useEffect(() => {
3402
+ if (!isInline || !isCopyShown) return;
3403
+ const cut = () => {
3404
+ setIsMediaCut(true);
3405
+ setActiveIndex(null);
3406
+ setCopyRect(null);
3407
+ };
3408
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
3409
+ window.addEventListener('resize', cut);
3410
+ return () => {
3411
+ document.removeEventListener('scroll', cut, { capture: true });
3412
+ window.removeEventListener('resize', cut);
3413
+ };
3414
+ }, [isInline, isCopyShown]);
3415
+
3416
+ useEffect(() => {
3417
+ if (!isListShown) return;
3418
+ items.forEach((item) => getRowMedia(item).forEach((media) => {
3419
+ if (!isVideoMedia(media)) new Image().src = media.assetId;
3420
+ }));
3421
+ }, [isListShown, items]);
3422
+
3423
+ useEffect(() => {
3424
+ if (activeMedia.length < 2) return;
3425
+ const timer = window.setInterval(() => {
3426
+ setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
3427
+ }, hoverInterval);
3428
+ return () => window.clearInterval(timer);
3429
+ }, [activeIndex, activeMedia.length, hoverInterval]);
3430
+
3431
+ // Keep the replaced media under the next one until it has faded in; runs before paint to avoid a gap frame.
3432
+ useLayoutEffect(() => {
3433
+ const previous = shownMediaRef.current;
3434
+ shownMediaRef.current = shownMedia;
3435
+ if (shownMedia === null) return;
3436
+ setLastShownMedia(shownMedia);
3437
+ setCoveredMedia(previous);
3438
+ }, [shownMedia]);
3439
+
3440
+ useEffect(() => {
3441
+ if (!isShownMediaLoaded || coveredMedia === null) return;
3442
+ const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
3443
+ return () => window.clearTimeout(timer);
3444
+ }, [isShownMediaLoaded, coveredMedia]);
3445
+
3446
+ const close = () => {
3447
+ if (!isInteractive) return;
3448
+ setIsUserOpen(false);
3449
+ triggerRef.current?.focus({ preventScroll: true });
3450
+ };
3451
+
3452
+ const showRowMedia = (index: number) => {
3453
+ if (!isInteractive || getRowMedia(items[index]).length === 0) {
3454
+ setActiveIndex(null);
3455
+ return;
3456
+ }
3457
+ setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
3458
+ if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
3459
+ if (activeIndex !== index) setActiveMediaIndex(0);
3460
+ setIsMediaCut(false);
3461
+ setActiveIndex(index);
3462
+ };
3463
+
3464
+ const hideRowMedia = (index: number) => {
3465
+ setActiveIndex((current) => (current === index ? null : current));
3466
+ };
3467
+
3468
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
3469
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
3470
+ event.preventDefault();
3471
+ }
3472
+ };
3473
+
3474
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
3475
+ const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
3476
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
3477
+ ));
3478
+ const labelLineHeight = columnTypographyCss[0].lineHeight;
3479
+ const titleLineHeight = columnTypographyCss[1]?.lineHeight;
3480
+ const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
3481
+ ? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
3482
+ : undefined;
3483
+
3484
+ const colorVars = buildColorVars(P, {
3485
+ triggerColor,
3486
+ triggerHoverColor,
3487
+ closeColor,
3488
+ closeHoverColor,
3489
+ panelColor,
3490
+ textColor,
3491
+ textHoverColor,
3492
+ overlayColor,
3493
+ }, COLOR_VAR_MAP, []);
3494
+ const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
3495
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
3496
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
3497
+
3498
+ const mediaLayer = (
3499
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
3500
+ {[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
3501
+ const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
3502
+ return (
3503
+ <ChroniclesMediaItem
3504
+ key={mediaKey}
3505
+ P={P}
3506
+ media={media}
3507
+ isVisible={mediaKey === shownMedia}
3508
+ isLoaded={loadedMedia.has(mediaKey)}
3509
+ isCovered={mediaKey === coveredMedia}
3510
+ isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
3511
+ onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
3512
+ />
3513
+ );
3514
+ }))}
3515
+ </div>
3516
+ );
3517
+
3518
+ const renderPanel = (isCopy: boolean) => {
3519
+ const showControls = !isCopy && showPanelControls;
3520
+ return (
3521
+ <div
3522
+ ref={isCopy ? undefined : panelRef}
3523
+ className={cn(
3524
+ \`\${P}-panel\`,
3525
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
3526
+ isInline && \`\${P}-panel-inline\`,
3527
+ isCopy && \`\${P}-panel-copy\`,
3528
+ )}
3529
+ style={{
3530
+ width: scaled(panelWidth),
3531
+ paddingTop: scaled(panelPadding.top),
3532
+ paddingRight: scaled(panelPadding.right),
3533
+ paddingBottom: scaled(panelPadding.bottom),
3534
+ paddingLeft: scaled(panelPadding.left),
3535
+ borderRadius: scaled(panelRadius),
3536
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
3537
+ [\`--\${P}-panel-x\`]: panelOffset.x,
3538
+ [\`--\${P}-panel-y\`]: panelOffset.y,
3539
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
3540
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
3541
+ ...(isCopy && copyRect),
3542
+ } as CSSProperties}
3543
+ data-lightbox-scrollable={isInline ? undefined : ''}
3544
+ aria-hidden={isCopy || undefined}
3545
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
3546
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
3547
+ >
3548
+ {showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
3549
+ {showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
3550
+ {groups.map((group, groupIndex) => (
3551
+ <Fragment key={groupIndex}>
3552
+ {showControls && groupIndex > 0 && (
3553
+ <div
3554
+ data-controls="groupGap"
3555
+ data-controls-paired=""
3556
+ data-controls-axis="y"
3557
+ data-controls-reverse=""
3558
+ data-controls-min="0"
3559
+ className={\`\${P}-control-anchor\`}
3560
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
3561
+ />
3562
+ )}
3563
+ <div
3564
+ className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
3565
+ style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
3566
+ >
3567
+ {hasGroupColumn && (
3568
+ <span
3569
+ className={\`\${P}-group-label\`}
3570
+ style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
3571
+ >
3572
+ {group.label}
3573
+ </span>
3574
+ )}
3575
+ {group.rows.map(({ item, index }) => {
3576
+ const rowLink = !isCopy && item.link?.value ? item.link : undefined;
3577
+ const RowElement = rowLink ? 'a' : 'div';
3578
+ const linkProps = rowLink ? {
3579
+ href: buildValidUrl(rowLink.value),
3580
+ ...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
3581
+ } : {};
3582
+ const hoverProps = isCopy ? {} : {
3583
+ onMouseEnter: () => showRowMedia(index),
3584
+ onMouseLeave: () => hideRowMedia(index),
3585
+ onFocus: () => showRowMedia(index),
3586
+ onBlur: () => hideRowMedia(index),
3587
+ };
3588
+ return (
3589
+ <RowElement
3590
+ key={index}
3591
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
3592
+ {...linkProps}
3593
+ {...hoverProps}
3594
+ >
3595
+ {!hasGroupColumn && (
3596
+ <div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
3597
+ )}
3598
+ {titleKeys.map((key, titleIndex) => (
3599
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
3600
+ ))}
3601
+ </RowElement>
3602
+ );
3603
+ })}
3604
+ </div>
3605
+ </Fragment>
3606
+ ))}
3607
+ </div>
3608
+ );
3609
+ };
3610
+
3611
+ // The overlay and the inline list both render the panel with panelRef; keeping a closing overlay
3612
+ // around after switching to type A would detach the ref from the inline panel when it unmounts.
3613
+ const overlay = isOverlayMounted && !isInline ? (
3614
+ <div
3615
+ ref={overlayRef}
3616
+ className={cn(
3617
+ \`\${P}-overlay\`,
3618
+ isEditor && \`\${P}-overlay-editor\`,
3619
+ isEditMode && \`\${P}-overlay-edit-mode\`,
3620
+ isOverlayActive && \`\${P}-overlay-active\`,
3621
+ interactiveClass,
3622
+ stateClass,
3623
+ )}
3624
+ style={{ ...colorVars, ...layoutStyle }}
3625
+ role="dialog"
3626
+ aria-modal="true"
3627
+ aria-label={triggerLabel}
3628
+ data-selection="none"
3629
+ >
3630
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
3631
+ {mediaLayer}
3632
+ <button
3633
+ ref={closeRef}
3634
+ type="button"
3635
+ className={\`\${P}-close\`}
3636
+ style={{
3637
+ ...triggerTypographyCss,
3638
+ top: closePosition?.top ?? 0,
3639
+ left: closePosition?.left ?? 0,
3640
+ visibility: closePosition ? 'visible' : 'hidden',
3641
+ }}
3642
+ onClick={close}
3643
+ >
3644
+ {closeLabel}
3645
+ </button>
3646
+ {renderPanel(false)}
3647
+ </div>
3648
+ ) : null;
3649
+
3650
+ const inlineLayer = isInline && mountedRows.size > 0 ? (
3651
+ <div
3652
+ ref={inlineLayerRef}
3653
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
3654
+ style={{ ...colorVars, ...layoutStyle }}
3655
+ aria-hidden="true"
3656
+ data-selection="none"
3657
+ >
3658
+ {mediaLayer}
3659
+ {copyRect && renderPanel(true)}
3660
+ </div>
3661
+ ) : null;
3662
+ const portalContent = overlay ?? inlineLayer;
3663
+
3664
+ return (
3665
+ <>
3666
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
3667
+ <div
3668
+ ref={wrapperRef}
3669
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
3670
+ style={colorVars}
3671
+ >
3672
+ {isInline ? renderPanel(false) : (
3673
+ <button
3674
+ ref={triggerRef}
3675
+ type="button"
3676
+ className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
3677
+ style={triggerTypographyCss}
3678
+ aria-haspopup="dialog"
3679
+ aria-expanded={isOpen}
3680
+ onClick={() => {
3681
+ if (isInteractive) setIsUserOpen(true);
3682
+ }}
3683
+ >
3684
+ {triggerLabel}
3685
+ </button>
3686
+ )}
3687
+ </div>
3688
+ {portalContent && typeof document !== 'undefined' && createPortal(
3689
+ portalContent,
3690
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
3691
+ )}
3692
+ </>
3693
+ );
3694
+ }
3695
+ `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2687
3696
  import { CommonComponentProps } from '../props';
2688
3697
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2689
3698
 
@@ -3212,7 +4221,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3212
4221
  </>
3213
4222
  );
3214
4223
  }
3215
- `,i=`import { useCallback, useEffect, useMemo, useState } from 'react';
4224
+ `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
3216
4225
  import cn from 'classnames';
3217
4226
  import { CommonComponentProps } from '../props';
3218
4227
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3960,7 +4969,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3960
4969
  </>
3961
4970
  );
3962
4971
  }
3963
- `,o=`import React, { useMemo, useState } from 'react';
4972
+ `,r=`import React, { useMemo, useState } from 'react';
3964
4973
  import { CommonComponentProps } from '../props';
3965
4974
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3966
4975
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4598,7 +5607,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4598
5607
  };
4599
5608
 
4600
5609
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4601
- `,r=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5610
+ `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
4602
5611
  import '@splidejs/react-splide/css/core';
4603
5612
  import { CommonComponentProps } from '../props';
4604
5613
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -6913,7 +7922,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6913
7922
  };
6914
7923
 
6915
7924
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6916
- `,a=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7925
+ `,s=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6917
7926
  import { CommonComponentProps } from '../props';
6918
7927
  import { scalingValue } from '../utils/scalingValue';
6919
7928
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -7486,7 +8495,7 @@ export function Helix({
7486
8495
  </>
7487
8496
  );
7488
8497
  }
7489
- `,s=`import { CommonComponentProps } from '../props';
8498
+ `,l=`import { CommonComponentProps } from '../props';
7490
8499
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7491
8500
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7492
8501
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -9938,7 +10947,7 @@ export function Hive({
9938
10947
  </>
9939
10948
  );
9940
10949
  }
9941
- `,l=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10950
+ `,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9942
10951
  import { createPortal } from 'react-dom';
9943
10952
  import { CommonComponentProps } from '../props';
9944
10953
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10703,7 +11712,7 @@ export type LightboxJournalSettings = {
10703
11712
  closeIconColor: string;
10704
11713
  closeIconHoverColor: string;
10705
11714
  };
10706
- `,c=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
11715
+ `,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
10707
11716
  import { createPortal } from 'react-dom';
10708
11717
  import { CommonComponentProps } from '../props';
10709
11718
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11249,7 +12258,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11249
12258
  </>
11250
12259
  );
11251
12260
  };
11252
- `,d=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12261
+ `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11253
12262
  import { createPortal } from 'react-dom';
11254
12263
  import { CommonComponentProps } from '../props';
11255
12264
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -14354,7 +15363,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14354
15363
  </>
14355
15364
  );
14356
15365
  }
14357
- `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15366
+ `,g=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14358
15367
  import cn from 'classnames';
14359
15368
  import { CommonComponentProps } from '../props';
14360
15369
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15212,7 +16221,7 @@ type MarqueeProps = {
15212
16221
  isPreviewMode?: boolean;
15213
16222
  isEditMode?: boolean;
15214
16223
  } & CommonComponentProps;
15215
- `,g=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16224
+ `,m=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15216
16225
  import cn from 'classnames';
15217
16226
  import { CommonComponentProps } from '../props';
15218
16227
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16155,7 +17164,7 @@ type MarqueeTextProps = {
16155
17164
  isPreviewMode?: boolean;
16156
17165
  isEditMode?: boolean;
16157
17166
  } & CommonComponentProps;
16158
- `,m=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17167
+ `,p=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16159
17168
  import { createPortal } from 'react-dom';
16160
17169
  import type React from 'react';
16161
17170
  import { CommonComponentProps } from '../props';
@@ -18637,7 +19646,7 @@ export function Mercury({
18637
19646
  </>
18638
19647
  );
18639
19648
  }
18640
- `,p=`import React, { useMemo, useState } from 'react';
19649
+ `,h=`import React, { useMemo, useState } from 'react';
18641
19650
  import { CommonComponentProps } from '../props';
18642
19651
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18643
19652
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19216,7 +20225,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19216
20225
  };
19217
20226
 
19218
20227
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19219
- `,h=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20228
+ `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19220
20229
  import type React from 'react';
19221
20230
  import { CommonComponentProps } from '../props';
19222
20231
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -20055,7 +21064,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
20055
21064
  </>
20056
21065
  );
20057
21066
  }
20058
- `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21067
+ `,v=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20059
21068
  import cn from 'classnames';
20060
21069
  import { CommonComponentProps } from '../props';
20061
21070
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20683,7 +21692,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20683
21692
  </>
20684
21693
  );
20685
21694
  }
20686
- `,v=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21695
+ `,P=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20687
21696
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20688
21697
  import { CommonComponentProps } from '../props';
20689
21698
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21315,7 +22324,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21315
22324
  </>
21316
22325
  );
21317
22326
  }
21318
- `,P=`import React, { useCallback, useEffect, useRef, useState } from 'react';
22327
+ `,x=`import React, { useCallback, useEffect, useRef, useState } from 'react';
21319
22328
  import cn from 'classnames';
21320
22329
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21321
22330
  import { scalingValue } from '../utils/scalingValue';
@@ -22497,7 +23506,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22497
23506
  </svg>
22498
23507
  );
22499
23508
  }
22500
- `,x=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23509
+ `,b=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22501
23510
  import cn from 'classnames';
22502
23511
  import { CommonComponentProps } from '../props';
22503
23512
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23128,7 +24137,7 @@ type TestimonialsSettings = {
23128
24137
  logoHeight: number;
23129
24138
  captionMarginTop: number;
23130
24139
  };
23131
- `,b=`import cn from 'classnames';
24140
+ `,y=`import cn from 'classnames';
23132
24141
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
23133
24142
  import { CommonComponentProps } from '../props';
23134
24143
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23624,7 +24633,7 @@ type TestimonialsSettings = {
23624
24633
  icon?: string | null;
23625
24634
  };
23626
24635
  };
23627
- `,y=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24636
+ `,S=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23628
24637
  import type React from 'react';
23629
24638
  import { createPortal } from 'react-dom';
23630
24639
  import { CommonComponentProps } from '../props';
@@ -24157,4 +25166,4 @@ export function Waterfall({
24157
25166
  </>
24158
25167
  );
24159
25168
  }
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;
25169
+ `,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;