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

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/{ClickGallerie-41L7IKhN.js → ClickGallerie-CYQMgrIr.js} +1 -1
  2. package/dist/{ClickGallerie-CBquEuXQ.mjs → ClickGallerie-o2U6oyOF.mjs} +1 -1
  3. package/dist/Components/utils/LinkWrapper.d.ts +0 -1
  4. package/dist/{ControlSlider-D91b53un.js → ControlSlider-Kkec-i14.js} +1 -1
  5. package/dist/{ControlSlider-mp-LvrTR.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  6. package/dist/{FAQ-8goVE-aB.js → FAQ-BxhMo7T8.js} +1 -1
  7. package/dist/{FAQ-KL9X1-xe.mjs → FAQ-CdwSft5p.mjs} +1 -1
  8. package/dist/{Grid-Dec4bMvK.js → Grid-CFHTP3mb.js} +1 -1
  9. package/dist/{Grid-wxlTwFLb.mjs → Grid-e-gLfsji.mjs} +1 -1
  10. package/dist/{ImageRevealSlider-Bv092gwv.js → ImageRevealSlider-BuukTGAK.js} +1 -1
  11. package/dist/{ImageRevealSlider-K_nNoquq.mjs → ImageRevealSlider-Df9sygk9.mjs} +1 -1
  12. package/dist/{Lightbox-Cyvva2uu.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  13. package/dist/{Lightbox-C2r7Wt_8.js → Lightbox-DaunVrkp.js} +1 -1
  14. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  15. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  16. package/dist/{Marquee-DGbeihUh.mjs → Marquee-DByooiWP.mjs} +1 -1
  17. package/dist/{Marquee-BacOdRJ9.js → Marquee-DfIP-tIN.js} +1 -1
  18. package/dist/{MarqueeText-DTlCevPX.mjs → MarqueeText-D6FNCe6P.mjs} +1 -1
  19. package/dist/{MarqueeText-BuEx2FCt.js → MarqueeText-DsUiV6Zv.js} +1 -1
  20. package/dist/{ChroniclesComponent-9Fi2A06B.mjs → PretextComponent-BiS9XbZr.mjs} +425 -857
  21. package/dist/PretextComponent-DWOy-dqD.js +1 -0
  22. package/dist/{RichTextRenderer-DizfCZEz.mjs → RichTextRenderer-BptwNpbJ.mjs} +1 -1
  23. package/dist/{RichTextRenderer-CUEc4FaL.js → RichTextRenderer-K90Dd7pt.js} +1 -1
  24. package/dist/{Slider20-DS-FTzQC.mjs → Slider20-CCzixTiN.mjs} +1 -1
  25. package/dist/{Slider20-BdeHmG8C.js → Slider20-fMVeRfgx.js} +1 -1
  26. package/dist/{TestimonialGrid-BOqSqVin.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  27. package/dist/{TestimonialGrid-B0JHzqhv.js → TestimonialGrid-CiCagfBU.js} +1 -1
  28. package/dist/{TestimonialSingle-7-PMnQ7u.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  29. package/dist/{TestimonialSingle-Bx_V-cYE.js → TestimonialSingle-BWXynGjv.js} +1 -1
  30. package/dist/components-CJlisugq.js +1 -0
  31. package/dist/{components-Qpn7IZ0W.mjs → components-ljYgHKal.mjs} +17 -18
  32. package/dist/elements.js +1 -1
  33. package/dist/elements.mjs +15 -16
  34. package/dist/elements.node.js +1 -1
  35. package/dist/elements.node.mjs +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/index.mjs +2 -2
  38. package/dist/sources.js +22 -1012
  39. package/dist/sources.mjs +45 -1036
  40. package/dist/utils.js +1 -1
  41. package/dist/utils.mjs +1 -1
  42. package/package.json +1 -1
  43. package/dist/Chronicles-DBM6UcTB.mjs +0 -711
  44. package/dist/Chronicles-DTjRzRhE.js +0 -198
  45. package/dist/ChroniclesComponent-DILYPR6b.js +0 -1
  46. package/dist/Components/Chronicles/Chronicles.d.ts +0 -120
  47. package/dist/Components/Chronicles/ChroniclesComponent.d.ts +0 -313
  48. package/dist/LinkWrapper-CFEH047t.mjs +0 -14
  49. package/dist/LinkWrapper-CzFwFtgU.js +0 -1
  50. package/dist/components-BJdVsqb6.js +0 -1
package/dist/sources.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-9Fi2A06B.mjs";
2
- const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, B as b } from "./PretextComponent-BiS9XbZr.mjs";
2
+ const y = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
3
  import { CommonComponentProps } from '../props';
4
4
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
5
5
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -2684,997 +2684,7 @@ export function Burger({
2684
2684
  </div>
2685
2685
  );
2686
2686
  }
2687
- `, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2688
- import { createPortal } from 'react-dom';
2689
- import cn from 'classnames';
2690
- import { CommonComponentProps } from '../props';
2691
- import { buildColorVars, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
2692
- import { buildValidUrl } from '../utils/LinkWrapper';
2693
- import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
2694
- import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
2695
-
2696
- export const CHRONICLES_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
2697
- export const CHRONICLES_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
2698
- export const CHRONICLES_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
2699
-
2700
- const TITLE_KEYS = ['title', ...CHRONICLES_EXTRA_TITLE_KEYS] as const;
2701
-
2702
- const PANEL_POSITION_OFFSETS = {
2703
- center: { x: '50%', y: '50%' },
2704
- 'left-top': { x: '0%', y: '0%' },
2705
- 'top-center': { x: '50%', y: '0%' },
2706
- 'top-right': { x: '100%', y: '0%' },
2707
- 'left-center': { x: '0%', y: '50%' },
2708
- 'right-center': { x: '100%', y: '50%' },
2709
- 'left-bottom': { x: '0%', y: '100%' },
2710
- 'bottom-center': { x: '50%', y: '100%' },
2711
- 'right-bottom': { x: '100%', y: '100%' },
2712
- } as const;
2713
-
2714
- type ChroniclesPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
2715
-
2716
- export const CHRONICLES_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ChroniclesPanelPosition[];
2717
-
2718
- const OVERLAY_ANIM_MS = 300;
2719
- const IMAGE_FADE_MS = 300;
2720
- const MIN_HANDLE_SIZE = 0.004;
2721
- const MIN_COLUMN_WIDTH_PX = 20;
2722
- const VIDEO_EXTENSION_RE = /\\.(mp4|webm|ogg|mov)(\\?|$)/i;
2723
-
2724
- const LIGHTBOX_CSS_VARS = [
2725
- '--cntrl-article-width',
2726
- '--cntrl-article-top',
2727
- '--cntrl-article-left',
2728
- '--cntrl-viewport-height',
2729
- ] as const;
2730
-
2731
- const COLOR_VAR_MAP = {
2732
- triggerColor: 'trigger-color',
2733
- triggerHoverColor: 'trigger-hover-color',
2734
- closeColor: 'close-color',
2735
- closeHoverColor: 'close-hover-color',
2736
- panelColor: 'panel-color',
2737
- textColor: 'text-color',
2738
- textHoverColor: 'text-hover-color',
2739
- overlayColor: 'overlay-color',
2740
- } as const;
2741
-
2742
- const PADDING_CONTROLS = [
2743
- { side: 'top', axis: 'y', variant: 'row-padding' },
2744
- { side: 'bottom', axis: 'y', variant: 'row-padding', reverse: true },
2745
- { side: 'left', axis: 'x', variant: 'column-padding', opposite: 'right' },
2746
- { side: 'right', axis: 'x', variant: 'column-padding', opposite: 'left', reverse: true },
2747
- ] as const;
2748
-
2749
- type Padding = { top: number; right: number; bottom: number; left: number };
2750
-
2751
- type ColumnWidthKey = typeof CHRONICLES_COLUMN_WIDTH_KEYS[number];
2752
-
2753
- type TextStylePrefix = 'trigger' | typeof CHRONICLES_COLUMN_STYLE_PREFIXES[number];
2754
-
2755
- type ChroniclesMedia = {
2756
- assetId: string;
2757
- name?: string;
2758
- type?: 'image' | 'video';
2759
- objectFit?: 'cover' | 'contain';
2760
- };
2761
-
2762
- type ChroniclesItem = {
2763
- group?: string;
2764
- title?: string;
2765
- title2?: string;
2766
- title3?: string;
2767
- title4?: string;
2768
- image?: ChroniclesMedia[];
2769
- link?: ContentLink;
2770
- };
2771
-
2772
- type ChroniclesGroup = {
2773
- label: string;
2774
- rows: { item: ChroniclesItem; index: number }[];
2775
- };
2776
-
2777
- type TextStyleFields = {
2778
- FontFamily: string;
2779
- FontSettings: { fontWeight: number; fontStyle: string };
2780
- FontSize: number;
2781
- LineHeight: number;
2782
- LetterSpacing: number;
2783
- WordSpacing: number;
2784
- TextAlign?: TextStyles['textAlign'];
2785
- TextAppearance: TextStyles['textAppearance'];
2786
- };
2787
-
2788
- type PrefixedTextStyle<Prefix extends string> = {
2789
- [Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]: TextStyleFields[Key];
2790
- };
2791
-
2792
- type ChroniclesSettings = PrefixedTextStyle<TextStylePrefix> & Partial<Record<ColumnWidthKey, number>> & {
2793
- type: 'a' | 'b';
2794
- triggerLabel: string;
2795
- closeLabel: string;
2796
- columns: number;
2797
- columnGap: number;
2798
- hoverInterval: number;
2799
- panelPosition: ChroniclesPanelPosition;
2800
- panelWidth: number;
2801
- panelPadding: Padding;
2802
- panelRadius: number;
2803
- groupGap: number;
2804
- triggerColor: string;
2805
- triggerHoverColor: string;
2806
- closeColor: string;
2807
- closeHoverColor: string;
2808
- panelColor: string;
2809
- textColor: string;
2810
- textHoverColor: string;
2811
- overlayColor: string;
2812
- };
2813
-
2814
- type ColumnLayoutSettings = Pick<ChroniclesSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding' | ColumnWidthKey>;
2815
-
2816
- type ChroniclesProps = {
2817
- settings: ChroniclesSettings;
2818
- content?: ChroniclesItem[];
2819
- isEditor?: boolean;
2820
- isEditMode?: boolean;
2821
- isPreviewMode?: boolean;
2822
- activeEvent?: string;
2823
- portalId?: string;
2824
- } & CommonComponentProps;
2825
-
2826
- function getColumnsSpace({ columns, columnGap, panelWidth, panelPadding }: ColumnLayoutSettings): number {
2827
- return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - (columns - 1) * columnGap);
2828
- }
2829
-
2830
- export function getChroniclesEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ColumnWidthKey, number>> {
2831
- const width = getColumnsSpace(settings) / settings.columns;
2832
- return Object.fromEntries(CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => [key, width]));
2833
- }
2834
-
2835
- export function applyChroniclesColumnCountChange(
2836
- nextSettings: Record<string, any>,
2837
- prevSettings: Record<string, any>,
2838
- ): Record<string, any> {
2839
- if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
2840
- return nextSettings;
2841
- }
2842
- return { ...nextSettings, ...getChroniclesEqualColumnWidths({ ...prevSettings, ...nextSettings } as ColumnLayoutSettings) };
2843
- }
2844
-
2845
- // The last column takes the remaining space; sized columns shrink together when they no longer fit.
2846
- function resolveColumnWidths(settings: ColumnLayoutSettings): number[] {
2847
- const space = getColumnsSpace(settings);
2848
- const sized = CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => {
2849
- const width = settings[key];
2850
- return typeof width === 'number' ? Math.max(0, width) : space / settings.columns;
2851
- });
2852
- const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
2853
- const scale = sizedTotal > space ? space / sizedTotal : 1;
2854
- return [...sized.map((width) => width * scale), Math.max(0, space - sizedTotal * scale)];
2855
- }
2856
-
2857
- function getGridTemplateColumns(widths: number[]): string {
2858
- const total = widths.reduce((sum, width) => sum + width, 0);
2859
- return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
2860
- }
2861
-
2862
- // A row with an empty group continues the group above it.
2863
- function groupRows(items: ChroniclesItem[]): ChroniclesGroup[] {
2864
- const groups: ChroniclesGroup[] = [];
2865
- items.forEach((item, index) => {
2866
- const label = item.group?.trim() ?? '';
2867
- const current = groups[groups.length - 1];
2868
- if (!current || (label !== '' && label !== current.label)) {
2869
- groups.push({ label, rows: [{ item, index }] });
2870
- return;
2871
- }
2872
- current.rows.push({ item, index });
2873
- });
2874
- return groups;
2875
- }
2876
-
2877
- function getRowMedia(item: ChroniclesItem | undefined): ChroniclesMedia[] {
2878
- return (item?.image ?? []).filter((media) => Boolean(media?.assetId));
2879
- }
2880
-
2881
- function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
2882
- return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
2883
- }
2884
-
2885
- function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
2886
- if (type) return type === 'video';
2887
- return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
2888
- }
2889
-
2890
- function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
2891
- for (let el = element; el; el = el.parentElement) {
2892
- if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) return el;
2893
- }
2894
- return element;
2895
- }
2896
-
2897
- function getLayoutStyle(container: HTMLElement | null): CSSProperties {
2898
- const layoutContainer = findLayoutContainer(container);
2899
- if (!layoutContainer) return {};
2900
- const computed = getComputedStyle(layoutContainer);
2901
- return Object.fromEntries(
2902
- LIGHTBOX_CSS_VARS
2903
- .map((name) => [name, computed.getPropertyValue(name).trim()])
2904
- .filter(([, value]) => value),
2905
- );
2906
- }
2907
-
2908
- function resolveTextStyle(settings: ChroniclesSettings, prefix: TextStylePrefix): TextStyles {
2909
- const read = <Key extends keyof TextStyleFields>(key: Key) => (
2910
- (settings as Record<string, unknown>)[\`\${prefix}\${key}\`] as TextStyleFields[Key]
2911
- );
2912
- return {
2913
- fontSettings: { fontFamily: read('FontFamily'), ...read('FontSettings') },
2914
- fontSize: read('FontSize'),
2915
- lineHeight: read('LineHeight'),
2916
- letterSpacing: read('LetterSpacing'),
2917
- wordSpacing: read('WordSpacing'),
2918
- textAlign: read('TextAlign'),
2919
- textAppearance: read('TextAppearance'),
2920
- color: '#000000',
2921
- };
2922
- }
2923
-
2924
- function getCSS(P: string): string {
2925
- return \`
2926
- .\${P}-trigger,
2927
- .\${P}-close {
2928
- display: inline-block;
2929
- margin: 0;
2930
- padding: 0;
2931
- border: 0;
2932
- background: none;
2933
- cursor: pointer;
2934
- white-space: nowrap;
2935
- transition: color 150ms ease;
2936
- -webkit-appearance: none;
2937
- appearance: none;
2938
- -webkit-tap-highlight-color: transparent;
2939
- }
2940
- .\${P}-trigger {
2941
- color: var(--\${P}-trigger-color);
2942
- transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
2943
- }
2944
- .\${P}-trigger-hidden {
2945
- opacity: 0;
2946
- }
2947
- .\${P}-close {
2948
- position: absolute;
2949
- z-index: 2;
2950
- color: var(--\${P}-close-color);
2951
- }
2952
- .\${P}-trigger:focus,
2953
- .\${P}-close:focus {
2954
- outline: none;
2955
- }
2956
- .\${P}-trigger:focus-visible,
2957
- .\${P}-close:focus-visible {
2958
- outline: 1px solid currentColor;
2959
- outline-offset: 2px;
2960
- }
2961
- .\${P}-interactive .\${P}-trigger:hover,
2962
- .\${P}-state-hover .\${P}-trigger {
2963
- color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
2964
- }
2965
- .\${P}-close:hover {
2966
- color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
2967
- }
2968
- .\${P}-editor .\${P}-trigger {
2969
- cursor: default;
2970
- }
2971
- .\${P}-overlay {
2972
- position: fixed;
2973
- inset: 0;
2974
- z-index: 9997;
2975
- overflow: hidden;
2976
- overscroll-behavior: none;
2977
- opacity: 0;
2978
- pointer-events: none;
2979
- transition: opacity \${OVERLAY_ANIM_MS}ms ease;
2980
- }
2981
- .\${P}-inline-layer {
2982
- position: fixed;
2983
- inset: 0;
2984
- z-index: 9997;
2985
- overflow: hidden;
2986
- pointer-events: none;
2987
- }
2988
- .\${P}-overlay-editor {
2989
- inset: auto;
2990
- top: var(--cntrl-article-top, 0);
2991
- left: var(--cntrl-article-left, 0);
2992
- width: var(--cntrl-article-width, 100vw) !important;
2993
- height: var(--cntrl-viewport-height, 100vh) !important;
2994
- }
2995
- .\${P}-overlay-edit-mode {
2996
- z-index: 1;
2997
- }
2998
- .\${P}-overlay-active {
2999
- opacity: 1;
3000
- pointer-events: auto;
3001
- }
3002
- .\${P}-backdrop {
3003
- position: absolute;
3004
- inset: 0;
3005
- background-color: var(--\${P}-overlay-color);
3006
- }
3007
- .\${P}-media-layer {
3008
- position: absolute;
3009
- inset: 0;
3010
- pointer-events: none;
3011
- }
3012
- .\${P}-media {
3013
- position: absolute;
3014
- inset: 0;
3015
- width: 100%;
3016
- height: 100%;
3017
- object-fit: cover;
3018
- opacity: 0;
3019
- }
3020
- .\${P}-media-contain {
3021
- object-fit: contain;
3022
- }
3023
- .\${P}-media-visible,
3024
- .\${P}-media-fading {
3025
- transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
3026
- }
3027
- .\${P}-media-visible {
3028
- z-index: 1;
3029
- opacity: 1;
3030
- }
3031
- .\${P}-media-covered {
3032
- opacity: 1;
3033
- }
3034
- .\${P}-media-fading {
3035
- opacity: 0;
3036
- }
3037
- .\${P}-media-layer-instant .\${P}-media {
3038
- transition: none;
3039
- }
3040
- .\${P}-panel {
3041
- position: absolute;
3042
- top: var(--\${P}-panel-y);
3043
- left: var(--\${P}-panel-x);
3044
- z-index: 1;
3045
- box-sizing: border-box;
3046
- max-width: 100%;
3047
- max-height: 100%;
3048
- overflow-y: auto;
3049
- transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
3050
- background-color: var(--\${P}-panel-color);
3051
- color: var(--\${P}-text-color);
3052
- overscroll-behavior: contain;
3053
- transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
3054
- }
3055
- .\${P}-overlay-active .\${P}-panel {
3056
- transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
3057
- }
3058
- .\${P}-panel-settled {
3059
- transition: none;
3060
- }
3061
- .\${P}-panel-inline {
3062
- position: relative;
3063
- top: auto;
3064
- left: auto;
3065
- max-height: none;
3066
- transform: none;
3067
- transition: none;
3068
- }
3069
- .\${P}-panel-copy {
3070
- position: absolute;
3071
- pointer-events: none;
3072
- }
3073
- @media (prefers-reduced-motion: reduce) {
3074
- .\${P}-panel {
3075
- transition: none;
3076
- }
3077
- }
3078
- .\${P}-group {
3079
- display: grid;
3080
- grid-template-columns: var(--\${P}-grid-columns);
3081
- column-gap: var(--\${P}-column-gap);
3082
- }
3083
- .\${P}-group ~ .\${P}-group {
3084
- margin-top: var(--\${P}-group-gap);
3085
- }
3086
- .\${P}-group-label {
3087
- grid-column: 1;
3088
- align-self: start;
3089
- min-width: 0;
3090
- overflow-wrap: anywhere;
3091
- }
3092
- .\${P}-row {
3093
- grid-column: 2 / -1;
3094
- display: grid;
3095
- grid-template-columns: subgrid;
3096
- align-items: baseline;
3097
- }
3098
- a.\${P}-row {
3099
- color: inherit;
3100
- text-decoration: none;
3101
- }
3102
- .\${P}-group-unlabeled .\${P}-row {
3103
- grid-column: 1 / -1;
3104
- }
3105
- .\${P}-title {
3106
- min-width: 0;
3107
- overflow-wrap: anywhere;
3108
- white-space: pre-line;
3109
- transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
3110
- }
3111
- .\${P}-interactive .\${P}-row:hover .\${P}-title,
3112
- .\${P}-row:focus-visible .\${P}-title,
3113
- .\${P}-panel-copy .\${P}-row-active .\${P}-title,
3114
- .\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
3115
- color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
3116
- }
3117
- .\${P}-control-anchor {
3118
- position: absolute;
3119
- pointer-events: none;
3120
- z-index: 2;
3121
- }
3122
- \`;
3123
- }
3124
-
3125
- type ChroniclesMediaItemProps = {
3126
- P: string;
3127
- media: ChroniclesMedia;
3128
- isVisible: boolean;
3129
- isLoaded: boolean;
3130
- isCovered: boolean;
3131
- isFading: boolean;
3132
- onLoad: () => void;
3133
- };
3134
-
3135
- function ChroniclesMediaItem({ P, media, isVisible, isLoaded, isCovered, isFading, onLoad }: ChroniclesMediaItemProps) {
3136
- const videoRef = useRef<HTMLVideoElement>(null);
3137
- const isVideo = isVideoMedia(media);
3138
- const className = cn(
3139
- \`\${P}-media\`,
3140
- media.objectFit === 'contain' && \`\${P}-media-contain\`,
3141
- isVisible && isLoaded && \`\${P}-media-visible\`,
3142
- isCovered && \`\${P}-media-covered\`,
3143
- isFading && \`\${P}-media-fading\`,
3144
- );
3145
-
3146
- useEffect(() => {
3147
- const video = videoRef.current;
3148
- if (!video) return;
3149
- if (isVisible) {
3150
- video.play()?.catch(() => {});
3151
- } else {
3152
- video.pause();
3153
- }
3154
- }, [isVisible]);
3155
-
3156
- if (isVideo) {
3157
- return (
3158
- <video
3159
- ref={videoRef}
3160
- className={className}
3161
- src={media.assetId}
3162
- muted
3163
- loop
3164
- playsInline
3165
- preload="auto"
3166
- onLoadedData={onLoad}
3167
- />
3168
- );
3169
- }
3170
-
3171
- return <img className={className} src={media.assetId} alt="" decoding="async" onLoad={onLoad} />;
3172
- }
3173
-
3174
- function renderColumnWidthControls(
3175
- P: string,
3176
- widths: number[],
3177
- paddingLeft: number,
3178
- columnGap: number,
3179
- scaled: (value: number) => string,
3180
- ) {
3181
- const lastWidth = widths[widths.length - 1];
3182
- let columnLeft = paddingLeft;
3183
- return widths.slice(0, -1).map((width, index) => {
3184
- const gapCenter = columnLeft + width + columnGap / 2;
3185
- columnLeft += width + columnGap;
3186
- return (
3187
- <div
3188
- key={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
3189
- data-controls={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
3190
- data-controls-axis="x"
3191
- data-controls-variant="column-width"
3192
- data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
3193
- data-controls-max-fraction={String(width + lastWidth)}
3194
- className={\`\${P}-control-anchor\`}
3195
- style={{ top: 0, left: scaled(gapCenter - MIN_HANDLE_SIZE / 2), width: scaled(MIN_HANDLE_SIZE), height: '100%' }}
3196
- />
3197
- );
3198
- });
3199
- }
3200
-
3201
- function renderPanelPaddingControls(
3202
- P: string,
3203
- panelWidth: number,
3204
- padding: Padding,
3205
- scaled: (value: number) => string,
3206
- ) {
3207
- return PADDING_CONTROLS.map((control) => {
3208
- const size = scaled(Math.max(padding[control.side], MIN_HANDLE_SIZE));
3209
- const isHorizontal = control.axis === 'x';
3210
- return (
3211
- <div
3212
- key={control.side}
3213
- data-controls={\`panelPadding.\${control.side}\`}
3214
- data-controls-axis={control.axis}
3215
- data-controls-variant={control.variant}
3216
- data-controls-reverse={'reverse' in control ? '' : undefined}
3217
- data-controls-min="0"
3218
- data-controls-max-fraction={'opposite' in control ? String(Math.max(0, panelWidth - padding[control.opposite])) : undefined}
3219
- className={\`\${P}-control-anchor\`}
3220
- style={{
3221
- [control.side]: 0,
3222
- ...(isHorizontal ? { top: 0, width: size, height: '100%' } : { left: 0, width: '100%', height: size }),
3223
- }}
3224
- />
3225
- );
3226
- });
3227
- }
3228
-
3229
- export function Chronicles({
3230
- settings,
3231
- content,
3232
- isEditor,
3233
- isEditMode,
3234
- isPreviewMode,
3235
- activeEvent,
3236
- portalId,
3237
- currentState,
3238
- unavailableStates,
3239
- }: ChroniclesProps) {
3240
- const { prefix: P } = useScopedStyles();
3241
- const {
3242
- type,
3243
- triggerLabel,
3244
- closeLabel,
3245
- columns,
3246
- columnGap,
3247
- hoverInterval,
3248
- panelPosition,
3249
- panelWidth,
3250
- panelPadding,
3251
- panelRadius,
3252
- groupGap,
3253
- triggerColor,
3254
- triggerHoverColor,
3255
- closeColor,
3256
- closeHoverColor,
3257
- panelColor,
3258
- textColor,
3259
- textHoverColor,
3260
- overlayColor,
3261
- } = settings;
3262
- const items = useMemo(() => content ?? [], [content]);
3263
- const wrapperRef = useRef<HTMLDivElement>(null);
3264
- const triggerRef = useRef<HTMLButtonElement>(null);
3265
- const overlayRef = useRef<HTMLDivElement>(null);
3266
- const closeRef = useRef<HTMLButtonElement>(null);
3267
- const panelRef = useRef<HTMLDivElement>(null);
3268
- const inlineLayerRef = useRef<HTMLDivElement>(null);
3269
- const shownMediaRef = useRef<string | null>(null);
3270
- const [isUserOpen, setIsUserOpen] = useState(false);
3271
- const [isOverlayMounted, setIsOverlayMounted] = useState(false);
3272
- const [isOverlayActive, setIsOverlayActive] = useState(false);
3273
- const [isOverlaySettled, setIsOverlaySettled] = useState(false);
3274
- const [activeIndex, setActiveIndex] = useState<number | null>(null);
3275
- const [activeMediaIndex, setActiveMediaIndex] = useState(0);
3276
- const [mountedRows, setMountedRows] = useState<Set<number>>(() => new Set());
3277
- const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
3278
- const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
3279
- const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
3280
- const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
3281
- const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
3282
- const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
3283
- const [isMediaCut, setIsMediaCut] = useState(false);
3284
-
3285
- const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
3286
- const isInteractive = !isEditorCanvas;
3287
- const isInline = type === 'a';
3288
- const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
3289
- const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isUserOpen));
3290
- const isListShown = isInteractive && (isInline || isOpen);
3291
- const scaled = (value: number) => scalingValue(value, isEditor ?? false);
3292
- const scopedCss = useMemo(() => getCSS(P), [P]);
3293
- const panelOffset = PANEL_POSITION_OFFSETS[panelPosition];
3294
- const columnWidths = resolveColumnWidths(settings);
3295
- const titleKeys = TITLE_KEYS.slice(0, columns - 1);
3296
- const hasGroupColumn = columns > 1;
3297
- const groups = useMemo<ChroniclesGroup[]>(() => (
3298
- hasGroupColumn ? groupRows(items) : [{ label: '', rows: items.map((item, index) => ({ item, index })) }]
3299
- ), [items, hasGroupColumn]);
3300
-
3301
- const activeMedia = activeIndex === null ? [] : getRowMedia(items[activeIndex]);
3302
- const shownAsset = activeMedia[activeMediaIndex];
3303
- const shownMedia = activeIndex !== null && shownAsset ? getMediaKey(activeIndex, activeMediaIndex, shownAsset.assetId) : null;
3304
- const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
3305
-
3306
- useLightboxScrollLock(isOpen && !isEditorCanvas);
3307
-
3308
- useEffect(() => {
3309
- if (isEditorCanvas && !isEditMode) setIsUserOpen(false);
3310
- }, [isEditorCanvas, isEditMode]);
3311
-
3312
- useEffect(() => {
3313
- if (isOpen) {
3314
- setLayoutStyle(getLayoutStyle(wrapperRef.current));
3315
- setIsOverlayMounted(true);
3316
- return;
3317
- }
3318
- setIsOverlayActive(false);
3319
- setActiveIndex(null);
3320
- const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
3321
- return () => window.clearTimeout(timer);
3322
- }, [isOpen]);
3323
-
3324
- // Activate a frame after mount so the appear transition has a start state.
3325
- useEffect(() => {
3326
- if (!isOpen || !isOverlayMounted) return;
3327
- overlayRef.current?.getBoundingClientRect();
3328
- const frame = requestAnimationFrame(() => setIsOverlayActive(true));
3329
- return () => cancelAnimationFrame(frame);
3330
- }, [isOpen, isOverlayMounted]);
3331
-
3332
- useEffect(() => {
3333
- if (!isOverlayActive) {
3334
- setIsOverlaySettled(false);
3335
- return;
3336
- }
3337
- const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
3338
- return () => window.clearTimeout(timer);
3339
- }, [isOverlayActive]);
3340
-
3341
- const updateClosePosition = useCallback(() => {
3342
- const trigger = triggerRef.current;
3343
- const overlay = overlayRef.current;
3344
- if (!trigger || !overlay) return;
3345
- const triggerRect = trigger.getBoundingClientRect();
3346
- const overlayRect = overlay.getBoundingClientRect();
3347
- setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
3348
- }, []);
3349
-
3350
- useLayoutEffect(() => {
3351
- if (!isOverlayMounted) return;
3352
- updateClosePosition();
3353
- window.addEventListener('resize', updateClosePosition);
3354
- return () => window.removeEventListener('resize', updateClosePosition);
3355
- }, [isOverlayMounted, updateClosePosition]);
3356
-
3357
- useEffect(() => {
3358
- if (!isOpen || !isInteractive) return;
3359
- closeRef.current?.focus({ preventScroll: true });
3360
- const onKeyDown = (event: KeyboardEvent) => {
3361
- if (event.key === 'Escape') setIsUserOpen(false);
3362
- };
3363
- document.addEventListener('keydown', onKeyDown);
3364
- return () => document.removeEventListener('keydown', onKeyDown);
3365
- }, [isOpen, isInteractive]);
3366
-
3367
- // Inline media covers the page, so a copy of the panel is laid over the real one.
3368
- useLayoutEffect(() => {
3369
- if (!isInline || activeIndex === null) return;
3370
- const panelEl = panelRef.current;
3371
- const layer = inlineLayerRef.current;
3372
- if (!panelEl || !layer) return;
3373
- const panelRect = panelEl.getBoundingClientRect();
3374
- const layerRect = layer.getBoundingClientRect();
3375
- setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
3376
- }, [isInline, activeIndex]);
3377
-
3378
- useEffect(() => {
3379
- if (activeIndex !== null) return;
3380
- const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
3381
- return () => window.clearTimeout(timer);
3382
- }, [activeIndex]);
3383
-
3384
- const isCopyShown = copyRect !== null;
3385
- useEffect(() => {
3386
- if (!isInline || !isCopyShown) return;
3387
- const cut = () => {
3388
- setIsMediaCut(true);
3389
- setActiveIndex(null);
3390
- setCopyRect(null);
3391
- };
3392
- document.addEventListener('scroll', cut, { capture: true, passive: true });
3393
- window.addEventListener('resize', cut);
3394
- return () => {
3395
- document.removeEventListener('scroll', cut, { capture: true });
3396
- window.removeEventListener('resize', cut);
3397
- };
3398
- }, [isInline, isCopyShown]);
3399
-
3400
- useEffect(() => {
3401
- if (!isListShown) return;
3402
- items.forEach((item) => getRowMedia(item).forEach((media) => {
3403
- if (!isVideoMedia(media)) new Image().src = media.assetId;
3404
- }));
3405
- }, [isListShown, items]);
3406
-
3407
- useEffect(() => {
3408
- if (activeMedia.length < 2) return;
3409
- const timer = window.setInterval(() => {
3410
- setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
3411
- }, hoverInterval);
3412
- return () => window.clearInterval(timer);
3413
- }, [activeIndex, activeMedia.length, hoverInterval]);
3414
-
3415
- // Keep the replaced media under the next one until it has faded in; runs before paint to avoid a gap frame.
3416
- useLayoutEffect(() => {
3417
- const previous = shownMediaRef.current;
3418
- shownMediaRef.current = shownMedia;
3419
- if (shownMedia === null) return;
3420
- setLastShownMedia(shownMedia);
3421
- setCoveredMedia(previous);
3422
- }, [shownMedia]);
3423
-
3424
- useEffect(() => {
3425
- if (!isShownMediaLoaded || coveredMedia === null) return;
3426
- const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
3427
- return () => window.clearTimeout(timer);
3428
- }, [isShownMediaLoaded, coveredMedia]);
3429
-
3430
- const close = () => {
3431
- if (!isInteractive) return;
3432
- setIsUserOpen(false);
3433
- triggerRef.current?.focus({ preventScroll: true });
3434
- };
3435
-
3436
- const showRowMedia = (index: number) => {
3437
- if (!isInteractive || getRowMedia(items[index]).length === 0) {
3438
- setActiveIndex(null);
3439
- return;
3440
- }
3441
- setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
3442
- if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
3443
- if (activeIndex !== index) setActiveMediaIndex(0);
3444
- setIsMediaCut(false);
3445
- setActiveIndex(index);
3446
- };
3447
-
3448
- const hideRowMedia = (index: number) => {
3449
- setActiveIndex((current) => (current === index ? null : current));
3450
- };
3451
-
3452
- const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
3453
- if (!isInteractive && (event.target as HTMLElement).closest('a')) {
3454
- event.preventDefault();
3455
- }
3456
- };
3457
-
3458
- const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
3459
- const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
3460
- omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
3461
- ));
3462
- const labelLineHeight = columnTypographyCss[0].lineHeight;
3463
- const titleLineHeight = columnTypographyCss[1]?.lineHeight;
3464
- const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
3465
- ? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
3466
- : undefined;
3467
-
3468
- const colorVars = buildColorVars(P, {
3469
- triggerColor,
3470
- triggerHoverColor,
3471
- closeColor,
3472
- closeHoverColor,
3473
- panelColor,
3474
- textColor,
3475
- textHoverColor,
3476
- overlayColor,
3477
- }, COLOR_VAR_MAP, []);
3478
- const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
3479
- const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
3480
- const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
3481
-
3482
- const mediaLayer = (
3483
- <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
3484
- {[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
3485
- const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
3486
- return (
3487
- <ChroniclesMediaItem
3488
- key={mediaKey}
3489
- P={P}
3490
- media={media}
3491
- isVisible={mediaKey === shownMedia}
3492
- isLoaded={loadedMedia.has(mediaKey)}
3493
- isCovered={mediaKey === coveredMedia}
3494
- isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
3495
- onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
3496
- />
3497
- );
3498
- }))}
3499
- </div>
3500
- );
3501
-
3502
- const renderPanel = (isCopy: boolean) => {
3503
- const showControls = !isCopy && showPanelControls;
3504
- return (
3505
- <div
3506
- ref={isCopy ? undefined : panelRef}
3507
- className={cn(
3508
- \`\${P}-panel\`,
3509
- isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
3510
- isInline && \`\${P}-panel-inline\`,
3511
- isCopy && \`\${P}-panel-copy\`,
3512
- )}
3513
- style={{
3514
- width: scaled(panelWidth),
3515
- paddingTop: scaled(panelPadding.top),
3516
- paddingRight: scaled(panelPadding.right),
3517
- paddingBottom: scaled(panelPadding.bottom),
3518
- paddingLeft: scaled(panelPadding.left),
3519
- borderRadius: scaled(panelRadius),
3520
- [\`--\${P}-group-gap\`]: scaled(groupGap),
3521
- [\`--\${P}-panel-x\`]: panelOffset.x,
3522
- [\`--\${P}-panel-y\`]: panelOffset.y,
3523
- [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
3524
- [\`--\${P}-column-gap\`]: scaled(columnGap),
3525
- ...(isCopy && copyRect),
3526
- } as CSSProperties}
3527
- data-lightbox-scrollable={isInline ? undefined : ''}
3528
- aria-hidden={isCopy || undefined}
3529
- onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
3530
- onClickCapture={isCopy ? undefined : onPanelClickCapture}
3531
- >
3532
- {showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
3533
- {showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
3534
- {groups.map((group, groupIndex) => (
3535
- <Fragment key={groupIndex}>
3536
- {showControls && groupIndex > 0 && (
3537
- <div
3538
- data-controls="groupGap"
3539
- data-controls-paired=""
3540
- data-controls-axis="y"
3541
- data-controls-reverse=""
3542
- data-controls-min="0"
3543
- className={\`\${P}-control-anchor\`}
3544
- style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
3545
- />
3546
- )}
3547
- <div
3548
- className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
3549
- style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
3550
- >
3551
- {hasGroupColumn && (
3552
- <span
3553
- className={\`\${P}-group-label\`}
3554
- style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
3555
- >
3556
- {group.label}
3557
- </span>
3558
- )}
3559
- {group.rows.map(({ item, index }) => {
3560
- const rowLink = !isCopy && item.link?.value ? item.link : undefined;
3561
- const RowElement = rowLink ? 'a' : 'div';
3562
- const linkProps = rowLink ? {
3563
- href: buildValidUrl(rowLink.value),
3564
- ...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
3565
- } : {};
3566
- const hoverProps = isCopy ? {} : {
3567
- onMouseEnter: () => showRowMedia(index),
3568
- onMouseLeave: () => hideRowMedia(index),
3569
- onFocus: () => showRowMedia(index),
3570
- onBlur: () => hideRowMedia(index),
3571
- };
3572
- return (
3573
- <RowElement
3574
- key={index}
3575
- className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
3576
- {...linkProps}
3577
- {...hoverProps}
3578
- >
3579
- {!hasGroupColumn && (
3580
- <div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
3581
- )}
3582
- {titleKeys.map((key, titleIndex) => (
3583
- <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
3584
- ))}
3585
- </RowElement>
3586
- );
3587
- })}
3588
- </div>
3589
- </Fragment>
3590
- ))}
3591
- </div>
3592
- );
3593
- };
3594
-
3595
- const overlay = isOverlayMounted ? (
3596
- <div
3597
- ref={overlayRef}
3598
- className={cn(
3599
- \`\${P}-overlay\`,
3600
- isEditor && \`\${P}-overlay-editor\`,
3601
- isEditMode && \`\${P}-overlay-edit-mode\`,
3602
- isOverlayActive && \`\${P}-overlay-active\`,
3603
- interactiveClass,
3604
- stateClass,
3605
- )}
3606
- style={{ ...colorVars, ...layoutStyle }}
3607
- role="dialog"
3608
- aria-modal="true"
3609
- aria-label={triggerLabel}
3610
- data-selection="none"
3611
- >
3612
- <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
3613
- {mediaLayer}
3614
- <button
3615
- ref={closeRef}
3616
- type="button"
3617
- className={\`\${P}-close\`}
3618
- style={{
3619
- ...triggerTypographyCss,
3620
- top: closePosition?.top ?? 0,
3621
- left: closePosition?.left ?? 0,
3622
- visibility: closePosition ? 'visible' : 'hidden',
3623
- }}
3624
- onClick={close}
3625
- >
3626
- {closeLabel}
3627
- </button>
3628
- {renderPanel(false)}
3629
- </div>
3630
- ) : null;
3631
-
3632
- const inlineLayer = isInline && mountedRows.size > 0 ? (
3633
- <div
3634
- ref={inlineLayerRef}
3635
- className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
3636
- style={{ ...colorVars, ...layoutStyle }}
3637
- aria-hidden="true"
3638
- data-selection="none"
3639
- >
3640
- {mediaLayer}
3641
- {copyRect && renderPanel(true)}
3642
- </div>
3643
- ) : null;
3644
- const portalContent = overlay ?? inlineLayer;
3645
-
3646
- return (
3647
- <>
3648
- <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
3649
- <div
3650
- ref={wrapperRef}
3651
- className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
3652
- style={colorVars}
3653
- >
3654
- {isInline ? renderPanel(false) : (
3655
- <button
3656
- ref={triggerRef}
3657
- type="button"
3658
- className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
3659
- style={triggerTypographyCss}
3660
- aria-haspopup="dialog"
3661
- aria-expanded={isOpen}
3662
- onClick={() => {
3663
- if (isInteractive) setIsUserOpen(true);
3664
- }}
3665
- >
3666
- {triggerLabel}
3667
- </button>
3668
- )}
3669
- </div>
3670
- {portalContent && typeof document !== 'undefined' && createPortal(
3671
- portalContent,
3672
- (portalId ? document.getElementById(portalId) : null) ?? document.body,
3673
- )}
3674
- </>
3675
- );
3676
- }
3677
- `, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2687
+ `, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3678
2688
  import { CommonComponentProps } from '../props';
3679
2689
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
3680
2690
 
@@ -4203,7 +3213,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
4203
3213
  </>
4204
3214
  );
4205
3215
  }
4206
- `, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
3216
+ `, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
4207
3217
  import cn from 'classnames';
4208
3218
  import { CommonComponentProps } from '../props';
4209
3219
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -4951,7 +3961,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
4951
3961
  </>
4952
3962
  );
4953
3963
  }
4954
- `, I = `import React, { useMemo, useState } from 'react';
3964
+ `, C = `import React, { useMemo, useState } from 'react';
4955
3965
  import { CommonComponentProps } from '../props';
4956
3966
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
4957
3967
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -5589,7 +4599,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
5589
4599
  };
5590
4600
 
5591
4601
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
5592
- `, T = `import { Splide, SplideSlide } from '@splidejs/react-splide';
4602
+ `, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5593
4603
  import '@splidejs/react-splide/css/core';
5594
4604
  import { CommonComponentProps } from '../props';
5595
4605
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -7904,7 +6914,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
7904
6914
  };
7905
6915
 
7906
6916
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
7907
- `, E = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6917
+ `, I = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7908
6918
  import { CommonComponentProps } from '../props';
7909
6919
  import { scalingValue } from '../utils/scalingValue';
7910
6920
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -8477,7 +7487,7 @@ export function Helix({
8477
7487
  </>
8478
7488
  );
8479
7489
  }
8480
- `, R = `import { CommonComponentProps } from '../props';
7490
+ `, T = `import { CommonComponentProps } from '../props';
8481
7491
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
8482
7492
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
8483
7493
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -10929,7 +9939,7 @@ export function Hive({
10929
9939
  </>
10930
9940
  );
10931
9941
  }
10932
- `, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9942
+ `, E = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10933
9943
  import { createPortal } from 'react-dom';
10934
9944
  import { CommonComponentProps } from '../props';
10935
9945
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11694,7 +10704,7 @@ export type LightboxJournalSettings = {
11694
10704
  closeIconColor: string;
11695
10705
  closeIconHoverColor: string;
11696
10706
  };
11697
- `, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
10707
+ `, R = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
11698
10708
  import { createPortal } from 'react-dom';
11699
10709
  import { CommonComponentProps } from '../props';
11700
10710
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -12240,7 +11250,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
12240
11250
  </>
12241
11251
  );
12242
11252
  };
12243
- `, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11253
+ `, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12244
11254
  import { createPortal } from 'react-dom';
12245
11255
  import { CommonComponentProps } from '../props';
12246
11256
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15345,7 +14355,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
15345
14355
  </>
15346
14356
  );
15347
14357
  }
15348
- `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14358
+ `, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15349
14359
  import cn from 'classnames';
15350
14360
  import { CommonComponentProps } from '../props';
15351
14361
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16203,7 +15213,7 @@ type MarqueeProps = {
16203
15213
  isPreviewMode?: boolean;
16204
15214
  isEditMode?: boolean;
16205
15215
  } & CommonComponentProps;
16206
- `, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15216
+ `, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16207
15217
  import cn from 'classnames';
16208
15218
  import { CommonComponentProps } from '../props';
16209
15219
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -17146,7 +16156,7 @@ type MarqueeTextProps = {
17146
16156
  isPreviewMode?: boolean;
17147
16157
  isEditMode?: boolean;
17148
16158
  } & CommonComponentProps;
17149
- `, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16159
+ `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17150
16160
  import { createPortal } from 'react-dom';
17151
16161
  import type React from 'react';
17152
16162
  import { CommonComponentProps } from '../props';
@@ -19628,7 +18638,7 @@ export function Mercury({
19628
18638
  </>
19629
18639
  );
19630
18640
  }
19631
- `, O = `import React, { useMemo, useState } from 'react';
18641
+ `, N = `import React, { useMemo, useState } from 'react';
19632
18642
  import { CommonComponentProps } from '../props';
19633
18643
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
19634
18644
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -20207,7 +19217,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
20207
19217
  };
20208
19218
 
20209
19219
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
20210
- `, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19220
+ `, H = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20211
19221
  import type React from 'react';
20212
19222
  import { CommonComponentProps } from '../props';
20213
19223
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -21046,7 +20056,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
21046
20056
  </>
21047
20057
  );
21048
20058
  }
21049
- `, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20059
+ `, O = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21050
20060
  import cn from 'classnames';
21051
20061
  import { CommonComponentProps } from '../props';
21052
20062
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -21674,7 +20684,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
21674
20684
  </>
21675
20685
  );
21676
20686
  }
21677
- `, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20687
+ `, F = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21678
20688
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
21679
20689
  import { CommonComponentProps } from '../props';
21680
20690
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -22306,7 +21316,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
22306
21316
  </>
22307
21317
  );
22308
21318
  }
22309
- `, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
21319
+ `, _ = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22310
21320
  import cn from 'classnames';
22311
21321
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
22312
21322
  import { scalingValue } from '../utils/scalingValue';
@@ -23488,7 +22498,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
23488
22498
  </svg>
23489
22499
  );
23490
22500
  }
23491
- `, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22501
+ `, W = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23492
22502
  import cn from 'classnames';
23493
22503
  import { CommonComponentProps } from '../props';
23494
22504
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24119,7 +23129,7 @@ type TestimonialsSettings = {
24119
23129
  logoHeight: number;
24120
23130
  captionMarginTop: number;
24121
23131
  };
24122
- `, z = `import cn from 'classnames';
23132
+ `, D = `import cn from 'classnames';
24123
23133
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
24124
23134
  import { CommonComponentProps } from '../props';
24125
23135
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -24615,7 +23625,7 @@ type TestimonialsSettings = {
24615
23625
  icon?: string | null;
24616
23626
  };
24617
23627
  };
24618
- `, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23628
+ `, B = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24619
23629
  import type React from 'react';
24620
23630
  import { createPortal } from 'react-dom';
24621
23631
  import { CommonComponentProps } from '../props';
@@ -25148,30 +24158,29 @@ export function Waterfall({
25148
24158
  </>
25149
24159
  );
25150
24160
  }
25151
- `, U = {
25152
- [y.id]: S,
25153
- [b.id]: C,
25154
- [x.id]: w,
25155
- [P.id]: $,
25156
- [v.id]: I,
25157
- [f.id]: T,
25158
- [h.id]: E,
25159
- [p.id]: R,
25160
- [m.id]: M,
25161
- [g.id]: L,
25162
- [u.id]: k,
25163
- [d.id]: A,
25164
- [c.id]: N,
25165
- [l.id]: H,
25166
- [s.id]: O,
25167
- [a.id]: _,
25168
- [r.id]: F,
25169
- [o.id]: W,
25170
- [i.id]: D,
25171
- [t.id]: B,
25172
- [e.id]: z,
25173
- [n.id]: V
24161
+ `, V = {
24162
+ [b.id]: y,
24163
+ [x.id]: S,
24164
+ [P.id]: w,
24165
+ [v.id]: C,
24166
+ [f.id]: $,
24167
+ [h.id]: I,
24168
+ [p.id]: T,
24169
+ [m.id]: E,
24170
+ [g.id]: R,
24171
+ [u.id]: M,
24172
+ [d.id]: L,
24173
+ [c.id]: k,
24174
+ [l.id]: A,
24175
+ [s.id]: N,
24176
+ [a.id]: H,
24177
+ [r.id]: O,
24178
+ [o.id]: F,
24179
+ [i.id]: _,
24180
+ [t.id]: W,
24181
+ [e.id]: D,
24182
+ [n.id]: B
25174
24183
  };
25175
24184
  export {
25176
- U as componentSources
24185
+ V as componentSources
25177
24186
  };