@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.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ArchivePopupComponent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ArchivePopupComponent-CJsr5Jx9.js"),e=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { CommonComponentProps } from '../props';
|
|
5
|
-
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
6
|
-
import {
|
|
5
|
+
import { buildColorVars, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
6
|
+
import { buildValidUrl } from '../utils/LinkWrapper';
|
|
7
7
|
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
8
8
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
9
9
|
|
|
@@ -14,8 +14,10 @@ type ArchivePopupMedia = {
|
|
|
14
14
|
objectFit?: 'cover' | 'contain';
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
/** Columns count the group column too
|
|
18
|
-
export const ARCHIVE_POPUP_MIN_COLUMNS =
|
|
17
|
+
/** Columns count the group column too; a single column is that column alone, each row showing its own text. */
|
|
18
|
+
export const ARCHIVE_POPUP_MIN_COLUMNS = 1;
|
|
19
|
+
/** A new popup shows the group and its title. */
|
|
20
|
+
export const ARCHIVE_POPUP_DEFAULT_COLUMNS = 2;
|
|
19
21
|
export const ARCHIVE_POPUP_MAX_COLUMNS = 5;
|
|
20
22
|
/** The fields of the columns after the title, in order; \`columns\` decides how many of them a row shows. */
|
|
21
23
|
export const ARCHIVE_POPUP_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
|
|
@@ -50,17 +52,19 @@ export const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'colum
|
|
|
50
52
|
|
|
51
53
|
type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
// Plain text; a row saved while titles were rich text still holds its nodes.
|
|
56
|
+
type ArchivePopupTitle = string | any[];
|
|
54
57
|
|
|
55
58
|
export type ArchivePopupContentItem = {
|
|
56
59
|
group?: string;
|
|
57
|
-
/**
|
|
60
|
+
/** Plain text, so the entry's \`link\` is the only link a row has. */
|
|
58
61
|
title?: ArchivePopupTitle;
|
|
59
62
|
title2?: ArchivePopupTitle;
|
|
60
63
|
title3?: ArchivePopupTitle;
|
|
61
64
|
title4?: ArchivePopupTitle;
|
|
62
|
-
/** The row's hover images, shown in turn while it is hovered; a row saved before there could be several holds just one. */
|
|
63
65
|
image?: ArchivePopupMedia | ArchivePopupMedia[];
|
|
66
|
+
/** The whole row links here. */
|
|
67
|
+
link?: ContentLink;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
type FontSettings = { fontWeight: number; fontStyle: string };
|
|
@@ -184,7 +188,7 @@ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' |
|
|
|
184
188
|
& Partial<Record<ArchivePopupColumnWidthKey, number>>;
|
|
185
189
|
|
|
186
190
|
function getColumnCount(columns: number | undefined): number {
|
|
187
|
-
return Math.min(Math.max(Math.round(columns ??
|
|
191
|
+
return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_DEFAULT_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
/** The width a row's columns share: the panel's, less its padding and the gaps between them. */
|
|
@@ -253,6 +257,17 @@ export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefine
|
|
|
253
257
|
return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
|
|
254
258
|
}
|
|
255
259
|
|
|
260
|
+
// A title saved as rich text shows its words alone, a line to each paragraph, its links and styling dropped.
|
|
261
|
+
function getTitleText(title: ArchivePopupTitle | undefined): string {
|
|
262
|
+
if (!Array.isArray(title)) return title ?? '';
|
|
263
|
+
const getNodeText = (node: any): string => node.text ?? (node.children ?? []).map(getNodeText).join('');
|
|
264
|
+
return title.map(getNodeText).join('\\n');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
|
|
268
|
+
return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
|
|
269
|
+
}
|
|
270
|
+
|
|
256
271
|
function isVideoMedia(media: ArchivePopupMedia): boolean {
|
|
257
272
|
if (media.type === 'video') return true;
|
|
258
273
|
if (media.type === 'image') return false;
|
|
@@ -399,14 +414,26 @@ function getCSS(P: string): string {
|
|
|
399
414
|
height: 100%;
|
|
400
415
|
object-fit: cover;
|
|
401
416
|
opacity: 0;
|
|
402
|
-
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
403
417
|
}
|
|
404
418
|
.\${P}-media-contain {
|
|
405
419
|
object-fit: contain;
|
|
406
420
|
}
|
|
421
|
+
/* The image replaced stays whole under the next until that is in, then goes at once, so neither the page nor an older
|
|
422
|
+
image shows between them; only the image coming in and, as the list is left, those on screen fade. */
|
|
423
|
+
.\${P}-media-visible,
|
|
424
|
+
.\${P}-media-fading {
|
|
425
|
+
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
426
|
+
}
|
|
407
427
|
.\${P}-media-visible {
|
|
428
|
+
z-index: 1;
|
|
429
|
+
opacity: 1;
|
|
430
|
+
}
|
|
431
|
+
.\${P}-media-covered {
|
|
408
432
|
opacity: 1;
|
|
409
433
|
}
|
|
434
|
+
.\${P}-media-fading {
|
|
435
|
+
opacity: 0;
|
|
436
|
+
}
|
|
410
437
|
.\${P}-close {
|
|
411
438
|
position: absolute;
|
|
412
439
|
z-index: 2;
|
|
@@ -447,9 +474,6 @@ function getCSS(P: string): string {
|
|
|
447
474
|
position: absolute;
|
|
448
475
|
pointer-events: none;
|
|
449
476
|
}
|
|
450
|
-
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
451
|
-
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
452
|
-
}
|
|
453
477
|
@media (prefers-reduced-motion: reduce) {
|
|
454
478
|
.\${P}-panel {
|
|
455
479
|
transition: none;
|
|
@@ -469,6 +493,13 @@ function getCSS(P: string): string {
|
|
|
469
493
|
grid-template-columns: subgrid;
|
|
470
494
|
align-items: baseline;
|
|
471
495
|
}
|
|
496
|
+
a.\${P}-row {
|
|
497
|
+
color: inherit;
|
|
498
|
+
text-decoration: none;
|
|
499
|
+
}
|
|
500
|
+
.\${P}-group-unlabeled .\${P}-row {
|
|
501
|
+
grid-column: 1 / -1;
|
|
502
|
+
}
|
|
472
503
|
.\${P}-group-label {
|
|
473
504
|
grid-column: 1;
|
|
474
505
|
align-self: start;
|
|
@@ -478,6 +509,7 @@ function getCSS(P: string): string {
|
|
|
478
509
|
.\${P}-title {
|
|
479
510
|
min-width: 0;
|
|
480
511
|
overflow-wrap: anywhere;
|
|
512
|
+
white-space: pre-line;
|
|
481
513
|
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
482
514
|
}
|
|
483
515
|
.\${P}-control-anchor {
|
|
@@ -485,12 +517,10 @@ function getCSS(P: string): string {
|
|
|
485
517
|
pointer-events: none;
|
|
486
518
|
z-index: 2;
|
|
487
519
|
}
|
|
488
|
-
.\${P}-title a {
|
|
489
|
-
text-decoration: inherit;
|
|
490
|
-
}
|
|
491
520
|
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
492
|
-
.\${P}-row:focus-
|
|
493
|
-
.\${P}-
|
|
521
|
+
.\${P}-row:focus-visible .\${P}-title,
|
|
522
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title,
|
|
523
|
+
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
494
524
|
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
495
525
|
}
|
|
496
526
|
\`;
|
|
@@ -500,18 +530,27 @@ function ArchivePopupMediaItem({
|
|
|
500
530
|
P,
|
|
501
531
|
media,
|
|
502
532
|
isVisible,
|
|
533
|
+
isLoaded,
|
|
534
|
+
isCovered,
|
|
535
|
+
isFading,
|
|
536
|
+
onLoad,
|
|
503
537
|
}: {
|
|
504
538
|
P: string;
|
|
505
539
|
media: ArchivePopupMedia;
|
|
506
540
|
isVisible: boolean;
|
|
541
|
+
isLoaded: boolean;
|
|
542
|
+
isCovered: boolean;
|
|
543
|
+
isFading: boolean;
|
|
544
|
+
onLoad: () => void;
|
|
507
545
|
}) {
|
|
508
546
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
509
|
-
const [isLoaded, setIsLoaded] = useState(false);
|
|
510
547
|
const isVideo = isVideoMedia(media);
|
|
511
548
|
const className = cn(
|
|
512
549
|
\`\${P}-media\`,
|
|
513
550
|
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
514
551
|
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
552
|
+
isCovered && \`\${P}-media-covered\`,
|
|
553
|
+
isFading && \`\${P}-media-fading\`,
|
|
515
554
|
);
|
|
516
555
|
|
|
517
556
|
useEffect(() => {
|
|
@@ -534,7 +573,7 @@ function ArchivePopupMediaItem({
|
|
|
534
573
|
loop
|
|
535
574
|
playsInline
|
|
536
575
|
preload="auto"
|
|
537
|
-
onLoadedData={
|
|
576
|
+
onLoadedData={onLoad}
|
|
538
577
|
/>
|
|
539
578
|
);
|
|
540
579
|
}
|
|
@@ -545,7 +584,7 @@ function ArchivePopupMediaItem({
|
|
|
545
584
|
src={media.assetId}
|
|
546
585
|
alt=""
|
|
547
586
|
decoding="async"
|
|
548
|
-
onLoad={
|
|
587
|
+
onLoad={onLoad}
|
|
549
588
|
/>
|
|
550
589
|
);
|
|
551
590
|
}
|
|
@@ -644,7 +683,7 @@ export function ArchivePopup({
|
|
|
644
683
|
type = 'b',
|
|
645
684
|
triggerLabel = 'Archive',
|
|
646
685
|
closeLabel = 'Close',
|
|
647
|
-
columns =
|
|
686
|
+
columns = ARCHIVE_POPUP_DEFAULT_COLUMNS,
|
|
648
687
|
columnGap = DEFAULT_COLUMN_GAP,
|
|
649
688
|
hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
|
|
650
689
|
panelPosition,
|
|
@@ -676,6 +715,11 @@ export function ArchivePopup({
|
|
|
676
715
|
// Which of the hovered row's images shows, counted afresh on every hover.
|
|
677
716
|
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
678
717
|
const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
|
|
718
|
+
// The image just replaced, kept whole under the next while it fades in, and the last one shown, to fade out on leave.
|
|
719
|
+
const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
|
|
720
|
+
const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
|
|
721
|
+
const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
|
|
722
|
+
const shownMediaRef = useRef<string | null>(null);
|
|
679
723
|
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
680
724
|
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
681
725
|
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
@@ -690,12 +734,18 @@ export function ArchivePopup({
|
|
|
690
734
|
const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
|
|
691
735
|
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
692
736
|
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
693
|
-
const groups = useMemo(() => groupArchiveRows(content ?? []), [content]);
|
|
694
737
|
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
|
|
695
738
|
const columnCount = getColumnCount(columns);
|
|
696
739
|
const columnWidths = resolveArchivePopupColumnWidths(settings);
|
|
697
740
|
// the group takes the first column, the titles the rest
|
|
698
741
|
const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
|
|
742
|
+
// With the first column alone there is nothing for a group to span, so every row shows its own first column, as one list.
|
|
743
|
+
const hasGroupColumn = columnCount > 1;
|
|
744
|
+
const groups = useMemo<ArchivePopupGroup[]>(() => (
|
|
745
|
+
hasGroupColumn
|
|
746
|
+
? groupArchiveRows(content ?? [])
|
|
747
|
+
: [{ label: '', rows: (content ?? []).map((item, index) => ({ item, index })) }]
|
|
748
|
+
), [content, hasGroupColumn]);
|
|
699
749
|
|
|
700
750
|
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
701
751
|
|
|
@@ -822,6 +872,26 @@ export function ArchivePopup({
|
|
|
822
872
|
return () => window.clearInterval(timer);
|
|
823
873
|
}, [activeIndex, activeRowMediaCount, hoverInterval]);
|
|
824
874
|
|
|
875
|
+
// Before paint, or the replaced image would drop out for a frame before it is kept.
|
|
876
|
+
const shownAssetId = activeIndex === null ? undefined : getArchivePopupRowMedia(items[activeIndex])[activeMediaIndex]?.assetId;
|
|
877
|
+
const shownMedia = activeIndex !== null && shownAssetId !== undefined ? getMediaKey(activeIndex, activeMediaIndex, shownAssetId) : null;
|
|
878
|
+
const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
|
|
879
|
+
useLayoutEffect(() => {
|
|
880
|
+
const previous = shownMediaRef.current;
|
|
881
|
+
shownMediaRef.current = shownMedia;
|
|
882
|
+
// Leaving keeps both, to fade out together: the one under the last is still on screen while the last fades in.
|
|
883
|
+
if (shownMedia === null) return;
|
|
884
|
+
setLastShownMedia(shownMedia);
|
|
885
|
+
setCoveredMedia(previous);
|
|
886
|
+
}, [shownMedia]);
|
|
887
|
+
|
|
888
|
+
// The replaced image goes once the next has loaded and faded in over it, however long the load takes.
|
|
889
|
+
useEffect(() => {
|
|
890
|
+
if (!isShownMediaLoaded || coveredMedia === null) return;
|
|
891
|
+
const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
|
|
892
|
+
return () => window.clearTimeout(timer);
|
|
893
|
+
}, [isShownMediaLoaded, coveredMedia]);
|
|
894
|
+
|
|
825
895
|
const showRowMedia = (index: number) => {
|
|
826
896
|
if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
|
|
827
897
|
setActiveIndex(null);
|
|
@@ -839,7 +909,7 @@ export function ArchivePopup({
|
|
|
839
909
|
setActiveIndex((current) => (current === index ? null : current));
|
|
840
910
|
};
|
|
841
911
|
|
|
842
|
-
//
|
|
912
|
+
// Row links only navigate on a live page or in preview, not on the editor canvas.
|
|
843
913
|
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
844
914
|
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
845
915
|
event.preventDefault();
|
|
@@ -873,14 +943,21 @@ export function ArchivePopup({
|
|
|
873
943
|
|
|
874
944
|
const mediaLayer = (
|
|
875
945
|
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
876
|
-
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) =>
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
946
|
+
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) => {
|
|
947
|
+
const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
|
|
948
|
+
return (
|
|
949
|
+
<ArchivePopupMediaItem
|
|
950
|
+
key={mediaKey}
|
|
951
|
+
P={P}
|
|
952
|
+
media={media}
|
|
953
|
+
isVisible={mediaKey === shownMedia}
|
|
954
|
+
isLoaded={loadedMedia.has(mediaKey)}
|
|
955
|
+
isCovered={mediaKey === coveredMedia}
|
|
956
|
+
isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
|
|
957
|
+
onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
|
|
958
|
+
/>
|
|
959
|
+
);
|
|
960
|
+
}))}
|
|
884
961
|
</div>
|
|
885
962
|
);
|
|
886
963
|
// Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
|
|
@@ -933,34 +1010,45 @@ export function ArchivePopup({
|
|
|
933
1010
|
)}
|
|
934
1011
|
{/* The label spans its group's rows, so its line height spaces only its own lines, never the rows beside it;
|
|
935
1012
|
a label longer than its rows grows the last track, below them. */}
|
|
936
|
-
<div
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
<div
|
|
945
|
-
key={index}
|
|
946
|
-
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
947
|
-
{...(isCopy ? {} : {
|
|
948
|
-
onMouseEnter: () => showRowMedia(index),
|
|
949
|
-
onMouseLeave: () => hideRowMedia(index),
|
|
950
|
-
onFocus: () => showRowMedia(index),
|
|
951
|
-
onBlur: () => hideRowMedia(index),
|
|
952
|
-
})}
|
|
1013
|
+
<div
|
|
1014
|
+
className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
|
|
1015
|
+
style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
|
|
1016
|
+
>
|
|
1017
|
+
{hasGroupColumn && (
|
|
1018
|
+
<span
|
|
1019
|
+
className={\`\${P}-group-label\`}
|
|
1020
|
+
style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
|
|
953
1021
|
>
|
|
954
|
-
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1022
|
+
{group.label}
|
|
1023
|
+
</span>
|
|
1024
|
+
)}
|
|
1025
|
+
{group.rows.map(({ item, index }) => {
|
|
1026
|
+
const rowLink = !isCopy && item.link?.value ? item.link : undefined;
|
|
1027
|
+
const RowElement = rowLink ? 'a' : 'div';
|
|
1028
|
+
return (
|
|
1029
|
+
<RowElement
|
|
1030
|
+
key={index}
|
|
1031
|
+
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
1032
|
+
{...(rowLink ? {
|
|
1033
|
+
href: buildValidUrl(rowLink.value),
|
|
1034
|
+
...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
|
|
1035
|
+
} : {})}
|
|
1036
|
+
{...(isCopy ? {} : {
|
|
1037
|
+
onMouseEnter: () => showRowMedia(index),
|
|
1038
|
+
onMouseLeave: () => hideRowMedia(index),
|
|
1039
|
+
onFocus: () => showRowMedia(index),
|
|
1040
|
+
onBlur: () => hideRowMedia(index),
|
|
1041
|
+
})}
|
|
1042
|
+
>
|
|
1043
|
+
{!hasGroupColumn && (
|
|
1044
|
+
<div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
|
|
1045
|
+
)}
|
|
1046
|
+
{titleKeys.map((key, titleIndex) => (
|
|
1047
|
+
<div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{getTitleText(item[key])}</div>
|
|
1048
|
+
))}
|
|
1049
|
+
</RowElement>
|
|
1050
|
+
);
|
|
1051
|
+
})}
|
|
964
1052
|
</div>
|
|
965
1053
|
</Fragment>
|
|
966
1054
|
))}
|