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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sources.mjs CHANGED
@@ -1,5 +1,1003 @@
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-GgAT2Avz.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 A'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
+ image?: 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\` opens from a label; \`b\` is always open, in place on the page. */
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
+ /** A only: B's panel stays where it is placed on the page. */
103
+ panelPosition?: string;
104
+ panelWidth?: number;
105
+ panelPadding?: Padding;
106
+ panelRadius?: number;
107
+ groupGap?: number;
108
+ triggerColor?: string;
109
+ triggerHoverColor?: string;
110
+ closeColor?: string;
111
+ closeHoverColor?: string;
112
+ panelColor?: string;
113
+ textColor?: string;
114
+ textHoverColor?: string;
115
+ overlayColor?: string;
116
+ };
117
+
118
+ type ArchivePopupProps = {
119
+ settings: ArchivePopupSettings;
120
+ content?: ArchivePopupContentItem[];
121
+ isEditor?: boolean;
122
+ isEditMode?: boolean;
123
+ isPreviewMode?: boolean;
124
+ activeEvent?: string;
125
+ portalId?: string;
126
+ } & CommonComponentProps;
127
+
128
+ export type ArchivePopupRow = {
129
+ item: ArchivePopupContentItem;
130
+ index: number;
131
+ };
132
+
133
+ export type ArchivePopupGroup = {
134
+ label: string;
135
+ rows: ArchivePopupRow[];
136
+ };
137
+
138
+ type ColorKeys =
139
+ | 'triggerColor'
140
+ | 'triggerHoverColor'
141
+ | 'closeColor'
142
+ | 'closeHoverColor'
143
+ | 'panelColor'
144
+ | 'textColor'
145
+ | 'textHoverColor'
146
+ | 'overlayColor';
147
+
148
+ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
149
+ triggerColor: 'trigger-color',
150
+ triggerHoverColor: 'trigger-hover-color',
151
+ closeColor: 'close-color',
152
+ closeHoverColor: 'close-hover-color',
153
+ panelColor: 'panel-color',
154
+ textColor: 'text-color',
155
+ textHoverColor: 'text-hover-color',
156
+ overlayColor: 'overlay-color',
157
+ };
158
+
159
+ const STATE_KEYS = ['hover', 'open'] as const;
160
+
161
+ const OVERLAY_ANIM_MS = 300;
162
+ // The least a padding handle is drawn at, so a zero padding can still be grabbed.
163
+ const PADDING_HANDLE_SIZE = 0.004;
164
+ const COLUMN_RESIZE_HANDLE_WIDTH = 0.004;
165
+ // The least a column is dragged down to, in pixels of the layout.
166
+ const MIN_COLUMN_WIDTH_PX = 20;
167
+ const DEFAULT_COLUMN_GAP = 0.0139;
168
+ const DEFAULT_PANEL_WIDTH = 0.3194;
169
+ const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
170
+ const IMAGE_FADE_MS = 800;
171
+
172
+ const LIGHTBOX_CSS_VARS = [
173
+ '--cntrl-article-width',
174
+ '--cntrl-article-top',
175
+ '--cntrl-article-left',
176
+ '--cntrl-viewport-height',
177
+ ] as const;
178
+
179
+ // A row with an empty group continues the group above it, so the label only has to be typed once.
180
+ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'>
181
+ & Partial<Record<ArchivePopupColumnWidthKey, number>>;
182
+
183
+ function getColumnCount(columns: number | undefined): number {
184
+ return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
185
+ }
186
+
187
+ /** The width a row's columns share: the panel's, less its padding and the gaps between them. */
188
+ function getColumnsSpace(settings: ColumnLayoutSettings): number {
189
+ const { panelWidth = DEFAULT_PANEL_WIDTH, panelPadding = DEFAULT_PANEL_PADDING, columnGap = DEFAULT_COLUMN_GAP } = settings;
190
+ const gaps = (getColumnCount(settings.columns) - 1) * columnGap;
191
+ return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - gaps);
192
+ }
193
+
194
+ export function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>> {
195
+ const count = getColumnCount(settings.columns);
196
+ const width = getColumnsSpace(settings) / count;
197
+ return Object.fromEntries(ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => [key, width]));
198
+ }
199
+
200
+ /**
201
+ * Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
202
+ * and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
203
+ */
204
+ export function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[] {
205
+ const count = getColumnCount(settings.columns);
206
+ const space = getColumnsSpace(settings);
207
+ const sized = ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => {
208
+ const width = settings[key];
209
+ return typeof width === 'number' ? Math.max(0, width) : space / count;
210
+ });
211
+ const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
212
+ const scale = sizedTotal > space ? space / sizedTotal : 1;
213
+ const fitted = sized.map((width) => width * scale);
214
+ return [...fitted, Math.max(0, space - sizedTotal * scale)];
215
+ }
216
+
217
+ /** Like Programme, a new column count starts the columns over at equal widths. */
218
+ export function applyArchivePopupColumnCountChange(
219
+ nextSettings: Record<string, any>,
220
+ prevSettings: Record<string, any>,
221
+ ): Record<string, any> {
222
+ if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
223
+ return nextSettings;
224
+ }
225
+ return { ...nextSettings, ...getArchivePopupEqualColumnWidths({ ...prevSettings, ...nextSettings }) };
226
+ }
227
+
228
+ // The columns stay in proportion when the panel is drawn narrower than its width, on a small screen.
229
+ function getGridTemplateColumns(widths: number[]): string {
230
+ const total = widths.reduce((sum, width) => sum + width, 0);
231
+ return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
232
+ }
233
+
234
+ export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[] {
235
+ const groups: ArchivePopupGroup[] = [];
236
+ items.forEach((item, index) => {
237
+ const label = item.group?.trim() ?? '';
238
+ const current = groups[groups.length - 1];
239
+ if (!current || (label !== '' && label !== current.label)) {
240
+ groups.push({ label, rows: [{ item, index }] });
241
+ return;
242
+ }
243
+ current.rows.push({ item, index });
244
+ });
245
+ return groups;
246
+ }
247
+
248
+ function isVideoMedia(media: ArchivePopupMedia): boolean {
249
+ if (media.type === 'video') return true;
250
+ if (media.type === 'image') return false;
251
+ return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId);
252
+ }
253
+
254
+ function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
255
+ let el = element;
256
+ while (el) {
257
+ if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) {
258
+ return el;
259
+ }
260
+ el = el.parentElement;
261
+ }
262
+ return element;
263
+ }
264
+
265
+ function getLightboxLayoutStyle(container: HTMLElement | null): CSSProperties {
266
+ const style: Record<string, string> = {};
267
+ const layoutContainer = findLayoutContainer(container);
268
+ if (!layoutContainer) return style;
269
+ const computed = getComputedStyle(layoutContainer);
270
+ for (const varName of LIGHTBOX_CSS_VARS) {
271
+ const value = computed.getPropertyValue(varName).trim();
272
+ if (value) {
273
+ style[varName] = value;
274
+ }
275
+ }
276
+ return style;
277
+ }
278
+
279
+ function resolveTextStyle(settings: ArchivePopupSettings, prefix: string, fallbackPrefix?: string): TextStyles {
280
+ const values = settings as Record<string, unknown>;
281
+ const read = <Key extends keyof TextStyleFields>(key: Key) => (
282
+ values[\`\${prefix}\${key}\`] ?? (fallbackPrefix ? values[\`\${fallbackPrefix}\${key}\`] : undefined)
283
+ ) as TextStyleFields[Key];
284
+ const fontSettings = read('FontSettings');
285
+ return {
286
+ fontSettings: {
287
+ fontFamily: read('FontFamily'),
288
+ fontWeight: fontSettings?.fontWeight ?? 400,
289
+ fontStyle: fontSettings?.fontStyle ?? 'normal',
290
+ },
291
+ fontSize: read('FontSize') ?? 0.01,
292
+ lineHeight: read('LineHeight'),
293
+ letterSpacing: read('LetterSpacing') ?? 0,
294
+ wordSpacing: read('WordSpacing') ?? 0,
295
+ textAlign: read('TextAlign'),
296
+ textAppearance: read('TextAppearance'),
297
+ color: '#000000',
298
+ };
299
+ }
300
+
301
+ function getCSS(P: string): string {
302
+ return \`
303
+ .\${P}-trigger,
304
+ .\${P}-close {
305
+ display: inline-block;
306
+ margin: 0;
307
+ padding: 0;
308
+ border: 0;
309
+ background: none;
310
+ cursor: pointer;
311
+ white-space: nowrap;
312
+ transition: color 150ms ease;
313
+ -webkit-appearance: none;
314
+ appearance: none;
315
+ -webkit-tap-highlight-color: transparent;
316
+ }
317
+ .\${P}-trigger {
318
+ color: var(--\${P}-trigger-color);
319
+ }
320
+ .\${P}-close {
321
+ color: var(--\${P}-close-color);
322
+ }
323
+ .\${P}-trigger:focus,
324
+ .\${P}-close:focus {
325
+ outline: none;
326
+ }
327
+ .\${P}-trigger:focus-visible,
328
+ .\${P}-close:focus-visible {
329
+ outline: 1px solid currentColor;
330
+ outline-offset: 2px;
331
+ }
332
+ .\${P}-interactive .\${P}-trigger:hover,
333
+ .\${P}-state-hover .\${P}-trigger {
334
+ color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
335
+ }
336
+ .\${P}-close:hover {
337
+ color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
338
+ }
339
+ .\${P}-editor .\${P}-trigger {
340
+ cursor: default;
341
+ }
342
+ .\${P}-overlay {
343
+ position: fixed;
344
+ inset: 0;
345
+ z-index: 9997;
346
+ overflow: hidden;
347
+ overscroll-behavior: none;
348
+ opacity: 0;
349
+ pointer-events: none;
350
+ transition: opacity \${OVERLAY_ANIM_MS}ms ease;
351
+ }
352
+ .\${P}-inline-layer {
353
+ position: fixed;
354
+ inset: 0;
355
+ z-index: 9997;
356
+ overflow: hidden;
357
+ pointer-events: none;
358
+ }
359
+ .\${P}-overlay-editor {
360
+ inset: auto;
361
+ top: var(--cntrl-article-top, 0);
362
+ left: var(--cntrl-article-left, 0);
363
+ width: var(--cntrl-article-width, 100vw) !important;
364
+ height: var(--cntrl-viewport-height, 100vh) !important;
365
+ }
366
+ .\${P}-overlay-edit-mode {
367
+ z-index: 1;
368
+ }
369
+ .\${P}-overlay-active {
370
+ opacity: 1;
371
+ pointer-events: auto;
372
+ }
373
+ .\${P}-backdrop {
374
+ position: absolute;
375
+ inset: 0;
376
+ background-color: var(--\${P}-overlay-color);
377
+ }
378
+ .\${P}-media-layer {
379
+ position: absolute;
380
+ inset: 0;
381
+ pointer-events: none;
382
+ }
383
+ .\${P}-media {
384
+ position: absolute;
385
+ inset: 0;
386
+ width: 100%;
387
+ height: 100%;
388
+ object-fit: cover;
389
+ opacity: 0;
390
+ transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
391
+ }
392
+ .\${P}-media-contain {
393
+ object-fit: contain;
394
+ }
395
+ .\${P}-media-visible {
396
+ opacity: 1;
397
+ }
398
+ .\${P}-close {
399
+ position: absolute;
400
+ z-index: 2;
401
+ }
402
+ .\${P}-panel {
403
+ position: absolute;
404
+ top: var(--\${P}-panel-y);
405
+ left: var(--\${P}-panel-x);
406
+ z-index: 1;
407
+ box-sizing: border-box;
408
+ max-width: 100%;
409
+ max-height: 100%;
410
+ overflow-y: auto;
411
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
412
+ background-color: var(--\${P}-panel-color);
413
+ color: var(--\${P}-text-color);
414
+ overscroll-behavior: contain;
415
+ transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
416
+ }
417
+ .\${P}-overlay-active .\${P}-panel {
418
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
419
+ }
420
+ .\${P}-panel-settled {
421
+ transition: none;
422
+ }
423
+ .\${P}-panel-inline {
424
+ position: relative;
425
+ top: auto;
426
+ left: auto;
427
+ max-height: none;
428
+ transform: none;
429
+ transition: none;
430
+ }
431
+ .\${P}-media-layer-instant .\${P}-media {
432
+ transition: none;
433
+ }
434
+ .\${P}-panel-copy {
435
+ position: absolute;
436
+ pointer-events: none;
437
+ }
438
+ .\${P}-panel-copy .\${P}-row-active .\${P}-title {
439
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
440
+ }
441
+ @media (prefers-reduced-motion: reduce) {
442
+ .\${P}-panel {
443
+ transition: none;
444
+ }
445
+ }
446
+ .\${P}-group ~ .\${P}-group {
447
+ margin-top: var(--\${P}-group-gap);
448
+ }
449
+ .\${P}-row {
450
+ display: grid;
451
+ grid-template-columns: var(--\${P}-grid-columns);
452
+ column-gap: var(--\${P}-column-gap);
453
+ align-items: baseline;
454
+ }
455
+ .\${P}-group-label {
456
+ min-width: 0;
457
+ overflow-wrap: anywhere;
458
+ }
459
+ .\${P}-title {
460
+ min-width: 0;
461
+ overflow-wrap: anywhere;
462
+ transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
463
+ }
464
+ .\${P}-control-anchor {
465
+ position: absolute;
466
+ pointer-events: none;
467
+ z-index: 2;
468
+ }
469
+ .\${P}-title a {
470
+ text-decoration: inherit;
471
+ }
472
+ .\${P}-interactive .\${P}-row:hover .\${P}-title,
473
+ .\${P}-row:focus-within .\${P}-title,
474
+ .\${P}-state-hover .\${P}-row:first-child .\${P}-title {
475
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
476
+ }
477
+ \`;
478
+ }
479
+
480
+ function ArchivePopupMediaItem({
481
+ P,
482
+ media,
483
+ isVisible,
484
+ }: {
485
+ P: string;
486
+ media: ArchivePopupMedia;
487
+ isVisible: boolean;
488
+ }) {
489
+ const videoRef = useRef<HTMLVideoElement>(null);
490
+ const [isLoaded, setIsLoaded] = useState(false);
491
+ const isVideo = isVideoMedia(media);
492
+ const className = cn(
493
+ \`\${P}-media\`,
494
+ media.objectFit === 'contain' && \`\${P}-media-contain\`,
495
+ isVisible && isLoaded && \`\${P}-media-visible\`,
496
+ );
497
+
498
+ useEffect(() => {
499
+ const video = videoRef.current;
500
+ if (!isVideo || !video) return;
501
+ if (isVisible) {
502
+ video.play()?.catch(() => {});
503
+ } else {
504
+ video.pause();
505
+ }
506
+ }, [isVideo, isVisible]);
507
+
508
+ if (isVideo) {
509
+ return (
510
+ <video
511
+ ref={videoRef}
512
+ className={className}
513
+ src={media.assetId}
514
+ muted
515
+ loop
516
+ playsInline
517
+ preload="auto"
518
+ onLoadedData={() => setIsLoaded(true)}
519
+ />
520
+ );
521
+ }
522
+
523
+ return (
524
+ <img
525
+ className={className}
526
+ src={media.assetId}
527
+ alt=""
528
+ decoding="async"
529
+ onLoad={() => setIsLoaded(true)}
530
+ />
531
+ );
532
+ }
533
+
534
+ // A line in each gap, at the right edge of the column it sizes, as Programme's are.
535
+ function renderColumnWidthControls(
536
+ P: string,
537
+ widths: number[],
538
+ paddingLeft: number,
539
+ columnGap: number,
540
+ scaled: (value: number) => string,
541
+ ) {
542
+ const lastWidth = widths[widths.length - 1];
543
+ let columnLeft = paddingLeft;
544
+ return widths.slice(0, -1).map((width, index) => {
545
+ const gapCenter = columnLeft + width + columnGap / 2;
546
+ columnLeft += width + columnGap;
547
+ return (
548
+ <div
549
+ key={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
550
+ data-controls={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
551
+ data-controls-axis="x"
552
+ data-controls-variant="column-width"
553
+ data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
554
+ // a column grows into the last one, which the editor keeps from going under its own least
555
+ data-controls-max-fraction={String(width + lastWidth)}
556
+ className={\`\${P}-control-anchor\`}
557
+ style={{ top: 0, left: scaled(gapCenter - COLUMN_RESIZE_HANDLE_WIDTH / 2), width: scaled(COLUMN_RESIZE_HANDLE_WIDTH), height: '100%' }}
558
+ />
559
+ );
560
+ });
561
+ }
562
+
563
+ function renderPanelPaddingControls(
564
+ P: string,
565
+ panelWidth: number,
566
+ padding: Padding,
567
+ scaled: (value: number) => string,
568
+ ) {
569
+ const handleSize = (value: number) => scaled(Math.max(value, PADDING_HANDLE_SIZE));
570
+ return (
571
+ <>
572
+ <div
573
+ data-controls="panelPadding.top"
574
+ data-controls-axis="y"
575
+ data-controls-variant="row-padding"
576
+ data-controls-min="0"
577
+ className={\`\${P}-control-anchor\`}
578
+ style={{ top: 0, left: 0, width: '100%', height: handleSize(padding.top) }}
579
+ />
580
+ <div
581
+ data-controls="panelPadding.bottom"
582
+ data-controls-axis="y"
583
+ data-controls-variant="row-padding"
584
+ data-controls-reverse=""
585
+ data-controls-min="0"
586
+ className={\`\${P}-control-anchor\`}
587
+ style={{ bottom: 0, left: 0, width: '100%', height: handleSize(padding.bottom) }}
588
+ />
589
+ <div
590
+ data-controls="panelPadding.left"
591
+ data-controls-axis="x"
592
+ data-controls-variant="column-padding"
593
+ data-controls-min="0"
594
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.right))}
595
+ className={\`\${P}-control-anchor\`}
596
+ style={{ top: 0, left: 0, width: handleSize(padding.left), height: '100%' }}
597
+ />
598
+ <div
599
+ data-controls="panelPadding.right"
600
+ data-controls-axis="x"
601
+ data-controls-variant="column-padding"
602
+ data-controls-reverse=""
603
+ data-controls-min="0"
604
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.left))}
605
+ className={\`\${P}-control-anchor\`}
606
+ style={{ top: 0, right: 0, width: handleSize(padding.right), height: '100%' }}
607
+ />
608
+ </>
609
+ );
610
+ }
611
+
612
+ export function ArchivePopup({
613
+ settings,
614
+ content,
615
+ isEditor,
616
+ isEditMode,
617
+ isPreviewMode,
618
+ activeEvent,
619
+ portalId,
620
+ currentState,
621
+ unavailableStates,
622
+ }: ArchivePopupProps) {
623
+ const { prefix: P } = useScopedStyles();
624
+ const {
625
+ type = 'a',
626
+ triggerLabel = 'Archive',
627
+ closeLabel = 'Close',
628
+ columns = ARCHIVE_POPUP_MIN_COLUMNS,
629
+ columnGap = DEFAULT_COLUMN_GAP,
630
+ panelPosition,
631
+ panelWidth = DEFAULT_PANEL_WIDTH,
632
+ panelPadding = DEFAULT_PANEL_PADDING,
633
+ panelRadius = 0,
634
+ groupGap = 0.0139,
635
+ triggerColor = '#000000',
636
+ triggerHoverColor = '#666666',
637
+ closeColor = '#000000',
638
+ closeHoverColor = '#666666',
639
+ panelColor = '#FFFFFF',
640
+ textColor = '#333132',
641
+ textHoverColor = '#BBBBBB',
642
+ overlayColor = '#FFFFFFE6',
643
+ } = settings;
644
+ const items = content ?? [];
645
+ const wrapperRef = useRef<HTMLDivElement>(null);
646
+ const triggerRef = useRef<HTMLButtonElement>(null);
647
+ const overlayRef = useRef<HTMLDivElement>(null);
648
+ const closeRef = useRef<HTMLButtonElement>(null);
649
+ const panelRef = useRef<HTMLDivElement>(null);
650
+ const inlineLayerRef = useRef<HTMLDivElement>(null);
651
+ const [isOpenUser, setIsOpen] = useState(false);
652
+ const [isOverlayMounted, setIsOverlayMounted] = useState(false);
653
+ const [isOverlayActive, setIsOverlayActive] = useState(false);
654
+ const [isOverlaySettled, setIsOverlaySettled] = useState(false);
655
+ const [activeIndex, setActiveIndex] = useState<number | null>(null);
656
+ const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
657
+ const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
658
+ const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
659
+ const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
660
+ const [isMediaCut, setIsMediaCut] = useState(false);
661
+
662
+ const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
663
+ const isInteractive = !isEditor || Boolean(isPreviewMode);
664
+ // B has no popup to open: its panel is always shown in place of the label.
665
+ const isInline = type === 'b';
666
+ const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
667
+ // Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
668
+ const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
669
+ const scaled = (value: number) => scalingValue(value, isEditor ?? false);
670
+ const scopedCss = useMemo(() => getCSS(P), [P]);
671
+ const groups = useMemo(() => groupArchiveRows(content ?? []), [content]);
672
+ const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
673
+ const columnCount = getColumnCount(columns);
674
+ const columnWidths = resolveArchivePopupColumnWidths(settings);
675
+ // the group takes the first column, the titles the rest
676
+ const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
677
+
678
+ useLightboxScrollLock(isOpen && !isEditorCanvas);
679
+
680
+ useEffect(() => {
681
+ if (isEditorCanvas && !isEditMode) setIsOpen(false);
682
+ }, [isEditorCanvas, isEditMode]);
683
+
684
+ useEffect(() => {
685
+ if (isOpen) {
686
+ setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
687
+ setIsOverlayMounted(true);
688
+ return;
689
+ }
690
+ setIsOverlayActive(false);
691
+ setActiveIndex(null);
692
+ const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
693
+ return () => window.clearTimeout(timer);
694
+ }, [isOpen]);
695
+
696
+ // Activate only after the mounted overlay's hidden styles are applied, or the appear has nothing to transition from.
697
+ useEffect(() => {
698
+ if (!isOpen || !isOverlayMounted) return;
699
+ overlayRef.current?.getBoundingClientRect();
700
+ const frame = requestAnimationFrame(() => setIsOverlayActive(true));
701
+ return () => cancelAnimationFrame(frame);
702
+ }, [isOpen, isOverlayMounted]);
703
+
704
+ // Canvas controls measure their anchors once, so they wait for the panel to finish sliding in.
705
+ useEffect(() => {
706
+ if (!isOverlayActive) {
707
+ setIsOverlaySettled(false);
708
+ return;
709
+ }
710
+ const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
711
+ return () => window.clearTimeout(timer);
712
+ }, [isOverlayActive]);
713
+
714
+ // The close button sits exactly where the trigger is, so the label swaps in place.
715
+ const updateClosePosition = useCallback(() => {
716
+ const trigger = triggerRef.current;
717
+ const overlay = overlayRef.current;
718
+ if (!trigger || !overlay) return;
719
+ const triggerRect = trigger.getBoundingClientRect();
720
+ const overlayRect = overlay.getBoundingClientRect();
721
+ setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
722
+ }, []);
723
+
724
+ useLayoutEffect(() => {
725
+ if (!isOverlayMounted) return;
726
+ updateClosePosition();
727
+ window.addEventListener('resize', updateClosePosition);
728
+ return () => window.removeEventListener('resize', updateClosePosition);
729
+ }, [isOverlayMounted, updateClosePosition]);
730
+
731
+ useEffect(() => {
732
+ if (!isOpen || !isInteractive) return;
733
+ closeRef.current?.focus({ preventScroll: true });
734
+ const onKeyDown = (event: KeyboardEvent) => {
735
+ if (event.key === 'Escape') setIsOpen(false);
736
+ };
737
+ document.addEventListener('keydown', onKeyDown);
738
+ return () => document.removeEventListener('keydown', onKeyDown);
739
+ }, [isOpen, isInteractive]);
740
+
741
+ // B's media fills the screen above the page, so a copy of the panel is laid exactly over the real one to stay readable.
742
+ useLayoutEffect(() => {
743
+ if (!isInline || activeIndex === null) return;
744
+ const panelEl = panelRef.current;
745
+ const layer = inlineLayerRef.current;
746
+ if (!panelEl || !layer) return;
747
+ const panelRect = panelEl.getBoundingClientRect();
748
+ const layerRect = layer.getBoundingClientRect();
749
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
750
+ }, [isInline, activeIndex]);
751
+
752
+ // The copy stays over the list while the media fades out, so the list never shows through a fading image.
753
+ useEffect(() => {
754
+ if (activeIndex !== null) return;
755
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
756
+ return () => window.clearTimeout(timer);
757
+ }, [activeIndex]);
758
+
759
+ // The copy is only true to the panel until the page moves, so scrolling cuts the media at once rather than locking it,
760
+ // fading out included: a copy left over the list would stay put while the list scrolls away under it.
761
+ const isCopyShown = copyRect !== null;
762
+ useEffect(() => {
763
+ if (!isInline || !isCopyShown) return;
764
+ const cut = () => {
765
+ setIsMediaCut(true);
766
+ setActiveIndex(null);
767
+ setCopyRect(null);
768
+ };
769
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
770
+ window.addEventListener('resize', cut);
771
+ return () => {
772
+ document.removeEventListener('scroll', cut, { capture: true });
773
+ window.removeEventListener('resize', cut);
774
+ };
775
+ }, [isInline, isCopyShown]);
776
+
777
+ const close = () => {
778
+ if (!isInteractive) return;
779
+ setIsOpen(false);
780
+ triggerRef.current?.focus({ preventScroll: true });
781
+ };
782
+
783
+ const showRowMedia = (index: number) => {
784
+ if (!isInteractive || !items[index]?.image?.assetId) {
785
+ setActiveIndex(null);
786
+ return;
787
+ }
788
+ setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
789
+ if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
790
+ setIsMediaCut(false);
791
+ setActiveIndex(index);
792
+ };
793
+
794
+ const hideRowMedia = (index: number) => {
795
+ setActiveIndex((current) => (current === index ? null : current));
796
+ };
797
+
798
+ // Title links only navigate on a live page or in preview, not on the editor canvas.
799
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
800
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
801
+ event.preventDefault();
802
+ }
803
+ };
804
+
805
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
806
+ const columnTypographyCss = ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES.slice(0, columnCount).map((prefix) => (
807
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix, 'list'), isEditor))
808
+ ));
809
+
810
+ const colorVars = buildColorVars(P, {
811
+ triggerColor,
812
+ triggerHoverColor,
813
+ closeColor,
814
+ closeHoverColor,
815
+ panelColor,
816
+ textColor,
817
+ textHoverColor,
818
+ overlayColor,
819
+ }, COLOR_VAR_MAP, STATE_KEYS);
820
+ const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
821
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
822
+
823
+ const mediaLayer = (
824
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
825
+ {[...mountedMedia].map((index) => {
826
+ const media = items[index]?.image;
827
+ if (!media?.assetId) return null;
828
+ return (
829
+ <ArchivePopupMediaItem
830
+ key={\`\${index}-\${media.assetId}\`}
831
+ P={P}
832
+ media={media}
833
+ isVisible={activeIndex === index}
834
+ />
835
+ );
836
+ })}
837
+ </div>
838
+ );
839
+ // Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
840
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
841
+
842
+ const renderPanel = (isCopy: boolean) => (
843
+ <div
844
+ ref={isCopy ? undefined : panelRef}
845
+ className={cn(
846
+ \`\${P}-panel\`,
847
+ // Only the open and close slide; once open, a new position or size moves the panel straight there.
848
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
849
+ isInline && \`\${P}-panel-inline\`,
850
+ isCopy && \`\${P}-panel-copy\`,
851
+ )}
852
+ style={{
853
+ width: scaled(panelWidth),
854
+ paddingTop: scaled(panelPadding.top),
855
+ paddingRight: scaled(panelPadding.right),
856
+ paddingBottom: scaled(panelPadding.bottom),
857
+ paddingLeft: scaled(panelPadding.left),
858
+ borderRadius: scaled(panelRadius),
859
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
860
+ [\`--\${P}-panel-x\`]: panelOffset.x,
861
+ [\`--\${P}-panel-y\`]: panelOffset.y,
862
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
863
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
864
+ ...(isCopy && copyRect ? { top: copyRect.top, left: copyRect.left, width: copyRect.width } : {}),
865
+ } as CSSProperties}
866
+ data-lightbox-scrollable={isInline ? undefined : ''}
867
+ aria-hidden={isCopy || undefined}
868
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
869
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
870
+ >
871
+ {!isCopy && showPanelControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
872
+ {!isCopy && showPanelControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
873
+ {groups.map((group, groupIndex) => (
874
+ <Fragment key={groupIndex}>
875
+ {!isCopy && showPanelControls && groupIndex > 0 && (
876
+ // Left at its static top, the anchor sits right where the gap above this group starts.
877
+ <div
878
+ data-controls="groupGap"
879
+ data-controls-paired=""
880
+ data-controls-axis="y"
881
+ data-controls-reverse=""
882
+ data-controls-min="0"
883
+ className={\`\${P}-control-anchor\`}
884
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, PADDING_HANDLE_SIZE)) }}
885
+ />
886
+ )}
887
+ <div className={\`\${P}-group\`}>
888
+ {group.rows.map(({ item, index }, rowIndex) => (
889
+ <div
890
+ key={index}
891
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
892
+ {...(isCopy ? {} : {
893
+ onMouseEnter: () => showRowMedia(index),
894
+ onMouseLeave: () => hideRowMedia(index),
895
+ onFocus: () => showRowMedia(index),
896
+ onBlur: () => hideRowMedia(index),
897
+ })}
898
+ >
899
+ <span className={\`\${P}-group-label\`} style={columnTypographyCss[0]}>
900
+ {rowIndex === 0 ? group.label : ''}
901
+ </span>
902
+ {titleKeys.map((key, titleIndex) => {
903
+ const title = item[key];
904
+ return (
905
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>
906
+ {Array.isArray(title) ? <RichTextRenderer content={title} /> : title}
907
+ </div>
908
+ );
909
+ })}
910
+ </div>
911
+ ))}
912
+ </div>
913
+ </Fragment>
914
+ ))}
915
+ </div>
916
+ );
917
+
918
+ const overlay = isOverlayMounted ? (
919
+ <div
920
+ ref={overlayRef}
921
+ className={cn(
922
+ \`\${P}-overlay\`,
923
+ isEditor && \`\${P}-overlay-editor\`,
924
+ isEditMode && \`\${P}-overlay-edit-mode\`,
925
+ isOverlayActive && \`\${P}-overlay-active\`,
926
+ interactiveClass,
927
+ stateClass,
928
+ )}
929
+ style={{ ...colorVars, ...layoutStyle }}
930
+ role="dialog"
931
+ aria-modal="true"
932
+ aria-label={triggerLabel}
933
+ data-selection="none"
934
+ >
935
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
936
+ {mediaLayer}
937
+ <button
938
+ ref={closeRef}
939
+ type="button"
940
+ className={\`\${P}-close\`}
941
+ style={{
942
+ ...triggerTypographyCss,
943
+ top: closePosition?.top ?? 0,
944
+ left: closePosition?.left ?? 0,
945
+ visibility: closePosition ? 'visible' : 'hidden',
946
+ }}
947
+ onClick={close}
948
+ >
949
+ {closeLabel}
950
+ </button>
951
+ {renderPanel(false)}
952
+ </div>
953
+ ) : null;
954
+
955
+ const inlineLayer = isInline && mountedMedia.size > 0 ? (
956
+ <div
957
+ ref={inlineLayerRef}
958
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
959
+ style={{ ...colorVars, ...layoutStyle }}
960
+ aria-hidden="true"
961
+ data-selection="none"
962
+ >
963
+ {mediaLayer}
964
+ {copyRect && renderPanel(true)}
965
+ </div>
966
+ ) : null;
967
+ const portalContent = overlay ?? inlineLayer;
968
+
969
+ return (
970
+ <>
971
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
972
+ <div
973
+ ref={wrapperRef}
974
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
975
+ style={colorVars}
976
+ >
977
+ {isInline ? renderPanel(false) : (
978
+ <button
979
+ ref={triggerRef}
980
+ type="button"
981
+ className={\`\${P}-trigger\`}
982
+ style={triggerTypographyCss}
983
+ aria-haspopup="dialog"
984
+ aria-expanded={isOpen}
985
+ onClick={() => {
986
+ if (isInteractive) setIsOpen(true);
987
+ }}
988
+ >
989
+ {triggerLabel}
990
+ </button>
991
+ )}
992
+ </div>
993
+ {portalContent && typeof document !== 'undefined' && createPortal(
994
+ portalContent,
995
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
996
+ )}
997
+ </>
998
+ );
999
+ }
1000
+ `, C = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
3
1001
  import { CommonComponentProps } from '../props';
4
1002
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
5
1003
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -2640,7 +3638,7 @@ export function Burger({
2640
3638
  </div>
2641
3639
  );
2642
3640
  }
2643
- `, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3641
+ `, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2644
3642
  import { CommonComponentProps } from '../props';
2645
3643
  import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2646
3644
 
@@ -3169,7 +4167,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3169
4167
  </>
3170
4168
  );
3171
4169
  }
3172
- `, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
4170
+ `, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
3173
4171
  import cn from 'classnames';
3174
4172
  import { CommonComponentProps } from '../props';
3175
4173
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3917,7 +4915,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3917
4915
  </>
3918
4916
  );
3919
4917
  }
3920
- `, C = `import React, { useMemo, useState } from 'react';
4918
+ `, I = `import React, { useMemo, useState } from 'react';
3921
4919
  import { CommonComponentProps } from '../props';
3922
4920
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3923
4921
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4555,7 +5553,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4555
5553
  };
4556
5554
 
4557
5555
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4558
- `, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
5556
+ `, T = `import { Splide, SplideSlide } from '@splidejs/react-splide';
4559
5557
  import '@splidejs/react-splide/css/core';
4560
5558
  import { CommonComponentProps } from '../props';
4561
5559
  import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
@@ -6870,7 +7868,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6870
7868
  };
6871
7869
 
6872
7870
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6873
- `, I = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7871
+ `, E = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6874
7872
  import { CommonComponentProps } from '../props';
6875
7873
  import { scalingValue } from '../utils/scalingValue';
6876
7874
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -7443,7 +8441,7 @@ export function Helix({
7443
8441
  </>
7444
8442
  );
7445
8443
  }
7446
- `, T = `import { CommonComponentProps } from '../props';
8444
+ `, R = `import { CommonComponentProps } from '../props';
7447
8445
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7448
8446
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7449
8447
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -9832,7 +10830,7 @@ export function Hive({
9832
10830
  </>
9833
10831
  );
9834
10832
  }
9835
- `, E = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10833
+ `, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9836
10834
  import { createPortal } from 'react-dom';
9837
10835
  import { CommonComponentProps } from '../props';
9838
10836
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10597,7 +11595,7 @@ export type LightboxJournalSettings = {
10597
11595
  closeIconColor: string;
10598
11596
  closeIconHoverColor: string;
10599
11597
  };
10600
- `, R = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
11598
+ `, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
10601
11599
  import { createPortal } from 'react-dom';
10602
11600
  import { CommonComponentProps } from '../props';
10603
11601
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11143,7 +12141,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11143
12141
  </>
11144
12142
  );
11145
12143
  };
11146
- `, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12144
+ `, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11147
12145
  import { createPortal } from 'react-dom';
11148
12146
  import { CommonComponentProps } from '../props';
11149
12147
  import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -14248,7 +15246,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14248
15246
  </>
14249
15247
  );
14250
15248
  }
14251
- `, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15249
+ `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14252
15250
  import cn from 'classnames';
14253
15251
  import { CommonComponentProps } from '../props';
14254
15252
  import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -15106,7 +16104,7 @@ type MarqueeProps = {
15106
16104
  isPreviewMode?: boolean;
15107
16105
  isEditMode?: boolean;
15108
16106
  } & CommonComponentProps;
15109
- `, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16107
+ `, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15110
16108
  import cn from 'classnames';
15111
16109
  import { CommonComponentProps } from '../props';
15112
16110
  import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
@@ -16049,7 +17047,7 @@ type MarqueeTextProps = {
16049
17047
  isPreviewMode?: boolean;
16050
17048
  isEditMode?: boolean;
16051
17049
  } & CommonComponentProps;
16052
- `, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17050
+ `, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
16053
17051
  import { createPortal } from 'react-dom';
16054
17052
  import type React from 'react';
16055
17053
  import { CommonComponentProps } from '../props';
@@ -18531,7 +19529,7 @@ export function Mercury({
18531
19529
  </>
18532
19530
  );
18533
19531
  }
18534
- `, N = `import React, { useMemo, useState } from 'react';
19532
+ `, O = `import React, { useMemo, useState } from 'react';
18535
19533
  import { CommonComponentProps } from '../props';
18536
19534
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18537
19535
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19110,7 +20108,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19110
20108
  };
19111
20109
 
19112
20110
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19113
- `, H = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20111
+ `, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19114
20112
  import type React from 'react';
19115
20113
  import { CommonComponentProps } from '../props';
19116
20114
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -19949,7 +20947,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
19949
20947
  </>
19950
20948
  );
19951
20949
  }
19952
- `, O = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20950
+ `, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19953
20951
  import cn from 'classnames';
19954
20952
  import { CommonComponentProps } from '../props';
19955
20953
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20577,7 +21575,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20577
21575
  </>
20578
21576
  );
20579
21577
  }
20580
- `, _ = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21578
+ `, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20581
21579
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20582
21580
  import { CommonComponentProps } from '../props';
20583
21581
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21209,7 +22207,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21209
22207
  </>
21210
22208
  );
21211
22209
  }
21212
- `, F = `import React, { useCallback, useEffect, useRef, useState } from 'react';
22210
+ `, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
21213
22211
  import cn from 'classnames';
21214
22212
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21215
22213
  import { scalingValue } from '../utils/scalingValue';
@@ -22391,7 +23389,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22391
23389
  </svg>
22392
23390
  );
22393
23391
  }
22394
- `, W = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23392
+ `, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22395
23393
  import cn from 'classnames';
22396
23394
  import { CommonComponentProps } from '../props';
22397
23395
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23022,7 +24020,7 @@ type TestimonialsSettings = {
23022
24020
  logoHeight: number;
23023
24021
  captionMarginTop: number;
23024
24022
  };
23025
- `, D = `import cn from 'classnames';
24023
+ `, z = `import cn from 'classnames';
23026
24024
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
23027
24025
  import { CommonComponentProps } from '../props';
23028
24026
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23518,7 +24516,7 @@ type TestimonialsSettings = {
23518
24516
  icon?: string | null;
23519
24517
  };
23520
24518
  };
23521
- `, B = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24519
+ `, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23522
24520
  import type React from 'react';
23523
24521
  import { createPortal } from 'react-dom';
23524
24522
  import { CommonComponentProps } from '../props';
@@ -24051,29 +25049,30 @@ export function Waterfall({
24051
25049
  </>
24052
25050
  );
24053
25051
  }
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
25052
+ `, U = {
25053
+ [y.id]: S,
25054
+ [b.id]: C,
25055
+ [x.id]: w,
25056
+ [P.id]: $,
25057
+ [v.id]: I,
25058
+ [f.id]: T,
25059
+ [h.id]: E,
25060
+ [p.id]: R,
25061
+ [m.id]: M,
25062
+ [g.id]: L,
25063
+ [u.id]: k,
25064
+ [d.id]: A,
25065
+ [c.id]: N,
25066
+ [l.id]: H,
25067
+ [s.id]: O,
25068
+ [a.id]: _,
25069
+ [r.id]: F,
25070
+ [o.id]: W,
25071
+ [i.id]: D,
25072
+ [t.id]: B,
25073
+ [e.id]: z,
25074
+ [n.id]: V
24076
25075
  };
24077
25076
  export {
24078
- V as componentSources
25077
+ U as componentSources
24079
25078
  };