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