@cntrl-site/components 1.0.106 → 1.0.107-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sources.mjs CHANGED
@@ -1,5 +1,1029 @@
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-OygSO3fr.mjs";
2
- const y = `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, A as y } from "./ArchivePopupComponent-HsEAy1CM.mjs";
2
+ const S = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import cn from 'classnames';
5
+ import { CommonComponentProps } from '../props';
6
+ import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
7
+ import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
8
+ import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
9
+ import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
10
+
11
+ type ArchivePopupMedia = {
12
+ assetId: string;
13
+ name?: string;
14
+ type?: 'image' | 'video';
15
+ objectFit?: 'cover' | 'contain';
16
+ };
17
+
18
+ /** Columns count the group column too, so the least is the group and its title. */
19
+ export const ARCHIVE_POPUP_MIN_COLUMNS = 2;
20
+ export const ARCHIVE_POPUP_MAX_COLUMNS = 5;
21
+ /** The fields of the columns after the title, in order; \`columns\` decides how many of them a row shows. */
22
+ export const ARCHIVE_POPUP_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
23
+ /** Every column but the last has a width of its own, like Programme's; the last takes what is left of the row. */
24
+ export const ARCHIVE_POPUP_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
25
+
26
+ type ArchivePopupColumnWidthKey = typeof ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[number];
27
+
28
+ /**
29
+ * Where B's panel sits on the screen, as \`left\`/\`top\` of the screen and of the panel alike, so 0% is flush with
30
+ * one edge and 100% with the other. Named like Mercury's title position; center comes first because the editor
31
+ * puts the first value into a popup saved before there was a position, and those were centred.
32
+ */
33
+ const PANEL_POSITION_OFFSETS = {
34
+ center: { x: '50%', y: '50%' },
35
+ 'left-top': { x: '0%', y: '0%' },
36
+ 'top-center': { x: '50%', y: '0%' },
37
+ 'top-right': { x: '100%', y: '0%' },
38
+ 'left-center': { x: '0%', y: '50%' },
39
+ 'right-center': { x: '100%', y: '50%' },
40
+ 'left-bottom': { x: '0%', y: '100%' },
41
+ 'bottom-center': { x: '50%', y: '100%' },
42
+ 'right-bottom': { x: '100%', y: '100%' },
43
+ } as const;
44
+
45
+ export type ArchivePopupPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
46
+
47
+ export const ARCHIVE_POPUP_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ArchivePopupPanelPosition[];
48
+
49
+ /** Each column of a row has a text style of its own, the group column's being \`column1\`. */
50
+ export const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
51
+
52
+ type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
53
+
54
+ type ArchivePopupTitle = any[] | string;
55
+
56
+ export type ArchivePopupContentItem = {
57
+ group?: string;
58
+ /** Rich text, so parts of a title can be linked; a plain string is still shown as is. */
59
+ title?: ArchivePopupTitle;
60
+ title2?: ArchivePopupTitle;
61
+ title3?: ArchivePopupTitle;
62
+ title4?: ArchivePopupTitle;
63
+ /** The row's hover images, shown in turn while it is hovered; a row saved before there could be several holds just one. */
64
+ image?: ArchivePopupMedia | ArchivePopupMedia[];
65
+ };
66
+
67
+ type FontSettings = { fontWeight: number; fontStyle: string };
68
+
69
+ type Padding = { top: number; right: number; bottom: number; left: number };
70
+
71
+ /** A text style as settings hold it, each field under the name of what it styles, e.g. \`triggerFontSize\`. */
72
+ type TextStyleFields = {
73
+ FontFamily?: string;
74
+ FontSettings?: FontSettings;
75
+ FontSize?: number;
76
+ LineHeight?: number;
77
+ LetterSpacing?: number;
78
+ WordSpacing?: number;
79
+ TextAlign?: TextStyles['textAlign'];
80
+ TextAppearance?: TextStyles['textAppearance'];
81
+ };
82
+
83
+ type PrefixedTextStyle<Prefix extends string> = {
84
+ [Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]?: TextStyleFields[Key];
85
+ };
86
+
87
+ type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
88
+ & PrefixedTextStyle<ArchivePopupColumnStylePrefix>
89
+ // One style every column shared before each had its own; a column with no style of its own still shows it.
90
+ & PrefixedTextStyle<'list'>
91
+ & {
92
+ /** \`a\` is always open, in place on the page; \`b\` opens from a label. */
93
+ type?: 'a' | 'b';
94
+ triggerLabel?: string;
95
+ closeLabel?: string;
96
+ /** Every column of a row, the group column included. */
97
+ columns?: number;
98
+ columnGap?: number;
99
+ column1Width?: number;
100
+ column2Width?: number;
101
+ column3Width?: number;
102
+ column4Width?: number;
103
+ /** How long each of a hovered row's images shows before the next, in ms. */
104
+ hoverInterval?: number;
105
+ /** B only: A's panel stays where it is placed on the page. */
106
+ panelPosition?: string;
107
+ panelWidth?: number;
108
+ panelPadding?: Padding;
109
+ panelRadius?: number;
110
+ groupGap?: number;
111
+ triggerColor?: string;
112
+ triggerHoverColor?: string;
113
+ closeColor?: string;
114
+ closeHoverColor?: string;
115
+ panelColor?: string;
116
+ textColor?: string;
117
+ textHoverColor?: string;
118
+ overlayColor?: string;
119
+ };
120
+
121
+ type ArchivePopupProps = {
122
+ settings: ArchivePopupSettings;
123
+ content?: ArchivePopupContentItem[];
124
+ isEditor?: boolean;
125
+ isEditMode?: boolean;
126
+ isPreviewMode?: boolean;
127
+ activeEvent?: string;
128
+ portalId?: string;
129
+ } & CommonComponentProps;
130
+
131
+ export type ArchivePopupRow = {
132
+ item: ArchivePopupContentItem;
133
+ index: number;
134
+ };
135
+
136
+ export type ArchivePopupGroup = {
137
+ label: string;
138
+ rows: ArchivePopupRow[];
139
+ };
140
+
141
+ type ColorKeys =
142
+ | 'triggerColor'
143
+ | 'triggerHoverColor'
144
+ | 'closeColor'
145
+ | 'closeHoverColor'
146
+ | 'panelColor'
147
+ | 'textColor'
148
+ | 'textHoverColor'
149
+ | 'overlayColor';
150
+
151
+ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
152
+ triggerColor: 'trigger-color',
153
+ triggerHoverColor: 'trigger-hover-color',
154
+ closeColor: 'close-color',
155
+ closeHoverColor: 'close-hover-color',
156
+ panelColor: 'panel-color',
157
+ textColor: 'text-color',
158
+ textHoverColor: 'text-hover-color',
159
+ overlayColor: 'overlay-color',
160
+ };
161
+
162
+ const STATE_KEYS = ['hover', 'open'] as const;
163
+
164
+ const OVERLAY_ANIM_MS = 300;
165
+ // The least a padding handle is drawn at, so a zero padding can still be grabbed.
166
+ const PADDING_HANDLE_SIZE = 0.004;
167
+ const COLUMN_RESIZE_HANDLE_WIDTH = 0.004;
168
+ // The least a column is dragged down to, in pixels of the layout.
169
+ const MIN_COLUMN_WIDTH_PX = 20;
170
+ const DEFAULT_COLUMN_GAP = 0.0139;
171
+ const DEFAULT_PANEL_WIDTH = 0.3194;
172
+ const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
173
+ const IMAGE_FADE_MS = 800;
174
+ const DEFAULT_HOVER_INTERVAL_MS = 1000;
175
+
176
+ const LIGHTBOX_CSS_VARS = [
177
+ '--cntrl-article-width',
178
+ '--cntrl-article-top',
179
+ '--cntrl-article-left',
180
+ '--cntrl-viewport-height',
181
+ ] as const;
182
+
183
+ // A row with an empty group continues the group above it, so the label only has to be typed once.
184
+ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'>
185
+ & Partial<Record<ArchivePopupColumnWidthKey, number>>;
186
+
187
+ function getColumnCount(columns: number | undefined): number {
188
+ return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
189
+ }
190
+
191
+ /** The width a row's columns share: the panel's, less its padding and the gaps between them. */
192
+ function getColumnsSpace(settings: ColumnLayoutSettings): number {
193
+ const { panelWidth = DEFAULT_PANEL_WIDTH, panelPadding = DEFAULT_PANEL_PADDING, columnGap = DEFAULT_COLUMN_GAP } = settings;
194
+ const gaps = (getColumnCount(settings.columns) - 1) * columnGap;
195
+ return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - gaps);
196
+ }
197
+
198
+ export function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>> {
199
+ const count = getColumnCount(settings.columns);
200
+ const width = getColumnsSpace(settings) / count;
201
+ return Object.fromEntries(ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => [key, width]));
202
+ }
203
+
204
+ /**
205
+ * Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
206
+ * and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
207
+ */
208
+ export function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[] {
209
+ const count = getColumnCount(settings.columns);
210
+ const space = getColumnsSpace(settings);
211
+ const sized = ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => {
212
+ const width = settings[key];
213
+ return typeof width === 'number' ? Math.max(0, width) : space / count;
214
+ });
215
+ const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
216
+ const scale = sizedTotal > space ? space / sizedTotal : 1;
217
+ const fitted = sized.map((width) => width * scale);
218
+ return [...fitted, Math.max(0, space - sizedTotal * scale)];
219
+ }
220
+
221
+ /** Like Programme, a new column count starts the columns over at equal widths. */
222
+ export function applyArchivePopupColumnCountChange(
223
+ nextSettings: Record<string, any>,
224
+ prevSettings: Record<string, any>,
225
+ ): Record<string, any> {
226
+ if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
227
+ return nextSettings;
228
+ }
229
+ return { ...nextSettings, ...getArchivePopupEqualColumnWidths({ ...prevSettings, ...nextSettings }) };
230
+ }
231
+
232
+ // The columns stay in proportion when the panel is drawn narrower than its width, on a small screen.
233
+ function getGridTemplateColumns(widths: number[]): string {
234
+ const total = widths.reduce((sum, width) => sum + width, 0);
235
+ return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
236
+ }
237
+
238
+ export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[] {
239
+ const groups: ArchivePopupGroup[] = [];
240
+ items.forEach((item, index) => {
241
+ const label = item.group?.trim() ?? '';
242
+ const current = groups[groups.length - 1];
243
+ if (!current || (label !== '' && label !== current.label)) {
244
+ groups.push({ label, rows: [{ item, index }] });
245
+ return;
246
+ }
247
+ current.rows.push({ item, index });
248
+ });
249
+ return groups;
250
+ }
251
+
252
+ export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefined): ArchivePopupMedia[] {
253
+ const { image } = item ?? {};
254
+ return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
255
+ }
256
+
257
+ function isVideoMedia(media: ArchivePopupMedia): boolean {
258
+ if (media.type === 'video') return true;
259
+ if (media.type === 'image') return false;
260
+ return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId);
261
+ }
262
+
263
+ function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
264
+ let el = element;
265
+ while (el) {
266
+ if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) {
267
+ return el;
268
+ }
269
+ el = el.parentElement;
270
+ }
271
+ return element;
272
+ }
273
+
274
+ function getLightboxLayoutStyle(container: HTMLElement | null): CSSProperties {
275
+ const style: Record<string, string> = {};
276
+ const layoutContainer = findLayoutContainer(container);
277
+ if (!layoutContainer) return style;
278
+ const computed = getComputedStyle(layoutContainer);
279
+ for (const varName of LIGHTBOX_CSS_VARS) {
280
+ const value = computed.getPropertyValue(varName).trim();
281
+ if (value) {
282
+ style[varName] = value;
283
+ }
284
+ }
285
+ return style;
286
+ }
287
+
288
+ function resolveTextStyle(settings: ArchivePopupSettings, prefix: string, fallbackPrefix?: string): TextStyles {
289
+ const values = settings as Record<string, unknown>;
290
+ const read = <Key extends keyof TextStyleFields>(key: Key) => (
291
+ values[\`\${prefix}\${key}\`] ?? (fallbackPrefix ? values[\`\${fallbackPrefix}\${key}\`] : undefined)
292
+ ) as TextStyleFields[Key];
293
+ const fontSettings = read('FontSettings');
294
+ return {
295
+ fontSettings: {
296
+ fontFamily: read('FontFamily'),
297
+ fontWeight: fontSettings?.fontWeight ?? 400,
298
+ fontStyle: fontSettings?.fontStyle ?? 'normal',
299
+ },
300
+ fontSize: read('FontSize') ?? 0.01,
301
+ lineHeight: read('LineHeight'),
302
+ letterSpacing: read('LetterSpacing') ?? 0,
303
+ wordSpacing: read('WordSpacing') ?? 0,
304
+ textAlign: read('TextAlign'),
305
+ textAppearance: read('TextAppearance'),
306
+ color: '#000000',
307
+ };
308
+ }
309
+
310
+ function getCSS(P: string): string {
311
+ return \`
312
+ .\${P}-trigger,
313
+ .\${P}-close {
314
+ display: inline-block;
315
+ margin: 0;
316
+ padding: 0;
317
+ border: 0;
318
+ background: none;
319
+ cursor: pointer;
320
+ white-space: nowrap;
321
+ transition: color 150ms ease;
322
+ -webkit-appearance: none;
323
+ appearance: none;
324
+ -webkit-tap-highlight-color: transparent;
325
+ }
326
+ .\${P}-trigger {
327
+ color: var(--\${P}-trigger-color);
328
+ transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
329
+ }
330
+ .\${P}-trigger-hidden {
331
+ opacity: 0;
332
+ }
333
+ .\${P}-close {
334
+ color: var(--\${P}-close-color);
335
+ }
336
+ .\${P}-trigger:focus,
337
+ .\${P}-close:focus {
338
+ outline: none;
339
+ }
340
+ .\${P}-trigger:focus-visible,
341
+ .\${P}-close:focus-visible {
342
+ outline: 1px solid currentColor;
343
+ outline-offset: 2px;
344
+ }
345
+ .\${P}-interactive .\${P}-trigger:hover,
346
+ .\${P}-state-hover .\${P}-trigger {
347
+ color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
348
+ }
349
+ .\${P}-close:hover {
350
+ color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
351
+ }
352
+ .\${P}-editor .\${P}-trigger {
353
+ cursor: default;
354
+ }
355
+ .\${P}-overlay {
356
+ position: fixed;
357
+ inset: 0;
358
+ z-index: 9997;
359
+ overflow: hidden;
360
+ overscroll-behavior: none;
361
+ opacity: 0;
362
+ pointer-events: none;
363
+ transition: opacity \${OVERLAY_ANIM_MS}ms ease;
364
+ }
365
+ .\${P}-inline-layer {
366
+ position: fixed;
367
+ inset: 0;
368
+ z-index: 9997;
369
+ overflow: hidden;
370
+ pointer-events: none;
371
+ }
372
+ .\${P}-overlay-editor {
373
+ inset: auto;
374
+ top: var(--cntrl-article-top, 0);
375
+ left: var(--cntrl-article-left, 0);
376
+ width: var(--cntrl-article-width, 100vw) !important;
377
+ height: var(--cntrl-viewport-height, 100vh) !important;
378
+ }
379
+ .\${P}-overlay-edit-mode {
380
+ z-index: 1;
381
+ }
382
+ .\${P}-overlay-active {
383
+ opacity: 1;
384
+ pointer-events: auto;
385
+ }
386
+ .\${P}-backdrop {
387
+ position: absolute;
388
+ inset: 0;
389
+ background-color: var(--\${P}-overlay-color);
390
+ }
391
+ .\${P}-media-layer {
392
+ position: absolute;
393
+ inset: 0;
394
+ pointer-events: none;
395
+ }
396
+ .\${P}-media {
397
+ position: absolute;
398
+ inset: 0;
399
+ width: 100%;
400
+ height: 100%;
401
+ object-fit: cover;
402
+ opacity: 0;
403
+ transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
404
+ }
405
+ .\${P}-media-contain {
406
+ object-fit: contain;
407
+ }
408
+ .\${P}-media-visible {
409
+ opacity: 1;
410
+ }
411
+ .\${P}-close {
412
+ position: absolute;
413
+ z-index: 2;
414
+ }
415
+ .\${P}-panel {
416
+ position: absolute;
417
+ top: var(--\${P}-panel-y);
418
+ left: var(--\${P}-panel-x);
419
+ z-index: 1;
420
+ box-sizing: border-box;
421
+ max-width: 100%;
422
+ max-height: 100%;
423
+ overflow-y: auto;
424
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
425
+ background-color: var(--\${P}-panel-color);
426
+ color: var(--\${P}-text-color);
427
+ overscroll-behavior: contain;
428
+ transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
429
+ }
430
+ .\${P}-overlay-active .\${P}-panel {
431
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
432
+ }
433
+ .\${P}-panel-settled {
434
+ transition: none;
435
+ }
436
+ .\${P}-panel-inline {
437
+ position: relative;
438
+ top: auto;
439
+ left: auto;
440
+ max-height: none;
441
+ transform: none;
442
+ transition: none;
443
+ }
444
+ .\${P}-media-layer-instant .\${P}-media {
445
+ transition: none;
446
+ }
447
+ .\${P}-panel-copy {
448
+ position: absolute;
449
+ pointer-events: none;
450
+ }
451
+ .\${P}-panel-copy .\${P}-row-active .\${P}-title {
452
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
453
+ }
454
+ @media (prefers-reduced-motion: reduce) {
455
+ .\${P}-panel {
456
+ transition: none;
457
+ }
458
+ }
459
+ .\${P}-group ~ .\${P}-group {
460
+ margin-top: var(--\${P}-group-gap);
461
+ }
462
+ .\${P}-row {
463
+ display: grid;
464
+ grid-template-columns: var(--\${P}-grid-columns);
465
+ column-gap: var(--\${P}-column-gap);
466
+ align-items: baseline;
467
+ }
468
+ .\${P}-group-label {
469
+ min-width: 0;
470
+ overflow-wrap: anywhere;
471
+ }
472
+ .\${P}-title {
473
+ min-width: 0;
474
+ overflow-wrap: anywhere;
475
+ transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
476
+ }
477
+ .\${P}-control-anchor {
478
+ position: absolute;
479
+ pointer-events: none;
480
+ z-index: 2;
481
+ }
482
+ .\${P}-title a {
483
+ text-decoration: inherit;
484
+ }
485
+ .\${P}-interactive .\${P}-row:hover .\${P}-title,
486
+ .\${P}-row:focus-within .\${P}-title,
487
+ .\${P}-state-hover .\${P}-row:first-child .\${P}-title {
488
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
489
+ }
490
+ \`;
491
+ }
492
+
493
+ function ArchivePopupMediaItem({
494
+ P,
495
+ media,
496
+ isVisible,
497
+ }: {
498
+ P: string;
499
+ media: ArchivePopupMedia;
500
+ isVisible: boolean;
501
+ }) {
502
+ const videoRef = useRef<HTMLVideoElement>(null);
503
+ const [isLoaded, setIsLoaded] = useState(false);
504
+ const isVideo = isVideoMedia(media);
505
+ const className = cn(
506
+ \`\${P}-media\`,
507
+ media.objectFit === 'contain' && \`\${P}-media-contain\`,
508
+ isVisible && isLoaded && \`\${P}-media-visible\`,
509
+ );
510
+
511
+ useEffect(() => {
512
+ const video = videoRef.current;
513
+ if (!isVideo || !video) return;
514
+ if (isVisible) {
515
+ video.play()?.catch(() => {});
516
+ } else {
517
+ video.pause();
518
+ }
519
+ }, [isVideo, isVisible]);
520
+
521
+ if (isVideo) {
522
+ return (
523
+ <video
524
+ ref={videoRef}
525
+ className={className}
526
+ src={media.assetId}
527
+ muted
528
+ loop
529
+ playsInline
530
+ preload="auto"
531
+ onLoadedData={() => setIsLoaded(true)}
532
+ />
533
+ );
534
+ }
535
+
536
+ return (
537
+ <img
538
+ className={className}
539
+ src={media.assetId}
540
+ alt=""
541
+ decoding="async"
542
+ onLoad={() => setIsLoaded(true)}
543
+ />
544
+ );
545
+ }
546
+
547
+ // A line in each gap, at the right edge of the column it sizes, as Programme's are.
548
+ function renderColumnWidthControls(
549
+ P: string,
550
+ widths: number[],
551
+ paddingLeft: number,
552
+ columnGap: number,
553
+ scaled: (value: number) => string,
554
+ ) {
555
+ const lastWidth = widths[widths.length - 1];
556
+ let columnLeft = paddingLeft;
557
+ return widths.slice(0, -1).map((width, index) => {
558
+ const gapCenter = columnLeft + width + columnGap / 2;
559
+ columnLeft += width + columnGap;
560
+ return (
561
+ <div
562
+ key={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
563
+ data-controls={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
564
+ data-controls-axis="x"
565
+ data-controls-variant="column-width"
566
+ data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
567
+ // a column grows into the last one, which the editor keeps from going under its own least
568
+ data-controls-max-fraction={String(width + lastWidth)}
569
+ className={\`\${P}-control-anchor\`}
570
+ style={{ top: 0, left: scaled(gapCenter - COLUMN_RESIZE_HANDLE_WIDTH / 2), width: scaled(COLUMN_RESIZE_HANDLE_WIDTH), height: '100%' }}
571
+ />
572
+ );
573
+ });
574
+ }
575
+
576
+ function renderPanelPaddingControls(
577
+ P: string,
578
+ panelWidth: number,
579
+ padding: Padding,
580
+ scaled: (value: number) => string,
581
+ ) {
582
+ const handleSize = (value: number) => scaled(Math.max(value, PADDING_HANDLE_SIZE));
583
+ return (
584
+ <>
585
+ <div
586
+ data-controls="panelPadding.top"
587
+ data-controls-axis="y"
588
+ data-controls-variant="row-padding"
589
+ data-controls-min="0"
590
+ className={\`\${P}-control-anchor\`}
591
+ style={{ top: 0, left: 0, width: '100%', height: handleSize(padding.top) }}
592
+ />
593
+ <div
594
+ data-controls="panelPadding.bottom"
595
+ data-controls-axis="y"
596
+ data-controls-variant="row-padding"
597
+ data-controls-reverse=""
598
+ data-controls-min="0"
599
+ className={\`\${P}-control-anchor\`}
600
+ style={{ bottom: 0, left: 0, width: '100%', height: handleSize(padding.bottom) }}
601
+ />
602
+ <div
603
+ data-controls="panelPadding.left"
604
+ data-controls-axis="x"
605
+ data-controls-variant="column-padding"
606
+ data-controls-min="0"
607
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.right))}
608
+ className={\`\${P}-control-anchor\`}
609
+ style={{ top: 0, left: 0, width: handleSize(padding.left), height: '100%' }}
610
+ />
611
+ <div
612
+ data-controls="panelPadding.right"
613
+ data-controls-axis="x"
614
+ data-controls-variant="column-padding"
615
+ data-controls-reverse=""
616
+ data-controls-min="0"
617
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.left))}
618
+ className={\`\${P}-control-anchor\`}
619
+ style={{ top: 0, right: 0, width: handleSize(padding.right), height: '100%' }}
620
+ />
621
+ </>
622
+ );
623
+ }
624
+
625
+ export function ArchivePopup({
626
+ settings,
627
+ content,
628
+ isEditor,
629
+ isEditMode,
630
+ isPreviewMode,
631
+ activeEvent,
632
+ portalId,
633
+ currentState,
634
+ unavailableStates,
635
+ }: ArchivePopupProps) {
636
+ const { prefix: P } = useScopedStyles();
637
+ const {
638
+ type = 'b',
639
+ triggerLabel = 'Archive',
640
+ closeLabel = 'Close',
641
+ columns = ARCHIVE_POPUP_MIN_COLUMNS,
642
+ columnGap = DEFAULT_COLUMN_GAP,
643
+ hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
644
+ panelPosition,
645
+ panelWidth = DEFAULT_PANEL_WIDTH,
646
+ panelPadding = DEFAULT_PANEL_PADDING,
647
+ panelRadius = 0,
648
+ groupGap = 0.0139,
649
+ triggerColor = '#000000',
650
+ triggerHoverColor = '#666666',
651
+ closeColor = '#000000',
652
+ closeHoverColor = '#666666',
653
+ panelColor = '#FFFFFF',
654
+ textColor = '#333132',
655
+ textHoverColor = '#BBBBBB',
656
+ overlayColor = '#FFFFFFE6',
657
+ } = settings;
658
+ const items = content ?? [];
659
+ const wrapperRef = useRef<HTMLDivElement>(null);
660
+ const triggerRef = useRef<HTMLButtonElement>(null);
661
+ const overlayRef = useRef<HTMLDivElement>(null);
662
+ const closeRef = useRef<HTMLButtonElement>(null);
663
+ const panelRef = useRef<HTMLDivElement>(null);
664
+ const inlineLayerRef = useRef<HTMLDivElement>(null);
665
+ const [isOpenUser, setIsOpen] = useState(false);
666
+ const [isOverlayMounted, setIsOverlayMounted] = useState(false);
667
+ const [isOverlayActive, setIsOverlayActive] = useState(false);
668
+ const [isOverlaySettled, setIsOverlaySettled] = useState(false);
669
+ const [activeIndex, setActiveIndex] = useState<number | null>(null);
670
+ // Which of the hovered row's images shows, counted afresh on every hover.
671
+ const [activeMediaIndex, setActiveMediaIndex] = useState(0);
672
+ const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
673
+ const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
674
+ const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
675
+ const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
676
+ const [isMediaCut, setIsMediaCut] = useState(false);
677
+
678
+ const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
679
+ const isInteractive = !isEditor || Boolean(isPreviewMode);
680
+ // A has no popup to open: its panel is always shown in place of the label.
681
+ const isInline = type === 'a';
682
+ const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
683
+ // Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
684
+ const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
685
+ const scaled = (value: number) => scalingValue(value, isEditor ?? false);
686
+ const scopedCss = useMemo(() => getCSS(P), [P]);
687
+ const groups = useMemo(() => groupArchiveRows(content ?? []), [content]);
688
+ const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
689
+ const columnCount = getColumnCount(columns);
690
+ const columnWidths = resolveArchivePopupColumnWidths(settings);
691
+ // the group takes the first column, the titles the rest
692
+ const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
693
+
694
+ useLightboxScrollLock(isOpen && !isEditorCanvas);
695
+
696
+ useEffect(() => {
697
+ if (isEditorCanvas && !isEditMode) setIsOpen(false);
698
+ }, [isEditorCanvas, isEditMode]);
699
+
700
+ useEffect(() => {
701
+ if (isOpen) {
702
+ setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
703
+ setIsOverlayMounted(true);
704
+ return;
705
+ }
706
+ setIsOverlayActive(false);
707
+ setActiveIndex(null);
708
+ const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
709
+ return () => window.clearTimeout(timer);
710
+ }, [isOpen]);
711
+
712
+ // Activate only after the mounted overlay's hidden styles are applied, or the appear has nothing to transition from.
713
+ useEffect(() => {
714
+ if (!isOpen || !isOverlayMounted) return;
715
+ overlayRef.current?.getBoundingClientRect();
716
+ const frame = requestAnimationFrame(() => setIsOverlayActive(true));
717
+ return () => cancelAnimationFrame(frame);
718
+ }, [isOpen, isOverlayMounted]);
719
+
720
+ // Canvas controls measure their anchors once, so they wait for the panel to finish sliding in.
721
+ useEffect(() => {
722
+ if (!isOverlayActive) {
723
+ setIsOverlaySettled(false);
724
+ return;
725
+ }
726
+ const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
727
+ return () => window.clearTimeout(timer);
728
+ }, [isOverlayActive]);
729
+
730
+ // The close button sits exactly where the trigger is, so the label swaps in place.
731
+ const updateClosePosition = useCallback(() => {
732
+ const trigger = triggerRef.current;
733
+ const overlay = overlayRef.current;
734
+ if (!trigger || !overlay) return;
735
+ const triggerRect = trigger.getBoundingClientRect();
736
+ const overlayRect = overlay.getBoundingClientRect();
737
+ setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
738
+ }, []);
739
+
740
+ useLayoutEffect(() => {
741
+ if (!isOverlayMounted) return;
742
+ updateClosePosition();
743
+ window.addEventListener('resize', updateClosePosition);
744
+ return () => window.removeEventListener('resize', updateClosePosition);
745
+ }, [isOverlayMounted, updateClosePosition]);
746
+
747
+ useEffect(() => {
748
+ if (!isOpen || !isInteractive) return;
749
+ closeRef.current?.focus({ preventScroll: true });
750
+ const onKeyDown = (event: KeyboardEvent) => {
751
+ if (event.key === 'Escape') setIsOpen(false);
752
+ };
753
+ document.addEventListener('keydown', onKeyDown);
754
+ return () => document.removeEventListener('keydown', onKeyDown);
755
+ }, [isOpen, isInteractive]);
756
+
757
+ // A's media fills the screen above the page, so a copy of the panel is laid exactly over the real one to stay readable.
758
+ useLayoutEffect(() => {
759
+ if (!isInline || activeIndex === null) return;
760
+ const panelEl = panelRef.current;
761
+ const layer = inlineLayerRef.current;
762
+ if (!panelEl || !layer) return;
763
+ const panelRect = panelEl.getBoundingClientRect();
764
+ const layerRect = layer.getBoundingClientRect();
765
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
766
+ }, [isInline, activeIndex]);
767
+
768
+ // The copy stays over the list while the media fades out, so the list never shows through a fading image.
769
+ useEffect(() => {
770
+ if (activeIndex !== null) return;
771
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
772
+ return () => window.clearTimeout(timer);
773
+ }, [activeIndex]);
774
+
775
+ // The copy is only true to the panel until the page moves, so scrolling cuts the media at once rather than locking it,
776
+ // fading out included: a copy left over the list would stay put while the list scrolls away under it.
777
+ const isCopyShown = copyRect !== null;
778
+ useEffect(() => {
779
+ if (!isInline || !isCopyShown) return;
780
+ const cut = () => {
781
+ setIsMediaCut(true);
782
+ setActiveIndex(null);
783
+ setCopyRect(null);
784
+ };
785
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
786
+ window.addEventListener('resize', cut);
787
+ return () => {
788
+ document.removeEventListener('scroll', cut, { capture: true });
789
+ window.removeEventListener('resize', cut);
790
+ };
791
+ }, [isInline, isCopyShown]);
792
+
793
+ const close = () => {
794
+ if (!isInteractive) return;
795
+ setIsOpen(false);
796
+ triggerRef.current?.focus({ preventScroll: true });
797
+ };
798
+
799
+ // A hovered row with several images shows them in turn, round and round, for as long as it stays hovered.
800
+ const activeRowMediaCount = activeIndex === null ? 0 : getArchivePopupRowMedia(items[activeIndex]).length;
801
+ useEffect(() => {
802
+ if (activeRowMediaCount < 2) return;
803
+ const timer = window.setInterval(() => {
804
+ setActiveMediaIndex((current) => (current + 1) % activeRowMediaCount);
805
+ }, Math.max(100, hoverInterval));
806
+ return () => window.clearInterval(timer);
807
+ }, [activeIndex, activeRowMediaCount, hoverInterval]);
808
+
809
+ const showRowMedia = (index: number) => {
810
+ if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
811
+ setActiveIndex(null);
812
+ return;
813
+ }
814
+ // A row's images all load on its first hover, so the next is ready by the time it shows.
815
+ setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
816
+ if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
817
+ if (activeIndex !== index) setActiveMediaIndex(0);
818
+ setIsMediaCut(false);
819
+ setActiveIndex(index);
820
+ };
821
+
822
+ const hideRowMedia = (index: number) => {
823
+ setActiveIndex((current) => (current === index ? null : current));
824
+ };
825
+
826
+ // Title links only navigate on a live page or in preview, not on the editor canvas.
827
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
828
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
829
+ event.preventDefault();
830
+ }
831
+ };
832
+
833
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
834
+ const columnTypographyCss = ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES.slice(0, columnCount).map((prefix) => (
835
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix, 'list'), isEditor))
836
+ ));
837
+
838
+ const colorVars = buildColorVars(P, {
839
+ triggerColor,
840
+ triggerHoverColor,
841
+ closeColor,
842
+ closeHoverColor,
843
+ panelColor,
844
+ textColor,
845
+ textHoverColor,
846
+ overlayColor,
847
+ }, COLOR_VAR_MAP, STATE_KEYS);
848
+ const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
849
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
850
+
851
+ const mediaLayer = (
852
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
853
+ {[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) => (
854
+ <ArchivePopupMediaItem
855
+ key={\`\${index}-\${mediaIndex}-\${media.assetId}\`}
856
+ P={P}
857
+ media={media}
858
+ isVisible={activeIndex === index && activeMediaIndex === mediaIndex}
859
+ />
860
+ )))}
861
+ </div>
862
+ );
863
+ // Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
864
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
865
+
866
+ const renderPanel = (isCopy: boolean) => (
867
+ <div
868
+ ref={isCopy ? undefined : panelRef}
869
+ className={cn(
870
+ \`\${P}-panel\`,
871
+ // Only the open and close slide; once open, a new position or size moves the panel straight there.
872
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
873
+ isInline && \`\${P}-panel-inline\`,
874
+ isCopy && \`\${P}-panel-copy\`,
875
+ )}
876
+ style={{
877
+ width: scaled(panelWidth),
878
+ paddingTop: scaled(panelPadding.top),
879
+ paddingRight: scaled(panelPadding.right),
880
+ paddingBottom: scaled(panelPadding.bottom),
881
+ paddingLeft: scaled(panelPadding.left),
882
+ borderRadius: scaled(panelRadius),
883
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
884
+ [\`--\${P}-panel-x\`]: panelOffset.x,
885
+ [\`--\${P}-panel-y\`]: panelOffset.y,
886
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
887
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
888
+ ...(isCopy && copyRect ? { top: copyRect.top, left: copyRect.left, width: copyRect.width } : {}),
889
+ } as CSSProperties}
890
+ data-lightbox-scrollable={isInline ? undefined : ''}
891
+ aria-hidden={isCopy || undefined}
892
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
893
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
894
+ >
895
+ {!isCopy && showPanelControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
896
+ {!isCopy && showPanelControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
897
+ {groups.map((group, groupIndex) => (
898
+ <Fragment key={groupIndex}>
899
+ {!isCopy && showPanelControls && groupIndex > 0 && (
900
+ // Left at its static top, the anchor sits right where the gap above this group starts.
901
+ <div
902
+ data-controls="groupGap"
903
+ data-controls-paired=""
904
+ data-controls-axis="y"
905
+ data-controls-reverse=""
906
+ data-controls-min="0"
907
+ className={\`\${P}-control-anchor\`}
908
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, PADDING_HANDLE_SIZE)) }}
909
+ />
910
+ )}
911
+ <div className={\`\${P}-group\`}>
912
+ {group.rows.map(({ item, index }, rowIndex) => (
913
+ <div
914
+ key={index}
915
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
916
+ {...(isCopy ? {} : {
917
+ onMouseEnter: () => showRowMedia(index),
918
+ onMouseLeave: () => hideRowMedia(index),
919
+ onFocus: () => showRowMedia(index),
920
+ onBlur: () => hideRowMedia(index),
921
+ })}
922
+ >
923
+ <span className={\`\${P}-group-label\`} style={columnTypographyCss[0]}>
924
+ {rowIndex === 0 ? group.label : ''}
925
+ </span>
926
+ {titleKeys.map((key, titleIndex) => {
927
+ const title = item[key];
928
+ return (
929
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>
930
+ {Array.isArray(title) ? <RichTextRenderer content={title} /> : title}
931
+ </div>
932
+ );
933
+ })}
934
+ </div>
935
+ ))}
936
+ </div>
937
+ </Fragment>
938
+ ))}
939
+ </div>
940
+ );
941
+
942
+ const overlay = isOverlayMounted ? (
943
+ <div
944
+ ref={overlayRef}
945
+ className={cn(
946
+ \`\${P}-overlay\`,
947
+ isEditor && \`\${P}-overlay-editor\`,
948
+ isEditMode && \`\${P}-overlay-edit-mode\`,
949
+ isOverlayActive && \`\${P}-overlay-active\`,
950
+ interactiveClass,
951
+ stateClass,
952
+ )}
953
+ style={{ ...colorVars, ...layoutStyle }}
954
+ role="dialog"
955
+ aria-modal="true"
956
+ aria-label={triggerLabel}
957
+ data-selection="none"
958
+ >
959
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
960
+ {mediaLayer}
961
+ <button
962
+ ref={closeRef}
963
+ type="button"
964
+ className={\`\${P}-close\`}
965
+ style={{
966
+ ...triggerTypographyCss,
967
+ top: closePosition?.top ?? 0,
968
+ left: closePosition?.left ?? 0,
969
+ visibility: closePosition ? 'visible' : 'hidden',
970
+ }}
971
+ onClick={close}
972
+ >
973
+ {closeLabel}
974
+ </button>
975
+ {renderPanel(false)}
976
+ </div>
977
+ ) : null;
978
+
979
+ const inlineLayer = isInline && mountedMedia.size > 0 ? (
980
+ <div
981
+ ref={inlineLayerRef}
982
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
983
+ style={{ ...colorVars, ...layoutStyle }}
984
+ aria-hidden="true"
985
+ data-selection="none"
986
+ >
987
+ {mediaLayer}
988
+ {copyRect && renderPanel(true)}
989
+ </div>
990
+ ) : null;
991
+ const portalContent = overlay ?? inlineLayer;
992
+
993
+ return (
994
+ <>
995
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
996
+ <div
997
+ ref={wrapperRef}
998
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
999
+ style={colorVars}
1000
+ >
1001
+ {isInline ? renderPanel(false) : (
1002
+ // The overlay lets the page show through, so the label fades out with it rather than sit under the close.
1003
+ // Only faded, it keeps the component's size and can still take focus back on close.
1004
+ <button
1005
+ ref={triggerRef}
1006
+ type="button"
1007
+ className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
1008
+ style={triggerTypographyCss}
1009
+ aria-haspopup="dialog"
1010
+ aria-expanded={isOpen}
1011
+ onClick={() => {
1012
+ if (isInteractive) setIsOpen(true);
1013
+ }}
1014
+ >
1015
+ {triggerLabel}
1016
+ </button>
1017
+ )}
1018
+ </div>
1019
+ {portalContent && typeof document !== 'undefined' && createPortal(
1020
+ portalContent,
1021
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
1022
+ )}
1023
+ </>
1024
+ );
1025
+ }
1026
+ `, w = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
1027
  import { CommonComponentProps } from '../props';
4
1028
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
5
1029
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -2640,7 +3664,7 @@ export function Burger({
2640
3664
  </div>
2641
3665
  );
2642
3666
  }
2643
- `, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3667
+ `, C = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2644
3668
  import { CommonComponentProps } from '../props';
2645
3669
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2646
3670
 
@@ -3169,7 +4193,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3169
4193
  </>
3170
4194
  );
3171
4195
  }
3172
- `, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
4196
+ `, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
3173
4197
  import cn from 'classnames';
3174
4198
  import { CommonComponentProps } from '../props';
3175
4199
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3917,7 +4941,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3917
4941
  </>
3918
4942
  );
3919
4943
  }
3920
- `, C = `import React, { useMemo, useState } from 'react';
4944
+ `, I = `import React, { useMemo, useState } from 'react';
3921
4945
  import { CommonComponentProps } from '../props';
3922
4946
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3923
4947
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4555,7 +5579,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4555
5579
  };
4556
5580
 
4557
5581
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4558
- `, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5582
+ `, T = `import { Splide, SplideSlide } from '@splidejs/react-splide';
4559
5583
  import '@splidejs/react-splide/css/core';
4560
5584
  import { CommonComponentProps } from '../props';
4561
5585
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -6870,7 +7894,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6870
7894
  };
6871
7895
 
6872
7896
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6873
- `, I = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7897
+ `, E = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6874
7898
  import { CommonComponentProps } from '../props';
6875
7899
  import { scalingValue } from '../utils/scalingValue';
6876
7900
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -7443,7 +8467,7 @@ export function Helix({
7443
8467
  </>
7444
8468
  );
7445
8469
  }
7446
- `, T = `import { CommonComponentProps } from '../props';
8470
+ `, R = `import { CommonComponentProps } from '../props';
7447
8471
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7448
8472
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7449
8473
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -9832,7 +10856,7 @@ export function Hive({
9832
10856
  </>
9833
10857
  );
9834
10858
  }
9835
- `, E = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10859
+ `, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9836
10860
  import { createPortal } from 'react-dom';
9837
10861
  import { CommonComponentProps } from '../props';
9838
10862
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10597,7 +11621,7 @@ export type LightboxJournalSettings = {
10597
11621
  closeIconColor: string;
10598
11622
  closeIconHoverColor: string;
10599
11623
  };
10600
- `, R = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
11624
+ `, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
10601
11625
  import { createPortal } from 'react-dom';
10602
11626
  import { CommonComponentProps } from '../props';
10603
11627
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11143,7 +12167,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11143
12167
  </>
11144
12168
  );
11145
12169
  };
11146
- `, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12170
+ `, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11147
12171
  import { createPortal } from 'react-dom';
11148
12172
  import { CommonComponentProps } from '../props';
11149
12173
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -14248,7 +15272,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14248
15272
  </>
14249
15273
  );
14250
15274
  }
14251
- `, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15275
+ `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14252
15276
  import cn from 'classnames';
14253
15277
  import { CommonComponentProps } from '../props';
14254
15278
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15106,7 +16130,7 @@ type MarqueeProps = {
15106
16130
  isPreviewMode?: boolean;
15107
16131
  isEditMode?: boolean;
15108
16132
  } & CommonComponentProps;
15109
- `, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16133
+ `, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15110
16134
  import cn from 'classnames';
15111
16135
  import { CommonComponentProps } from '../props';
15112
16136
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16049,7 +17073,7 @@ type MarqueeTextProps = {
16049
17073
  isPreviewMode?: boolean;
16050
17074
  isEditMode?: boolean;
16051
17075
  } & CommonComponentProps;
16052
- `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17076
+ `, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16053
17077
  import { createPortal } from 'react-dom';
16054
17078
  import type React from 'react';
16055
17079
  import { CommonComponentProps } from '../props';
@@ -18531,7 +19555,7 @@ export function Mercury({
18531
19555
  </>
18532
19556
  );
18533
19557
  }
18534
- `, N = `import React, { useMemo, useState } from 'react';
19558
+ `, O = `import React, { useMemo, useState } from 'react';
18535
19559
  import { CommonComponentProps } from '../props';
18536
19560
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18537
19561
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19110,7 +20134,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19110
20134
  };
19111
20135
 
19112
20136
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19113
- `, H = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20137
+ `, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19114
20138
  import type React from 'react';
19115
20139
  import { CommonComponentProps } from '../props';
19116
20140
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -19949,7 +20973,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
19949
20973
  </>
19950
20974
  );
19951
20975
  }
19952
- `, O = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20976
+ `, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19953
20977
  import cn from 'classnames';
19954
20978
  import { CommonComponentProps } from '../props';
19955
20979
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20577,7 +21601,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20577
21601
  </>
20578
21602
  );
20579
21603
  }
20580
- `, _ = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21604
+ `, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20581
21605
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20582
21606
  import { CommonComponentProps } from '../props';
20583
21607
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21209,7 +22233,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21209
22233
  </>
21210
22234
  );
21211
22235
  }
21212
- `, F = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22236
+ `, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
21213
22237
  import cn from 'classnames';
21214
22238
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21215
22239
  import { scalingValue } from '../utils/scalingValue';
@@ -22391,7 +23415,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22391
23415
  </svg>
22392
23416
  );
22393
23417
  }
22394
- `, W = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23418
+ `, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22395
23419
  import cn from 'classnames';
22396
23420
  import { CommonComponentProps } from '../props';
22397
23421
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23022,7 +24046,7 @@ type TestimonialsSettings = {
23022
24046
  logoHeight: number;
23023
24047
  captionMarginTop: number;
23024
24048
  };
23025
- `, D = `import cn from 'classnames';
24049
+ `, z = `import cn from 'classnames';
23026
24050
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
23027
24051
  import { CommonComponentProps } from '../props';
23028
24052
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23518,7 +24542,7 @@ type TestimonialsSettings = {
23518
24542
  icon?: string | null;
23519
24543
  };
23520
24544
  };
23521
- `, B = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24545
+ `, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23522
24546
  import type React from 'react';
23523
24547
  import { createPortal } from 'react-dom';
23524
24548
  import { CommonComponentProps } from '../props';
@@ -24051,29 +25075,30 @@ export function Waterfall({
24051
25075
  </>
24052
25076
  );
24053
25077
  }
24054
- `, V = {
24055
- [b.id]: y,
24056
- [x.id]: S,
24057
- [P.id]: w,
24058
- [v.id]: C,
24059
- [f.id]: $,
24060
- [h.id]: I,
24061
- [p.id]: T,
24062
- [m.id]: E,
24063
- [g.id]: R,
24064
- [u.id]: M,
24065
- [d.id]: L,
24066
- [c.id]: k,
24067
- [l.id]: A,
24068
- [s.id]: N,
24069
- [a.id]: H,
24070
- [r.id]: O,
24071
- [o.id]: _,
24072
- [i.id]: F,
24073
- [t.id]: W,
24074
- [e.id]: D,
24075
- [n.id]: B
25078
+ `, U = {
25079
+ [y.id]: S,
25080
+ [b.id]: w,
25081
+ [x.id]: C,
25082
+ [P.id]: $,
25083
+ [v.id]: I,
25084
+ [f.id]: T,
25085
+ [h.id]: E,
25086
+ [p.id]: R,
25087
+ [m.id]: M,
25088
+ [g.id]: L,
25089
+ [u.id]: k,
25090
+ [d.id]: A,
25091
+ [c.id]: N,
25092
+ [l.id]: H,
25093
+ [s.id]: O,
25094
+ [a.id]: _,
25095
+ [r.id]: F,
25096
+ [o.id]: W,
25097
+ [i.id]: D,
25098
+ [t.id]: B,
25099
+ [e.id]: z,
25100
+ [n.id]: V
24076
25101
  };
24077
25102
  export {
24078
- V as componentSources
25103
+ U as componentSources
24079
25104
  };