@cntrl-site/components 1.0.107-alpha.3 → 1.0.107-alpha.5
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/ArchivePopup-BLfx56G_.js +203 -0
- package/dist/ArchivePopup-DYYtVluM.mjs +794 -0
- package/dist/{ArchivePopupComponent-Dwh1vyqt.mjs → ArchivePopupComponent-BrP7Aary.mjs} +475 -465
- package/dist/{ArchivePopupComponent-CJz4GmEb.js → ArchivePopupComponent-CJsr5Jx9.js} +1 -1
- package/dist/{ClickGallerie-CYQMgrIr.js → ClickGallerie-41L7IKhN.js} +1 -1
- package/dist/{ClickGallerie-o2U6oyOF.mjs → ClickGallerie-CBquEuXQ.mjs} +1 -1
- package/dist/Components/ArchivePopup/ArchivePopup.d.ts +9 -5
- package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +15 -6
- package/dist/Components/utils/LinkWrapper.d.ts +1 -0
- package/dist/{ControlSlider-Kkec-i14.js → ControlSlider-D91b53un.js} +1 -1
- package/dist/{ControlSlider-LcZmviGX.mjs → ControlSlider-mp-LvrTR.mjs} +1 -1
- package/dist/{FAQ-BxhMo7T8.js → FAQ-8goVE-aB.js} +1 -1
- package/dist/{FAQ-CdwSft5p.mjs → FAQ-KL9X1-xe.mjs} +1 -1
- package/dist/{Grid-CFHTP3mb.js → Grid-Dec4bMvK.js} +1 -1
- package/dist/{Grid-e-gLfsji.mjs → Grid-wxlTwFLb.mjs} +1 -1
- package/dist/{ImageRevealSlider-BuukTGAK.js → ImageRevealSlider-Bv092gwv.js} +1 -1
- package/dist/{ImageRevealSlider-Df9sygk9.mjs → ImageRevealSlider-K_nNoquq.mjs} +1 -1
- package/dist/{Lightbox-DaunVrkp.js → Lightbox-C2r7Wt_8.js} +1 -1
- package/dist/{Lightbox-C_fXsfdz.mjs → Lightbox-Cyvva2uu.mjs} +1 -1
- package/dist/LinkWrapper-CFEH047t.mjs +14 -0
- package/dist/LinkWrapper-CzFwFtgU.js +1 -0
- package/dist/{Marquee-DfIP-tIN.js → Marquee-BacOdRJ9.js} +1 -1
- package/dist/{Marquee-DByooiWP.mjs → Marquee-DGbeihUh.mjs} +1 -1
- package/dist/{MarqueeText-DsUiV6Zv.js → MarqueeText-BuEx2FCt.js} +1 -1
- package/dist/{MarqueeText-D6FNCe6P.mjs → MarqueeText-DTlCevPX.mjs} +1 -1
- package/dist/{RichTextRenderer-K90Dd7pt.js → RichTextRenderer-CUEc4FaL.js} +1 -1
- package/dist/{RichTextRenderer-BptwNpbJ.mjs → RichTextRenderer-DizfCZEz.mjs} +1 -1
- package/dist/{Slider20-fMVeRfgx.js → Slider20-BdeHmG8C.js} +1 -1
- package/dist/{Slider20-CCzixTiN.mjs → Slider20-DS-FTzQC.mjs} +1 -1
- package/dist/{TestimonialGrid-CiCagfBU.js → TestimonialGrid-B0JHzqhv.js} +1 -1
- package/dist/{TestimonialGrid-CbsVxSn9.mjs → TestimonialGrid-BOqSqVin.mjs} +1 -1
- package/dist/{TestimonialSingle-BVm3Amrl.mjs → TestimonialSingle-7-PMnQ7u.mjs} +1 -1
- package/dist/{TestimonialSingle-BWXynGjv.js → TestimonialSingle-Bx_V-cYE.js} +1 -1
- package/dist/{components-CNE9For4.mjs → components-ChAw6dC4.mjs} +4 -4
- package/dist/{components-Do0vh-Ly.js → components-DYLz2yIK.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +12 -12
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +147 -59
- package/dist/sources.mjs +147 -59
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/ArchivePopup-CusTMh5M.js +0 -187
- package/dist/ArchivePopup-VGeTHbYB.mjs +0 -732
- package/dist/LinkWrapper-Ca84iPtg.js +0 -1
- package/dist/LinkWrapper-DZs9hlOn.mjs +0 -13
package/dist/sources.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-
|
|
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-BrP7Aary.mjs";
|
|
2
2
|
const S = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import cn from 'classnames';
|
|
5
5
|
import { CommonComponentProps } from '../props';
|
|
6
|
-
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
7
|
-
import {
|
|
6
|
+
import { buildColorVars, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
7
|
+
import { buildValidUrl } from '../utils/LinkWrapper';
|
|
8
8
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
9
9
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
10
10
|
|
|
@@ -15,8 +15,10 @@ type ArchivePopupMedia = {
|
|
|
15
15
|
objectFit?: 'cover' | 'contain';
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
/** Columns count the group column too
|
|
19
|
-
export const ARCHIVE_POPUP_MIN_COLUMNS =
|
|
18
|
+
/** Columns count the group column too; a single column is that column alone, each row showing its own text. */
|
|
19
|
+
export const ARCHIVE_POPUP_MIN_COLUMNS = 1;
|
|
20
|
+
/** A new popup shows the group and its title. */
|
|
21
|
+
export const ARCHIVE_POPUP_DEFAULT_COLUMNS = 2;
|
|
20
22
|
export const ARCHIVE_POPUP_MAX_COLUMNS = 5;
|
|
21
23
|
/** The fields of the columns after the title, in order; \`columns\` decides how many of them a row shows. */
|
|
22
24
|
export const ARCHIVE_POPUP_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
|
|
@@ -51,17 +53,19 @@ export const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'colum
|
|
|
51
53
|
|
|
52
54
|
type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
// Plain text; a row saved while titles were rich text still holds its nodes.
|
|
57
|
+
type ArchivePopupTitle = string | any[];
|
|
55
58
|
|
|
56
59
|
export type ArchivePopupContentItem = {
|
|
57
60
|
group?: string;
|
|
58
|
-
/**
|
|
61
|
+
/** Plain text, so the entry's \`link\` is the only link a row has. */
|
|
59
62
|
title?: ArchivePopupTitle;
|
|
60
63
|
title2?: ArchivePopupTitle;
|
|
61
64
|
title3?: ArchivePopupTitle;
|
|
62
65
|
title4?: ArchivePopupTitle;
|
|
63
|
-
/** The row's hover images, shown in turn while it is hovered; a row saved before there could be several holds just one. */
|
|
64
66
|
image?: ArchivePopupMedia | ArchivePopupMedia[];
|
|
67
|
+
/** The whole row links here. */
|
|
68
|
+
link?: ContentLink;
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
type FontSettings = { fontWeight: number; fontStyle: string };
|
|
@@ -185,7 +189,7 @@ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' |
|
|
|
185
189
|
& Partial<Record<ArchivePopupColumnWidthKey, number>>;
|
|
186
190
|
|
|
187
191
|
function getColumnCount(columns: number | undefined): number {
|
|
188
|
-
return Math.min(Math.max(Math.round(columns ??
|
|
192
|
+
return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_DEFAULT_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
/** The width a row's columns share: the panel's, less its padding and the gaps between them. */
|
|
@@ -254,6 +258,17 @@ export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefine
|
|
|
254
258
|
return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
|
|
255
259
|
}
|
|
256
260
|
|
|
261
|
+
// A title saved as rich text shows its words alone, a line to each paragraph, its links and styling dropped.
|
|
262
|
+
function getTitleText(title: ArchivePopupTitle | undefined): string {
|
|
263
|
+
if (!Array.isArray(title)) return title ?? '';
|
|
264
|
+
const getNodeText = (node: any): string => node.text ?? (node.children ?? []).map(getNodeText).join('');
|
|
265
|
+
return title.map(getNodeText).join('\\n');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
|
|
269
|
+
return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
|
|
270
|
+
}
|
|
271
|
+
|
|
257
272
|
function isVideoMedia(media: ArchivePopupMedia): boolean {
|
|
258
273
|
if (media.type === 'video') return true;
|
|
259
274
|
if (media.type === 'image') return false;
|
|
@@ -400,14 +415,26 @@ function getCSS(P: string): string {
|
|
|
400
415
|
height: 100%;
|
|
401
416
|
object-fit: cover;
|
|
402
417
|
opacity: 0;
|
|
403
|
-
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
404
418
|
}
|
|
405
419
|
.\${P}-media-contain {
|
|
406
420
|
object-fit: contain;
|
|
407
421
|
}
|
|
422
|
+
/* The image replaced stays whole under the next until that is in, then goes at once, so neither the page nor an older
|
|
423
|
+
image shows between them; only the image coming in and, as the list is left, those on screen fade. */
|
|
424
|
+
.\${P}-media-visible,
|
|
425
|
+
.\${P}-media-fading {
|
|
426
|
+
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
427
|
+
}
|
|
408
428
|
.\${P}-media-visible {
|
|
429
|
+
z-index: 1;
|
|
430
|
+
opacity: 1;
|
|
431
|
+
}
|
|
432
|
+
.\${P}-media-covered {
|
|
409
433
|
opacity: 1;
|
|
410
434
|
}
|
|
435
|
+
.\${P}-media-fading {
|
|
436
|
+
opacity: 0;
|
|
437
|
+
}
|
|
411
438
|
.\${P}-close {
|
|
412
439
|
position: absolute;
|
|
413
440
|
z-index: 2;
|
|
@@ -448,9 +475,6 @@ function getCSS(P: string): string {
|
|
|
448
475
|
position: absolute;
|
|
449
476
|
pointer-events: none;
|
|
450
477
|
}
|
|
451
|
-
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
452
|
-
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
453
|
-
}
|
|
454
478
|
@media (prefers-reduced-motion: reduce) {
|
|
455
479
|
.\${P}-panel {
|
|
456
480
|
transition: none;
|
|
@@ -470,6 +494,13 @@ function getCSS(P: string): string {
|
|
|
470
494
|
grid-template-columns: subgrid;
|
|
471
495
|
align-items: baseline;
|
|
472
496
|
}
|
|
497
|
+
a.\${P}-row {
|
|
498
|
+
color: inherit;
|
|
499
|
+
text-decoration: none;
|
|
500
|
+
}
|
|
501
|
+
.\${P}-group-unlabeled .\${P}-row {
|
|
502
|
+
grid-column: 1 / -1;
|
|
503
|
+
}
|
|
473
504
|
.\${P}-group-label {
|
|
474
505
|
grid-column: 1;
|
|
475
506
|
align-self: start;
|
|
@@ -479,6 +510,7 @@ function getCSS(P: string): string {
|
|
|
479
510
|
.\${P}-title {
|
|
480
511
|
min-width: 0;
|
|
481
512
|
overflow-wrap: anywhere;
|
|
513
|
+
white-space: pre-line;
|
|
482
514
|
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
483
515
|
}
|
|
484
516
|
.\${P}-control-anchor {
|
|
@@ -486,12 +518,10 @@ function getCSS(P: string): string {
|
|
|
486
518
|
pointer-events: none;
|
|
487
519
|
z-index: 2;
|
|
488
520
|
}
|
|
489
|
-
.\${P}-title a {
|
|
490
|
-
text-decoration: inherit;
|
|
491
|
-
}
|
|
492
521
|
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
493
|
-
.\${P}-row:focus-
|
|
494
|
-
.\${P}-
|
|
522
|
+
.\${P}-row:focus-visible .\${P}-title,
|
|
523
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title,
|
|
524
|
+
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
495
525
|
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
496
526
|
}
|
|
497
527
|
\`;
|
|
@@ -501,18 +531,27 @@ function ArchivePopupMediaItem({
|
|
|
501
531
|
P,
|
|
502
532
|
media,
|
|
503
533
|
isVisible,
|
|
534
|
+
isLoaded,
|
|
535
|
+
isCovered,
|
|
536
|
+
isFading,
|
|
537
|
+
onLoad,
|
|
504
538
|
}: {
|
|
505
539
|
P: string;
|
|
506
540
|
media: ArchivePopupMedia;
|
|
507
541
|
isVisible: boolean;
|
|
542
|
+
isLoaded: boolean;
|
|
543
|
+
isCovered: boolean;
|
|
544
|
+
isFading: boolean;
|
|
545
|
+
onLoad: () => void;
|
|
508
546
|
}) {
|
|
509
547
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
510
|
-
const [isLoaded, setIsLoaded] = useState(false);
|
|
511
548
|
const isVideo = isVideoMedia(media);
|
|
512
549
|
const className = cn(
|
|
513
550
|
\`\${P}-media\`,
|
|
514
551
|
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
515
552
|
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
553
|
+
isCovered && \`\${P}-media-covered\`,
|
|
554
|
+
isFading && \`\${P}-media-fading\`,
|
|
516
555
|
);
|
|
517
556
|
|
|
518
557
|
useEffect(() => {
|
|
@@ -535,7 +574,7 @@ function ArchivePopupMediaItem({
|
|
|
535
574
|
loop
|
|
536
575
|
playsInline
|
|
537
576
|
preload="auto"
|
|
538
|
-
onLoadedData={
|
|
577
|
+
onLoadedData={onLoad}
|
|
539
578
|
/>
|
|
540
579
|
);
|
|
541
580
|
}
|
|
@@ -546,7 +585,7 @@ function ArchivePopupMediaItem({
|
|
|
546
585
|
src={media.assetId}
|
|
547
586
|
alt=""
|
|
548
587
|
decoding="async"
|
|
549
|
-
onLoad={
|
|
588
|
+
onLoad={onLoad}
|
|
550
589
|
/>
|
|
551
590
|
);
|
|
552
591
|
}
|
|
@@ -645,7 +684,7 @@ export function ArchivePopup({
|
|
|
645
684
|
type = 'b',
|
|
646
685
|
triggerLabel = 'Archive',
|
|
647
686
|
closeLabel = 'Close',
|
|
648
|
-
columns =
|
|
687
|
+
columns = ARCHIVE_POPUP_DEFAULT_COLUMNS,
|
|
649
688
|
columnGap = DEFAULT_COLUMN_GAP,
|
|
650
689
|
hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
|
|
651
690
|
panelPosition,
|
|
@@ -677,6 +716,11 @@ export function ArchivePopup({
|
|
|
677
716
|
// Which of the hovered row's images shows, counted afresh on every hover.
|
|
678
717
|
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
679
718
|
const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
|
|
719
|
+
// The image just replaced, kept whole under the next while it fades in, and the last one shown, to fade out on leave.
|
|
720
|
+
const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
|
|
721
|
+
const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
|
|
722
|
+
const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
|
|
723
|
+
const shownMediaRef = useRef<string | null>(null);
|
|
680
724
|
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
681
725
|
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
682
726
|
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
@@ -691,12 +735,18 @@ export function ArchivePopup({
|
|
|
691
735
|
const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
|
|
692
736
|
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
693
737
|
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
694
|
-
const groups = useMemo(() => groupArchiveRows(content ?? []), [content]);
|
|
695
738
|
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
|
|
696
739
|
const columnCount = getColumnCount(columns);
|
|
697
740
|
const columnWidths = resolveArchivePopupColumnWidths(settings);
|
|
698
741
|
// the group takes the first column, the titles the rest
|
|
699
742
|
const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
|
|
743
|
+
// With the first column alone there is nothing for a group to span, so every row shows its own first column, as one list.
|
|
744
|
+
const hasGroupColumn = columnCount > 1;
|
|
745
|
+
const groups = useMemo<ArchivePopupGroup[]>(() => (
|
|
746
|
+
hasGroupColumn
|
|
747
|
+
? groupArchiveRows(content ?? [])
|
|
748
|
+
: [{ label: '', rows: (content ?? []).map((item, index) => ({ item, index })) }]
|
|
749
|
+
), [content, hasGroupColumn]);
|
|
700
750
|
|
|
701
751
|
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
702
752
|
|
|
@@ -823,6 +873,26 @@ export function ArchivePopup({
|
|
|
823
873
|
return () => window.clearInterval(timer);
|
|
824
874
|
}, [activeIndex, activeRowMediaCount, hoverInterval]);
|
|
825
875
|
|
|
876
|
+
// Before paint, or the replaced image would drop out for a frame before it is kept.
|
|
877
|
+
const shownAssetId = activeIndex === null ? undefined : getArchivePopupRowMedia(items[activeIndex])[activeMediaIndex]?.assetId;
|
|
878
|
+
const shownMedia = activeIndex !== null && shownAssetId !== undefined ? getMediaKey(activeIndex, activeMediaIndex, shownAssetId) : null;
|
|
879
|
+
const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
|
|
880
|
+
useLayoutEffect(() => {
|
|
881
|
+
const previous = shownMediaRef.current;
|
|
882
|
+
shownMediaRef.current = shownMedia;
|
|
883
|
+
// Leaving keeps both, to fade out together: the one under the last is still on screen while the last fades in.
|
|
884
|
+
if (shownMedia === null) return;
|
|
885
|
+
setLastShownMedia(shownMedia);
|
|
886
|
+
setCoveredMedia(previous);
|
|
887
|
+
}, [shownMedia]);
|
|
888
|
+
|
|
889
|
+
// The replaced image goes once the next has loaded and faded in over it, however long the load takes.
|
|
890
|
+
useEffect(() => {
|
|
891
|
+
if (!isShownMediaLoaded || coveredMedia === null) return;
|
|
892
|
+
const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
|
|
893
|
+
return () => window.clearTimeout(timer);
|
|
894
|
+
}, [isShownMediaLoaded, coveredMedia]);
|
|
895
|
+
|
|
826
896
|
const showRowMedia = (index: number) => {
|
|
827
897
|
if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
|
|
828
898
|
setActiveIndex(null);
|
|
@@ -840,7 +910,7 @@ export function ArchivePopup({
|
|
|
840
910
|
setActiveIndex((current) => (current === index ? null : current));
|
|
841
911
|
};
|
|
842
912
|
|
|
843
|
-
//
|
|
913
|
+
// Row links only navigate on a live page or in preview, not on the editor canvas.
|
|
844
914
|
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
845
915
|
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
846
916
|
event.preventDefault();
|
|
@@ -874,14 +944,21 @@ export function ArchivePopup({
|
|
|
874
944
|
|
|
875
945
|
const mediaLayer = (
|
|
876
946
|
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
877
|
-
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) =>
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
947
|
+
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) => {
|
|
948
|
+
const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
|
|
949
|
+
return (
|
|
950
|
+
<ArchivePopupMediaItem
|
|
951
|
+
key={mediaKey}
|
|
952
|
+
P={P}
|
|
953
|
+
media={media}
|
|
954
|
+
isVisible={mediaKey === shownMedia}
|
|
955
|
+
isLoaded={loadedMedia.has(mediaKey)}
|
|
956
|
+
isCovered={mediaKey === coveredMedia}
|
|
957
|
+
isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
|
|
958
|
+
onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
|
|
959
|
+
/>
|
|
960
|
+
);
|
|
961
|
+
}))}
|
|
885
962
|
</div>
|
|
886
963
|
);
|
|
887
964
|
// Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
|
|
@@ -934,34 +1011,45 @@ export function ArchivePopup({
|
|
|
934
1011
|
)}
|
|
935
1012
|
{/* The label spans its group's rows, so its line height spaces only its own lines, never the rows beside it;
|
|
936
1013
|
a label longer than its rows grows the last track, below them. */}
|
|
937
|
-
<div
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
<div
|
|
946
|
-
key={index}
|
|
947
|
-
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
948
|
-
{...(isCopy ? {} : {
|
|
949
|
-
onMouseEnter: () => showRowMedia(index),
|
|
950
|
-
onMouseLeave: () => hideRowMedia(index),
|
|
951
|
-
onFocus: () => showRowMedia(index),
|
|
952
|
-
onBlur: () => hideRowMedia(index),
|
|
953
|
-
})}
|
|
1014
|
+
<div
|
|
1015
|
+
className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
|
|
1016
|
+
style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
|
|
1017
|
+
>
|
|
1018
|
+
{hasGroupColumn && (
|
|
1019
|
+
<span
|
|
1020
|
+
className={\`\${P}-group-label\`}
|
|
1021
|
+
style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
|
|
954
1022
|
>
|
|
955
|
-
{
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1023
|
+
{group.label}
|
|
1024
|
+
</span>
|
|
1025
|
+
)}
|
|
1026
|
+
{group.rows.map(({ item, index }) => {
|
|
1027
|
+
const rowLink = !isCopy && item.link?.value ? item.link : undefined;
|
|
1028
|
+
const RowElement = rowLink ? 'a' : 'div';
|
|
1029
|
+
return (
|
|
1030
|
+
<RowElement
|
|
1031
|
+
key={index}
|
|
1032
|
+
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
1033
|
+
{...(rowLink ? {
|
|
1034
|
+
href: buildValidUrl(rowLink.value),
|
|
1035
|
+
...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
|
|
1036
|
+
} : {})}
|
|
1037
|
+
{...(isCopy ? {} : {
|
|
1038
|
+
onMouseEnter: () => showRowMedia(index),
|
|
1039
|
+
onMouseLeave: () => hideRowMedia(index),
|
|
1040
|
+
onFocus: () => showRowMedia(index),
|
|
1041
|
+
onBlur: () => hideRowMedia(index),
|
|
1042
|
+
})}
|
|
1043
|
+
>
|
|
1044
|
+
{!hasGroupColumn && (
|
|
1045
|
+
<div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
|
|
1046
|
+
)}
|
|
1047
|
+
{titleKeys.map((key, titleIndex) => (
|
|
1048
|
+
<div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{getTitleText(item[key])}</div>
|
|
1049
|
+
))}
|
|
1050
|
+
</RowElement>
|
|
1051
|
+
);
|
|
1052
|
+
})}
|
|
965
1053
|
</div>
|
|
966
1054
|
</Fragment>
|
|
967
1055
|
))}
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./scalingValue-CSHYgTZl.js"),l=require("./buildColorVars-CE2D5cQV.js"),t=require("./getColorAlpha-CoSseoCn.js"),a=require("./formFieldValidation-DZl2KVaF.js"),o=require("./useScopedStyles-Bf6yohVQ.js"),s=require("./useLazyVideos-CdCbc2j0.js"),d=require("./readTestimonialTextMeasure-CEPaB4Sy.js"),i=require("./panelAvailability-DnOe0rQ4.js"),m=require("./LinkWrapper-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./scalingValue-CSHYgTZl.js"),l=require("./buildColorVars-CE2D5cQV.js"),t=require("./getColorAlpha-CoSseoCn.js"),a=require("./formFieldValidation-DZl2KVaF.js"),o=require("./useScopedStyles-Bf6yohVQ.js"),s=require("./useLazyVideos-CdCbc2j0.js"),d=require("./readTestimonialTextMeasure-CEPaB4Sy.js"),i=require("./panelAvailability-DnOe0rQ4.js"),m=require("./LinkWrapper-CzFwFtgU.js"),e=require("./EmbedMediaFrame-DsOTKE4i.js");exports.scalingValue=r.scalingValue;exports.buildColorVars=l.buildColorVars;exports.getColorAlpha=t.getColorAlpha;exports.getFormFieldValidationError=a.getFormFieldValidationError;exports.isValidEmailFormat=a.isValidEmailFormat;exports.isValidPhoneFormat=a.isValidPhoneFormat;exports.useScopedStyles=o.useScopedStyles;exports.useLazyVideos=s.useLazyVideos;exports.readTestimonialTextMeasure=d.readTestimonialTextMeasure;exports.getAvailableStatePanels=i.getAvailableStatePanels;exports.getUnavailableStates=i.getUnavailableStates;exports.isPanelAvailable=i.isPanelAvailable;exports.LinkWrapper=m.LinkWrapper;exports.EmbedMediaFrame=e.EmbedMediaFrame;exports.getEmbedAspect=e.getEmbedAspect;exports.getEmbedPlayback=e.getEmbedPlayback;exports.getEmbedPlayerSrc=e.getEmbedPlayerSrc;exports.getEmbedProvider=e.getEmbedProvider;exports.isEmbedMedia=e.isEmbedMedia;exports.postEmbedCommand=e.postEmbedCommand;
|
package/dist/utils.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { u as g } from "./useScopedStyles-DhBG3557.mjs";
|
|
|
6
6
|
import { u as f } from "./useLazyVideos-CxXyEjRQ.mjs";
|
|
7
7
|
import { r as n } from "./readTestimonialTextMeasure-BIXpGFEt.mjs";
|
|
8
8
|
import { g as c, a as P, i as V } from "./panelAvailability-D179wwJx.mjs";
|
|
9
|
-
import { L as S } from "./LinkWrapper-
|
|
9
|
+
import { L as S } from "./LinkWrapper-CFEH047t.mjs";
|
|
10
10
|
import { E as y, g as A, a as C, b as L, c as M, i as h, p as k } from "./EmbedMediaFrame-DwHeOAy5.mjs";
|
|
11
11
|
export {
|
|
12
12
|
y as EmbedMediaFrame,
|
package/package.json
CHANGED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),a=require("react"),yt=require("react-dom"),w=require("classnames"),wt=require("./scalingValue-CSHYgTZl.js"),xt=require("./buildColorVars-CE2D5cQV.js"),Ct=require("./useScopedStyles-Bf6yohVQ.js"),bt=require("./RichTextRenderer-K90Dd7pt.js"),H=require("./textStylesToCss-CNN3zZTV.js"),St=require("./useLightboxScrollLock-Hf16Eq4g.js"),F=2,Te=5,Ne=["title2","title3","title4"],O=["column1Width","column2Width","column3Width","column4Width"],J={center:{x:"50%",y:"50%"},"left-top":{x:"0%",y:"0%"},"top-center":{x:"50%",y:"0%"},"top-right":{x:"100%",y:"0%"},"left-center":{x:"0%",y:"50%"},"right-center":{x:"100%",y:"50%"},"left-bottom":{x:"0%",y:"100%"},"bottom-center":{x:"50%",y:"100%"},"right-bottom":{x:"100%",y:"100%"}},_t=Object.keys(J),je=["column1","column2","column3","column4","column5"],Et={triggerColor:"trigger-color",triggerHoverColor:"trigger-hover-color",closeColor:"close-color",closeHoverColor:"close-hover-color",panelColor:"panel-color",textColor:"text-color",textHoverColor:"text-hover-color",overlayColor:"overlay-color"},Lt=["hover","open"],M=300,He=.004,Ie=.004,At=20,Fe=.0139,Ue=.3194,Ve={top:.00972,right:.00972,bottom:.00972,left:.00972},ze=300,Rt=1e3,It=["--cntrl-article-width","--cntrl-article-top","--cntrl-article-left","--cntrl-viewport-height"];function U(e){return Math.min(Math.max(Math.round(e??F),F),Te)}function Be(e){const{panelWidth:o=Ue,panelPadding:n=Ve,columnGap:i=Fe}=e,l=(U(e.columns)-1)*i;return Math.max(0,o-n.left-n.right-l)}function De(e){const o=U(e.columns),n=Be(e)/o;return Object.fromEntries(O.slice(0,o-1).map(i=>[i,n]))}function We(e){const o=U(e.columns),n=Be(e),i=O.slice(0,o-1).map(f=>{const p=e[f];return typeof p=="number"?Math.max(0,p):n/o}),l=i.reduce((f,p)=>f+p,0),u=l>n?n/l:1;return[...i.map(f=>f*u),Math.max(0,n-l*u)]}function Mt(e,o){return typeof e.columns!="number"||e.columns===o.columns?e:{...e,...De({...o,...e})}}function Ot(e){const o=e.reduce((n,i)=>n+i,0);return e.map(n=>`minmax(0, ${o>0?n/o*100:1}fr)`).join(" ")}function ke(e){const o=[];return e.forEach((n,i)=>{var d;const l=((d=n.group)==null?void 0:d.trim())??"",u=o[o.length-1];if(!u||l!==""&&l!==u.label){o.push({label:l,rows:[{item:n,index:i}]});return}u.rows.push({item:n,index:i})}),o}function I(e){const{image:o}=e??{};return(Array.isArray(o)?o:o?[o]:[]).filter(n=>!!(n!=null&&n.assetId))}function qe(e){return e.type==="video"?!0:e.type==="image"?!1:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name??"")||/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId)}function Tt(e){let o=e;for(;o;){if(getComputedStyle(o).getPropertyValue("--cntrl-article-width").trim())return o;o=o.parentElement}return e}function Me(e){const o={},n=Tt(e);if(!n)return o;const i=getComputedStyle(n);for(const l of It){const u=i.getPropertyValue(l).trim();u&&(o[l]=u)}return o}function Oe(e,o,n){const i=e,l=d=>i[`${o}${d}`]??(n?i[`${n}${d}`]:void 0),u=l("FontSettings");return{fontSettings:{fontFamily:l("FontFamily"),fontWeight:(u==null?void 0:u.fontWeight)??400,fontStyle:(u==null?void 0:u.fontStyle)??"normal"},fontSize:l("FontSize")??.01,lineHeight:l("LineHeight"),letterSpacing:l("LetterSpacing")??0,wordSpacing:l("WordSpacing")??0,textAlign:l("TextAlign"),textAppearance:l("TextAppearance"),color:"#000000"}}function Nt(e){return`
|
|
2
|
-
.${e}-trigger,
|
|
3
|
-
.${e}-close {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
margin: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
border: 0;
|
|
8
|
-
background: none;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
white-space: nowrap;
|
|
11
|
-
transition: color 150ms ease;
|
|
12
|
-
-webkit-appearance: none;
|
|
13
|
-
appearance: none;
|
|
14
|
-
-webkit-tap-highlight-color: transparent;
|
|
15
|
-
}
|
|
16
|
-
.${e}-trigger {
|
|
17
|
-
color: var(--${e}-trigger-color);
|
|
18
|
-
transition: color 150ms ease, opacity ${M}ms ease;
|
|
19
|
-
}
|
|
20
|
-
.${e}-trigger-hidden {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
}
|
|
23
|
-
.${e}-close {
|
|
24
|
-
color: var(--${e}-close-color);
|
|
25
|
-
}
|
|
26
|
-
.${e}-trigger:focus,
|
|
27
|
-
.${e}-close:focus {
|
|
28
|
-
outline: none;
|
|
29
|
-
}
|
|
30
|
-
.${e}-trigger:focus-visible,
|
|
31
|
-
.${e}-close:focus-visible {
|
|
32
|
-
outline: 1px solid currentColor;
|
|
33
|
-
outline-offset: 2px;
|
|
34
|
-
}
|
|
35
|
-
.${e}-interactive .${e}-trigger:hover,
|
|
36
|
-
.${e}-state-hover .${e}-trigger {
|
|
37
|
-
color: var(--${e}-trigger-hover-color, var(--${e}-trigger-color));
|
|
38
|
-
}
|
|
39
|
-
.${e}-close:hover {
|
|
40
|
-
color: var(--${e}-close-hover-color, var(--${e}-close-color));
|
|
41
|
-
}
|
|
42
|
-
.${e}-editor .${e}-trigger {
|
|
43
|
-
cursor: default;
|
|
44
|
-
}
|
|
45
|
-
.${e}-overlay {
|
|
46
|
-
position: fixed;
|
|
47
|
-
inset: 0;
|
|
48
|
-
z-index: 9997;
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
overscroll-behavior: none;
|
|
51
|
-
opacity: 0;
|
|
52
|
-
pointer-events: none;
|
|
53
|
-
transition: opacity ${M}ms ease;
|
|
54
|
-
}
|
|
55
|
-
.${e}-inline-layer {
|
|
56
|
-
position: fixed;
|
|
57
|
-
inset: 0;
|
|
58
|
-
z-index: 9997;
|
|
59
|
-
overflow: hidden;
|
|
60
|
-
pointer-events: none;
|
|
61
|
-
}
|
|
62
|
-
.${e}-overlay-editor {
|
|
63
|
-
inset: auto;
|
|
64
|
-
top: var(--cntrl-article-top, 0);
|
|
65
|
-
left: var(--cntrl-article-left, 0);
|
|
66
|
-
width: var(--cntrl-article-width, 100vw) !important;
|
|
67
|
-
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
68
|
-
}
|
|
69
|
-
.${e}-overlay-edit-mode {
|
|
70
|
-
z-index: 1;
|
|
71
|
-
}
|
|
72
|
-
.${e}-overlay-active {
|
|
73
|
-
opacity: 1;
|
|
74
|
-
pointer-events: auto;
|
|
75
|
-
}
|
|
76
|
-
.${e}-backdrop {
|
|
77
|
-
position: absolute;
|
|
78
|
-
inset: 0;
|
|
79
|
-
background-color: var(--${e}-overlay-color);
|
|
80
|
-
}
|
|
81
|
-
.${e}-media-layer {
|
|
82
|
-
position: absolute;
|
|
83
|
-
inset: 0;
|
|
84
|
-
pointer-events: none;
|
|
85
|
-
}
|
|
86
|
-
.${e}-media {
|
|
87
|
-
position: absolute;
|
|
88
|
-
inset: 0;
|
|
89
|
-
width: 100%;
|
|
90
|
-
height: 100%;
|
|
91
|
-
object-fit: cover;
|
|
92
|
-
opacity: 0;
|
|
93
|
-
transition: opacity ${ze}ms cubic-bezier(0, 0, 0.58, 1);
|
|
94
|
-
}
|
|
95
|
-
.${e}-media-contain {
|
|
96
|
-
object-fit: contain;
|
|
97
|
-
}
|
|
98
|
-
.${e}-media-visible {
|
|
99
|
-
opacity: 1;
|
|
100
|
-
}
|
|
101
|
-
.${e}-close {
|
|
102
|
-
position: absolute;
|
|
103
|
-
z-index: 2;
|
|
104
|
-
}
|
|
105
|
-
.${e}-panel {
|
|
106
|
-
position: absolute;
|
|
107
|
-
top: var(--${e}-panel-y);
|
|
108
|
-
left: var(--${e}-panel-x);
|
|
109
|
-
z-index: 1;
|
|
110
|
-
box-sizing: border-box;
|
|
111
|
-
max-width: 100%;
|
|
112
|
-
max-height: 100%;
|
|
113
|
-
overflow-y: auto;
|
|
114
|
-
transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y) + 12px));
|
|
115
|
-
background-color: var(--${e}-panel-color);
|
|
116
|
-
color: var(--${e}-text-color);
|
|
117
|
-
overscroll-behavior: contain;
|
|
118
|
-
transition: transform ${M}ms cubic-bezier(0, 0, 0.58, 1);
|
|
119
|
-
}
|
|
120
|
-
.${e}-overlay-active .${e}-panel {
|
|
121
|
-
transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y)));
|
|
122
|
-
}
|
|
123
|
-
.${e}-panel-settled {
|
|
124
|
-
transition: none;
|
|
125
|
-
}
|
|
126
|
-
.${e}-panel-inline {
|
|
127
|
-
position: relative;
|
|
128
|
-
top: auto;
|
|
129
|
-
left: auto;
|
|
130
|
-
max-height: none;
|
|
131
|
-
transform: none;
|
|
132
|
-
transition: none;
|
|
133
|
-
}
|
|
134
|
-
.${e}-media-layer-instant .${e}-media {
|
|
135
|
-
transition: none;
|
|
136
|
-
}
|
|
137
|
-
.${e}-panel-copy {
|
|
138
|
-
position: absolute;
|
|
139
|
-
pointer-events: none;
|
|
140
|
-
}
|
|
141
|
-
.${e}-panel-copy .${e}-row-active .${e}-title {
|
|
142
|
-
color: var(--${e}-text-hover-color, var(--${e}-text-color));
|
|
143
|
-
}
|
|
144
|
-
@media (prefers-reduced-motion: reduce) {
|
|
145
|
-
.${e}-panel {
|
|
146
|
-
transition: none;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
.${e}-group ~ .${e}-group {
|
|
150
|
-
margin-top: var(--${e}-group-gap);
|
|
151
|
-
}
|
|
152
|
-
.${e}-group {
|
|
153
|
-
display: grid;
|
|
154
|
-
grid-template-columns: var(--${e}-grid-columns);
|
|
155
|
-
column-gap: var(--${e}-column-gap);
|
|
156
|
-
}
|
|
157
|
-
.${e}-row {
|
|
158
|
-
grid-column: 2 / -1;
|
|
159
|
-
display: grid;
|
|
160
|
-
grid-template-columns: subgrid;
|
|
161
|
-
align-items: baseline;
|
|
162
|
-
}
|
|
163
|
-
.${e}-group-label {
|
|
164
|
-
grid-column: 1;
|
|
165
|
-
align-self: start;
|
|
166
|
-
min-width: 0;
|
|
167
|
-
overflow-wrap: anywhere;
|
|
168
|
-
}
|
|
169
|
-
.${e}-title {
|
|
170
|
-
min-width: 0;
|
|
171
|
-
overflow-wrap: anywhere;
|
|
172
|
-
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
173
|
-
}
|
|
174
|
-
.${e}-control-anchor {
|
|
175
|
-
position: absolute;
|
|
176
|
-
pointer-events: none;
|
|
177
|
-
z-index: 2;
|
|
178
|
-
}
|
|
179
|
-
.${e}-title a {
|
|
180
|
-
text-decoration: inherit;
|
|
181
|
-
}
|
|
182
|
-
.${e}-interactive .${e}-row:hover .${e}-title,
|
|
183
|
-
.${e}-row:focus-within .${e}-title,
|
|
184
|
-
.${e}-state-hover .${e}-group-label + .${e}-row .${e}-title {
|
|
185
|
-
color: var(--${e}-text-hover-color, var(--${e}-text-color));
|
|
186
|
-
}
|
|
187
|
-
`}function jt({P:e,media:o,isVisible:n}){const i=a.useRef(null),[l,u]=a.useState(!1),d=qe(o),f=w(`${e}-media`,o.objectFit==="contain"&&`${e}-media-contain`,n&&l&&`${e}-media-visible`);return a.useEffect(()=>{var r;const p=i.current;!d||!p||(n?(r=p.play())==null||r.catch(()=>{}):p.pause())},[d,n]),d?c.jsx("video",{ref:i,className:f,src:o.assetId,muted:!0,loop:!0,playsInline:!0,preload:"auto",onLoadedData:()=>u(!0)}):c.jsx("img",{className:f,src:o.assetId,alt:"",decoding:"async",onLoad:()=>u(!0)})}function Ht(e,o,n,i,l){const u=o[o.length-1];let d=n;return o.slice(0,-1).map((f,p)=>{const r=d+f+i/2;return d+=f+i,c.jsx("div",{"data-controls":O[p],"data-controls-axis":"x","data-controls-variant":"column-width","data-controls-min":String(At),"data-controls-max-fraction":String(f+u),className:`${e}-control-anchor`,style:{top:0,left:l(r-Ie/2),width:l(Ie),height:"100%"}},O[p])})}function Ft(e,o,n,i){const l=u=>i(Math.max(u,He));return c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-controls":"panelPadding.top","data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-min":"0",className:`${e}-control-anchor`,style:{top:0,left:0,width:"100%",height:l(n.top)}}),c.jsx("div",{"data-controls":"panelPadding.bottom","data-controls-axis":"y","data-controls-variant":"row-padding","data-controls-reverse":"","data-controls-min":"0",className:`${e}-control-anchor`,style:{bottom:0,left:0,width:"100%",height:l(n.bottom)}}),c.jsx("div",{"data-controls":"panelPadding.left","data-controls-axis":"x","data-controls-variant":"column-padding","data-controls-min":"0","data-controls-max-fraction":String(Math.max(0,o-n.right)),className:`${e}-control-anchor`,style:{top:0,left:0,width:l(n.left),height:"100%"}}),c.jsx("div",{"data-controls":"panelPadding.right","data-controls-axis":"x","data-controls-variant":"column-padding","data-controls-reverse":"","data-controls-min":"0","data-controls-max-fraction":String(Math.max(0,o-n.left)),className:`${e}-control-anchor`,style:{top:0,right:0,width:l(n.right),height:"100%"}})]})}function Ut({settings:e,content:o,isEditor:n,isEditMode:i,isPreviewMode:l,activeEvent:u,portalId:d,currentState:f,unavailableStates:p}){var Ae;const{prefix:r}=Ct.useScopedStyles(),{type:Ge="b",triggerLabel:Q="Archive",closeLabel:Xe="Close",columns:Ye=F,columnGap:P=Fe,hoverInterval:ee=Rt,panelPosition:Ke,panelWidth:te=Ue,panelPadding:b=Ve,panelRadius:Ze=0,groupGap:oe=.0139,triggerColor:Je="#000000",triggerHoverColor:Qe="#666666",closeColor:Pe="#000000",closeHoverColor:et="#666666",panelColor:tt="#FFFFFF",textColor:ot="#333132",textHoverColor:nt="#BBBBBB",overlayColor:rt="#FFFFFFE6"}=e,V=o??[],z=a.useRef(null),B=a.useRef(null),D=a.useRef(null),ne=a.useRef(null),re=a.useRef(null),ae=a.useRef(null),[at,T]=a.useState(!1),[L,le]=a.useState(!1),[A,se]=a.useState(!1),[ie,ce]=a.useState(!1),[h,S]=a.useState(null),[lt,ue]=a.useState(0),[de,st]=a.useState(()=>new Set),[x,it]=a.useState(null),[pe,fe]=a.useState({}),[_,W]=a.useState(null),[ct,me]=a.useState(!1),R=!!(n&&!l),$=!n||!!l,g=Ge==="a",ut=R&&f==="open"&&!(p!=null&&p.includes("open")),y=!g&&(ut||($||!!i)&&at),v=t=>wt.scalingValue(t,n??!1),dt=a.useMemo(()=>Nt(r),[r]),pt=a.useMemo(()=>ke(o??[]),[o]),ge=J[Ke]??J.center,he=U(Ye),ve=We(e),ft=["title",...Ne].slice(0,he-1);St.useLightboxScrollLock(y&&!R),a.useEffect(()=>{R&&!i&&T(!1)},[R,i]),a.useEffect(()=>{if(y){fe(Me(z.current)),le(!0);return}se(!1),S(null);const t=window.setTimeout(()=>le(!1),M);return()=>window.clearTimeout(t)},[y]),a.useEffect(()=>{var s;if(!y||!L)return;(s=D.current)==null||s.getBoundingClientRect();const t=requestAnimationFrame(()=>se(!0));return()=>cancelAnimationFrame(t)},[y,L]),a.useEffect(()=>{if(!A){ce(!1);return}const t=window.setTimeout(()=>ce(!0),M);return()=>window.clearTimeout(t)},[A]);const N=a.useCallback(()=>{const t=B.current,s=D.current;if(!t||!s)return;const m=t.getBoundingClientRect(),C=s.getBoundingClientRect();it({top:m.top-C.top,left:m.left-C.left})},[]);a.useLayoutEffect(()=>{if(L)return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[L,N]),a.useEffect(()=>{var s;if(!y||!$)return;(s=ne.current)==null||s.focus({preventScroll:!0});const t=m=>{m.key==="Escape"&&T(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[y,$]),a.useLayoutEffect(()=>{if(!g||h===null)return;const t=re.current,s=ae.current;if(!t||!s)return;const m=t.getBoundingClientRect(),C=s.getBoundingClientRect();W({top:m.top-C.top,left:m.left-C.left,width:m.width})},[g,h]),a.useEffect(()=>{if(h!==null)return;const t=window.setTimeout(()=>W(null),ze);return()=>window.clearTimeout(t)},[h]);const $e=_!==null;a.useEffect(()=>{if(!g||!$e)return;const t=()=>{me(!0),S(null),W(null)};return document.addEventListener("scroll",t,{capture:!0,passive:!0}),window.addEventListener("resize",t),()=>{document.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t)}},[g,$e]);const ye=()=>{var t;$&&(T(!1),(t=B.current)==null||t.focus({preventScroll:!0}))},we=$&&(g||y);a.useEffect(()=>{we&&(o??[]).forEach(t=>I(t).forEach(s=>{qe(s)||(new Image().src=s.assetId)}))},[we,o]);const k=h===null?0:I(V[h]).length;a.useEffect(()=>{if(k<2)return;const t=window.setInterval(()=>{ue(s=>(s+1)%k)},Math.max(100,ee));return()=>window.clearInterval(t)},[h,k,ee]);const xe=t=>{if(!$||I(V[t]).length===0){S(null);return}st(s=>s.has(t)?s:new Set(s).add(t)),g&&h===null&&fe(Me(z.current)),h!==t&&ue(0),me(!1),S(t)},Ce=t=>{S(s=>s===t?null:s)},mt=t=>{!$&&t.target.closest("a")&&t.preventDefault()},be=H.omitTextColors(H.textStylesToCss(Oe(e,"trigger"),n)),j=je.slice(0,he).map(t=>H.omitTextColors(H.textStylesToCss(Oe(e,t,"list"),n))),Se=j[0].lineHeight,_e=(Ae=j[1])==null?void 0:Ae.lineHeight,gt=Se!==void 0&&_e!==void 0?`calc((${_e} - ${Se}) / 2)`:void 0,q=xt.buildColorVars(r,{triggerColor:Je,triggerHoverColor:Qe,closeColor:Pe,closeHoverColor:et,panelColor:tt,textColor:ot,textHoverColor:nt,overlayColor:rt},Et,Lt),G=u&&u!=="default"?`${r}-state-${u}`:"",X=$?`${r}-interactive`:"",Ee=c.jsx("div",{className:w(`${r}-media-layer`,ct&&`${r}-media-layer-instant`),"aria-hidden":"true",children:[...de].flatMap(t=>I(V[t]).map((s,m)=>c.jsx(jt,{P:r,media:s,isVisible:h===t&<===m},`${t}-${m}-${s.assetId}`)))}),Y=!!i&&(g||ie),K=t=>c.jsxs("div",{ref:t?void 0:re,className:w(`${r}-panel`,A&&ie&&`${r}-panel-settled`,g&&`${r}-panel-inline`,t&&`${r}-panel-copy`),style:{width:v(te),paddingTop:v(b.top),paddingRight:v(b.right),paddingBottom:v(b.bottom),paddingLeft:v(b.left),borderRadius:v(Ze),[`--${r}-group-gap`]:v(oe),[`--${r}-panel-x`]:ge.x,[`--${r}-panel-y`]:ge.y,[`--${r}-grid-columns`]:Ot(ve),[`--${r}-column-gap`]:v(P),...t&&_?{top:_.top,left:_.left,width:_.width}:{}},"data-lightbox-scrollable":g?void 0:"","aria-hidden":t||void 0,onMouseLeave:t?void 0:()=>S(null),onClickCapture:t?void 0:mt,children:[!t&&Y&&Ft(r,te,b,v),!t&&Y&&Ht(r,ve,b.left,P,v),pt.map((s,m)=>c.jsxs(a.Fragment,{children:[!t&&Y&&m>0&&c.jsx("div",{"data-controls":"groupGap","data-controls-paired":"","data-controls-axis":"y","data-controls-reverse":"","data-controls-min":"0",className:`${r}-control-anchor`,style:{left:0,width:"100%",height:v(Math.max(oe,He))}}),c.jsxs("div",{className:`${r}-group`,style:{gridTemplateRows:`repeat(${s.rows.length}, auto) 1fr`},children:[c.jsx("span",{className:`${r}-group-label`,style:{...j[0],gridRow:`1 / span ${s.rows.length+1}`,marginTop:gt},children:s.label}),s.rows.map(({item:C,index:E})=>c.jsx("div",{className:w(`${r}-row`,t&&E===h&&`${r}-row-active`),...t?{}:{onMouseEnter:()=>xe(E),onMouseLeave:()=>Ce(E),onFocus:()=>xe(E),onBlur:()=>Ce(E)},children:ft.map((Re,$t)=>{const Z=C[Re];return c.jsx("div",{className:`${r}-title`,style:j[$t+1],children:Array.isArray(Z)?c.jsx(bt.RichTextRenderer,{content:Z}):Z},Re)})},E))]})]},m))]}),ht=L?c.jsxs("div",{ref:D,className:w(`${r}-overlay`,n&&`${r}-overlay-editor`,i&&`${r}-overlay-edit-mode`,A&&`${r}-overlay-active`,X,G),style:{...q,...pe},role:"dialog","aria-modal":"true","aria-label":Q,"data-selection":"none",children:[c.jsx("div",{className:`${r}-backdrop`,"aria-hidden":"true",onClick:ye}),Ee,c.jsx("button",{ref:ne,type:"button",className:`${r}-close`,style:{...be,top:(x==null?void 0:x.top)??0,left:(x==null?void 0:x.left)??0,visibility:x?"visible":"hidden"},onClick:ye,children:Xe}),K(!1)]}):null,vt=g&&de.size>0?c.jsxs("div",{ref:ae,className:w(`${r}-inline-layer`,n&&`${r}-overlay-editor`,X,G),style:{...q,...pe},"aria-hidden":"true","data-selection":"none",children:[Ee,_&&K(!0)]}):null,Le=ht??vt;return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:dt}}),c.jsx("div",{ref:z,className:w(R&&`${r}-editor`,X,G),style:q,children:g?K(!1):c.jsx("button",{ref:B,type:"button",className:w(`${r}-trigger`,A&&`${r}-trigger-hidden`),style:be,"aria-haspopup":"dialog","aria-expanded":y,onClick:()=>{$&&T(!0)},children:Q})}),Le&&typeof document<"u"&&yt.createPortal(Le,(d?document.getElementById(d):null)??document.body)]})}exports.ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES=je;exports.ARCHIVE_POPUP_COLUMN_WIDTH_KEYS=O;exports.ARCHIVE_POPUP_EXTRA_TITLE_KEYS=Ne;exports.ARCHIVE_POPUP_MAX_COLUMNS=Te;exports.ARCHIVE_POPUP_MIN_COLUMNS=F;exports.ARCHIVE_POPUP_PANEL_POSITIONS=_t;exports.ArchivePopup=Ut;exports.applyArchivePopupColumnCountChange=Mt;exports.getArchivePopupEqualColumnWidths=De;exports.getArchivePopupRowMedia=I;exports.groupArchiveRows=ke;exports.resolveArchivePopupColumnWidths=We;
|