@cntrl-site/components 1.0.107-alpha.1 → 1.0.107-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ArchivePopup-CjWbiDk6.mjs +711 -0
- package/dist/ArchivePopup-CwhC3gmz.js +180 -0
- package/dist/{ArchivePopupComponent-BTniPIfi.js → ArchivePopupComponent-BWG23JpA.js} +1 -1
- package/dist/{ArchivePopupComponent-GgAT2Avz.mjs → ArchivePopupComponent-HsEAy1CM.mjs} +20 -12
- package/dist/Components/ArchivePopup/ArchivePopup.d.ts +8 -4
- package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +13 -3
- package/dist/{components-SEwSqFrQ.js → components-DR32MT02.js} +1 -1
- package/dist/{components-DKuQ8PUa.mjs → components-UlM4o-To.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +1 -1
- 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 +50 -24
- package/dist/sources.mjs +53 -27
- package/package.json +1 -1
- package/dist/ArchivePopup-DMpGP8r2.js +0 -176
- package/dist/ArchivePopup-X4EtTAyA.mjs +0 -694
package/dist/sources.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-HsEAy1CM.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';
|
|
@@ -26,7 +26,7 @@ export const ARCHIVE_POPUP_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width',
|
|
|
26
26
|
type ArchivePopupColumnWidthKey = typeof ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[number];
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Where
|
|
29
|
+
* Where B's panel sits on the screen, as \`left\`/\`top\` of the screen and of the panel alike, so 0% is flush with
|
|
30
30
|
* one edge and 100% with the other. Named like Mercury's title position; center comes first because the editor
|
|
31
31
|
* puts the first value into a popup saved before there was a position, and those were centred.
|
|
32
32
|
*/
|
|
@@ -60,7 +60,8 @@ export type ArchivePopupContentItem = {
|
|
|
60
60
|
title2?: ArchivePopupTitle;
|
|
61
61
|
title3?: ArchivePopupTitle;
|
|
62
62
|
title4?: ArchivePopupTitle;
|
|
63
|
-
|
|
63
|
+
/** The row's hover images, shown in turn while it is hovered; a row saved before there could be several holds just one. */
|
|
64
|
+
image?: ArchivePopupMedia | ArchivePopupMedia[];
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
type FontSettings = { fontWeight: number; fontStyle: string };
|
|
@@ -88,7 +89,7 @@ type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
|
|
|
88
89
|
// One style every column shared before each had its own; a column with no style of its own still shows it.
|
|
89
90
|
& PrefixedTextStyle<'list'>
|
|
90
91
|
& {
|
|
91
|
-
/** \`a\`
|
|
92
|
+
/** \`a\` is always open, in place on the page; \`b\` opens from a label. */
|
|
92
93
|
type?: 'a' | 'b';
|
|
93
94
|
triggerLabel?: string;
|
|
94
95
|
closeLabel?: string;
|
|
@@ -99,7 +100,9 @@ type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
|
|
|
99
100
|
column2Width?: number;
|
|
100
101
|
column3Width?: number;
|
|
101
102
|
column4Width?: number;
|
|
102
|
-
/**
|
|
103
|
+
/** How long each of a hovered row's images shows before the next, in ms. */
|
|
104
|
+
hoverInterval?: number;
|
|
105
|
+
/** B only: A's panel stays where it is placed on the page. */
|
|
103
106
|
panelPosition?: string;
|
|
104
107
|
panelWidth?: number;
|
|
105
108
|
panelPadding?: Padding;
|
|
@@ -168,6 +171,7 @@ const DEFAULT_COLUMN_GAP = 0.0139;
|
|
|
168
171
|
const DEFAULT_PANEL_WIDTH = 0.3194;
|
|
169
172
|
const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
|
|
170
173
|
const IMAGE_FADE_MS = 800;
|
|
174
|
+
const DEFAULT_HOVER_INTERVAL_MS = 1000;
|
|
171
175
|
|
|
172
176
|
const LIGHTBOX_CSS_VARS = [
|
|
173
177
|
'--cntrl-article-width',
|
|
@@ -245,6 +249,11 @@ export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopup
|
|
|
245
249
|
return groups;
|
|
246
250
|
}
|
|
247
251
|
|
|
252
|
+
export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefined): ArchivePopupMedia[] {
|
|
253
|
+
const { image } = item ?? {};
|
|
254
|
+
return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
|
|
255
|
+
}
|
|
256
|
+
|
|
248
257
|
function isVideoMedia(media: ArchivePopupMedia): boolean {
|
|
249
258
|
if (media.type === 'video') return true;
|
|
250
259
|
if (media.type === 'image') return false;
|
|
@@ -316,6 +325,10 @@ function getCSS(P: string): string {
|
|
|
316
325
|
}
|
|
317
326
|
.\${P}-trigger {
|
|
318
327
|
color: var(--\${P}-trigger-color);
|
|
328
|
+
transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
329
|
+
}
|
|
330
|
+
.\${P}-trigger-hidden {
|
|
331
|
+
opacity: 0;
|
|
319
332
|
}
|
|
320
333
|
.\${P}-close {
|
|
321
334
|
color: var(--\${P}-close-color);
|
|
@@ -622,11 +635,12 @@ export function ArchivePopup({
|
|
|
622
635
|
}: ArchivePopupProps) {
|
|
623
636
|
const { prefix: P } = useScopedStyles();
|
|
624
637
|
const {
|
|
625
|
-
type = '
|
|
638
|
+
type = 'b',
|
|
626
639
|
triggerLabel = 'Archive',
|
|
627
640
|
closeLabel = 'Close',
|
|
628
641
|
columns = ARCHIVE_POPUP_MIN_COLUMNS,
|
|
629
642
|
columnGap = DEFAULT_COLUMN_GAP,
|
|
643
|
+
hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
|
|
630
644
|
panelPosition,
|
|
631
645
|
panelWidth = DEFAULT_PANEL_WIDTH,
|
|
632
646
|
panelPadding = DEFAULT_PANEL_PADDING,
|
|
@@ -653,6 +667,8 @@ export function ArchivePopup({
|
|
|
653
667
|
const [isOverlayActive, setIsOverlayActive] = useState(false);
|
|
654
668
|
const [isOverlaySettled, setIsOverlaySettled] = useState(false);
|
|
655
669
|
const [activeIndex, setActiveIndex] = useState<number | null>(null);
|
|
670
|
+
// Which of the hovered row's images shows, counted afresh on every hover.
|
|
671
|
+
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
656
672
|
const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
|
|
657
673
|
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
658
674
|
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
@@ -661,8 +677,8 @@ export function ArchivePopup({
|
|
|
661
677
|
|
|
662
678
|
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
663
679
|
const isInteractive = !isEditor || Boolean(isPreviewMode);
|
|
664
|
-
//
|
|
665
|
-
const isInline = type === '
|
|
680
|
+
// A has no popup to open: its panel is always shown in place of the label.
|
|
681
|
+
const isInline = type === 'a';
|
|
666
682
|
const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
|
|
667
683
|
// Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
|
|
668
684
|
const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
|
|
@@ -738,7 +754,7 @@ export function ArchivePopup({
|
|
|
738
754
|
return () => document.removeEventListener('keydown', onKeyDown);
|
|
739
755
|
}, [isOpen, isInteractive]);
|
|
740
756
|
|
|
741
|
-
//
|
|
757
|
+
// A's media fills the screen above the page, so a copy of the panel is laid exactly over the real one to stay readable.
|
|
742
758
|
useLayoutEffect(() => {
|
|
743
759
|
if (!isInline || activeIndex === null) return;
|
|
744
760
|
const panelEl = panelRef.current;
|
|
@@ -780,13 +796,25 @@ export function ArchivePopup({
|
|
|
780
796
|
triggerRef.current?.focus({ preventScroll: true });
|
|
781
797
|
};
|
|
782
798
|
|
|
799
|
+
// A hovered row with several images shows them in turn, round and round, for as long as it stays hovered.
|
|
800
|
+
const activeRowMediaCount = activeIndex === null ? 0 : getArchivePopupRowMedia(items[activeIndex]).length;
|
|
801
|
+
useEffect(() => {
|
|
802
|
+
if (activeRowMediaCount < 2) return;
|
|
803
|
+
const timer = window.setInterval(() => {
|
|
804
|
+
setActiveMediaIndex((current) => (current + 1) % activeRowMediaCount);
|
|
805
|
+
}, Math.max(100, hoverInterval));
|
|
806
|
+
return () => window.clearInterval(timer);
|
|
807
|
+
}, [activeIndex, activeRowMediaCount, hoverInterval]);
|
|
808
|
+
|
|
783
809
|
const showRowMedia = (index: number) => {
|
|
784
|
-
if (!isInteractive ||
|
|
810
|
+
if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
|
|
785
811
|
setActiveIndex(null);
|
|
786
812
|
return;
|
|
787
813
|
}
|
|
814
|
+
// A row's images all load on its first hover, so the next is ready by the time it shows.
|
|
788
815
|
setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
|
|
789
816
|
if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
|
|
817
|
+
if (activeIndex !== index) setActiveMediaIndex(0);
|
|
790
818
|
setIsMediaCut(false);
|
|
791
819
|
setActiveIndex(index);
|
|
792
820
|
};
|
|
@@ -822,18 +850,14 @@ export function ArchivePopup({
|
|
|
822
850
|
|
|
823
851
|
const mediaLayer = (
|
|
824
852
|
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
825
|
-
{[...mountedMedia].
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
isVisible={activeIndex === index}
|
|
834
|
-
/>
|
|
835
|
-
);
|
|
836
|
-
})}
|
|
853
|
+
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) => (
|
|
854
|
+
<ArchivePopupMediaItem
|
|
855
|
+
key={\`\${index}-\${mediaIndex}-\${media.assetId}\`}
|
|
856
|
+
P={P}
|
|
857
|
+
media={media}
|
|
858
|
+
isVisible={activeIndex === index && activeMediaIndex === mediaIndex}
|
|
859
|
+
/>
|
|
860
|
+
)))}
|
|
837
861
|
</div>
|
|
838
862
|
);
|
|
839
863
|
// Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
|
|
@@ -975,10 +999,12 @@ export function ArchivePopup({
|
|
|
975
999
|
style={colorVars}
|
|
976
1000
|
>
|
|
977
1001
|
{isInline ? renderPanel(false) : (
|
|
1002
|
+
// The overlay lets the page show through, so the label fades out with it rather than sit under the close.
|
|
1003
|
+
// Only faded, it keeps the component's size and can still take focus back on close.
|
|
978
1004
|
<button
|
|
979
1005
|
ref={triggerRef}
|
|
980
1006
|
type="button"
|
|
981
|
-
className={\`\${P}-trigger\`}
|
|
1007
|
+
className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
|
|
982
1008
|
style={triggerTypographyCss}
|
|
983
1009
|
aria-haspopup="dialog"
|
|
984
1010
|
aria-expanded={isOpen}
|
|
@@ -997,7 +1023,7 @@ export function ArchivePopup({
|
|
|
997
1023
|
</>
|
|
998
1024
|
);
|
|
999
1025
|
}
|
|
1000
|
-
`,
|
|
1026
|
+
`, w = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
1001
1027
|
import { CommonComponentProps } from '../props';
|
|
1002
1028
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
1003
1029
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -3638,7 +3664,7 @@ export function Burger({
|
|
|
3638
3664
|
</div>
|
|
3639
3665
|
);
|
|
3640
3666
|
}
|
|
3641
|
-
`,
|
|
3667
|
+
`, C = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3642
3668
|
import { CommonComponentProps } from '../props';
|
|
3643
3669
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3644
3670
|
|
|
@@ -25051,8 +25077,8 @@ export function Waterfall({
|
|
|
25051
25077
|
}
|
|
25052
25078
|
`, U = {
|
|
25053
25079
|
[y.id]: S,
|
|
25054
|
-
[b.id]:
|
|
25055
|
-
[x.id]:
|
|
25080
|
+
[b.id]: w,
|
|
25081
|
+
[x.id]: C,
|
|
25056
25082
|
[P.id]: $,
|
|
25057
25083
|
[v.id]: I,
|
|
25058
25084
|
[f.id]: T,
|
package/package.json
CHANGED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("react"),ct=require("react-dom"),w=require("classnames"),ut=require("./scalingValue-CSHYgTZl.js"),dt=require("./buildColorVars-CE2D5cQV.js"),pt=require("./useScopedStyles-Bf6yohVQ.js"),mt=require("./RichTextRenderer-K90Dd7pt.js"),T=require("./textStylesToCss-CNN3zZTV.js"),ft=require("./useLightboxScrollLock-Hf16Eq4g.js"),M=2,_e=5,Ee=["title2","title3","title4"],R=["column1Width","column2Width","column3Width","column4Width"],X={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%"}},vt=Object.keys(X),Le=["column1","column2","column3","column4","column5"],ht={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"},gt=["hover","open"],j=300,Ae=.004,we=.004,yt=20,Re=.0139,Ie=.3194,Oe={top:.00972,right:.00972,bottom:.00972,left:.00972},Ne=800,$t=["--cntrl-article-width","--cntrl-article-top","--cntrl-article-left","--cntrl-viewport-height"];function F(e){return Math.min(Math.max(Math.round(e??M),M),_e)}function Te(e){const{panelWidth:o=Ie,panelPadding:n=Oe,columnGap:s=Re}=e,l=(F(e.columns)-1)*s;return Math.max(0,o-n.left-n.right-l)}function Me(e){const o=F(e.columns),n=Te(e)/o;return Object.fromEntries(R.slice(0,o-1).map(s=>[s,n]))}function je(e){const o=F(e.columns),n=Te(e),s=R.slice(0,o-1).map(f=>{const m=e[f];return typeof m=="number"?Math.max(0,m):n/o}),l=s.reduce((f,m)=>f+m,0),c=l>n?n/l:1;return[...s.map(f=>f*c),Math.max(0,n-l*c)]}function xt(e,o){return typeof e.columns!="number"||e.columns===o.columns?e:{...e,...Me({...o,...e})}}function Ct(e){const o=e.reduce((n,s)=>n+s,0);return e.map(n=>`minmax(0, ${o>0?n/o*100:1}fr)`).join(" ")}function Fe(e){const o=[];return e.forEach((n,s)=>{var p;const l=((p=n.group)==null?void 0:p.trim())??"",c=o[o.length-1];if(!c||l!==""&&l!==c.label){o.push({label:l,rows:[{item:n,index:s}]});return}c.rows.push({item:n,index:s})}),o}function wt(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 bt(e){let o=e;for(;o;){if(getComputedStyle(o).getPropertyValue("--cntrl-article-width").trim())return o;o=o.parentElement}return e}function be(e){const o={},n=bt(e);if(!n)return o;const s=getComputedStyle(n);for(const l of $t){const c=s.getPropertyValue(l).trim();c&&(o[l]=c)}return o}function Se(e,o,n){const s=e,l=p=>s[`${o}${p}`]??(n?s[`${n}${p}`]:void 0),c=l("FontSettings");return{fontSettings:{fontFamily:l("FontFamily"),fontWeight:(c==null?void 0:c.fontWeight)??400,fontStyle:(c==null?void 0:c.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 St(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
|
-
}
|
|
19
|
-
.${e}-close {
|
|
20
|
-
color: var(--${e}-close-color);
|
|
21
|
-
}
|
|
22
|
-
.${e}-trigger:focus,
|
|
23
|
-
.${e}-close:focus {
|
|
24
|
-
outline: none;
|
|
25
|
-
}
|
|
26
|
-
.${e}-trigger:focus-visible,
|
|
27
|
-
.${e}-close:focus-visible {
|
|
28
|
-
outline: 1px solid currentColor;
|
|
29
|
-
outline-offset: 2px;
|
|
30
|
-
}
|
|
31
|
-
.${e}-interactive .${e}-trigger:hover,
|
|
32
|
-
.${e}-state-hover .${e}-trigger {
|
|
33
|
-
color: var(--${e}-trigger-hover-color, var(--${e}-trigger-color));
|
|
34
|
-
}
|
|
35
|
-
.${e}-close:hover {
|
|
36
|
-
color: var(--${e}-close-hover-color, var(--${e}-close-color));
|
|
37
|
-
}
|
|
38
|
-
.${e}-editor .${e}-trigger {
|
|
39
|
-
cursor: default;
|
|
40
|
-
}
|
|
41
|
-
.${e}-overlay {
|
|
42
|
-
position: fixed;
|
|
43
|
-
inset: 0;
|
|
44
|
-
z-index: 9997;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
overscroll-behavior: none;
|
|
47
|
-
opacity: 0;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
transition: opacity ${j}ms ease;
|
|
50
|
-
}
|
|
51
|
-
.${e}-inline-layer {
|
|
52
|
-
position: fixed;
|
|
53
|
-
inset: 0;
|
|
54
|
-
z-index: 9997;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
pointer-events: none;
|
|
57
|
-
}
|
|
58
|
-
.${e}-overlay-editor {
|
|
59
|
-
inset: auto;
|
|
60
|
-
top: var(--cntrl-article-top, 0);
|
|
61
|
-
left: var(--cntrl-article-left, 0);
|
|
62
|
-
width: var(--cntrl-article-width, 100vw) !important;
|
|
63
|
-
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
64
|
-
}
|
|
65
|
-
.${e}-overlay-edit-mode {
|
|
66
|
-
z-index: 1;
|
|
67
|
-
}
|
|
68
|
-
.${e}-overlay-active {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
pointer-events: auto;
|
|
71
|
-
}
|
|
72
|
-
.${e}-backdrop {
|
|
73
|
-
position: absolute;
|
|
74
|
-
inset: 0;
|
|
75
|
-
background-color: var(--${e}-overlay-color);
|
|
76
|
-
}
|
|
77
|
-
.${e}-media-layer {
|
|
78
|
-
position: absolute;
|
|
79
|
-
inset: 0;
|
|
80
|
-
pointer-events: none;
|
|
81
|
-
}
|
|
82
|
-
.${e}-media {
|
|
83
|
-
position: absolute;
|
|
84
|
-
inset: 0;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 100%;
|
|
87
|
-
object-fit: cover;
|
|
88
|
-
opacity: 0;
|
|
89
|
-
transition: opacity ${Ne}ms cubic-bezier(0, 0, 0.58, 1);
|
|
90
|
-
}
|
|
91
|
-
.${e}-media-contain {
|
|
92
|
-
object-fit: contain;
|
|
93
|
-
}
|
|
94
|
-
.${e}-media-visible {
|
|
95
|
-
opacity: 1;
|
|
96
|
-
}
|
|
97
|
-
.${e}-close {
|
|
98
|
-
position: absolute;
|
|
99
|
-
z-index: 2;
|
|
100
|
-
}
|
|
101
|
-
.${e}-panel {
|
|
102
|
-
position: absolute;
|
|
103
|
-
top: var(--${e}-panel-y);
|
|
104
|
-
left: var(--${e}-panel-x);
|
|
105
|
-
z-index: 1;
|
|
106
|
-
box-sizing: border-box;
|
|
107
|
-
max-width: 100%;
|
|
108
|
-
max-height: 100%;
|
|
109
|
-
overflow-y: auto;
|
|
110
|
-
transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y) + 12px));
|
|
111
|
-
background-color: var(--${e}-panel-color);
|
|
112
|
-
color: var(--${e}-text-color);
|
|
113
|
-
overscroll-behavior: contain;
|
|
114
|
-
transition: transform ${j}ms cubic-bezier(0, 0, 0.58, 1);
|
|
115
|
-
}
|
|
116
|
-
.${e}-overlay-active .${e}-panel {
|
|
117
|
-
transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y)));
|
|
118
|
-
}
|
|
119
|
-
.${e}-panel-settled {
|
|
120
|
-
transition: none;
|
|
121
|
-
}
|
|
122
|
-
.${e}-panel-inline {
|
|
123
|
-
position: relative;
|
|
124
|
-
top: auto;
|
|
125
|
-
left: auto;
|
|
126
|
-
max-height: none;
|
|
127
|
-
transform: none;
|
|
128
|
-
transition: none;
|
|
129
|
-
}
|
|
130
|
-
.${e}-media-layer-instant .${e}-media {
|
|
131
|
-
transition: none;
|
|
132
|
-
}
|
|
133
|
-
.${e}-panel-copy {
|
|
134
|
-
position: absolute;
|
|
135
|
-
pointer-events: none;
|
|
136
|
-
}
|
|
137
|
-
.${e}-panel-copy .${e}-row-active .${e}-title {
|
|
138
|
-
color: var(--${e}-text-hover-color, var(--${e}-text-color));
|
|
139
|
-
}
|
|
140
|
-
@media (prefers-reduced-motion: reduce) {
|
|
141
|
-
.${e}-panel {
|
|
142
|
-
transition: none;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
.${e}-group ~ .${e}-group {
|
|
146
|
-
margin-top: var(--${e}-group-gap);
|
|
147
|
-
}
|
|
148
|
-
.${e}-row {
|
|
149
|
-
display: grid;
|
|
150
|
-
grid-template-columns: var(--${e}-grid-columns);
|
|
151
|
-
column-gap: var(--${e}-column-gap);
|
|
152
|
-
align-items: baseline;
|
|
153
|
-
}
|
|
154
|
-
.${e}-group-label {
|
|
155
|
-
min-width: 0;
|
|
156
|
-
overflow-wrap: anywhere;
|
|
157
|
-
}
|
|
158
|
-
.${e}-title {
|
|
159
|
-
min-width: 0;
|
|
160
|
-
overflow-wrap: anywhere;
|
|
161
|
-
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
162
|
-
}
|
|
163
|
-
.${e}-control-anchor {
|
|
164
|
-
position: absolute;
|
|
165
|
-
pointer-events: none;
|
|
166
|
-
z-index: 2;
|
|
167
|
-
}
|
|
168
|
-
.${e}-title a {
|
|
169
|
-
text-decoration: inherit;
|
|
170
|
-
}
|
|
171
|
-
.${e}-interactive .${e}-row:hover .${e}-title,
|
|
172
|
-
.${e}-row:focus-within .${e}-title,
|
|
173
|
-
.${e}-state-hover .${e}-row:first-child .${e}-title {
|
|
174
|
-
color: var(--${e}-text-hover-color, var(--${e}-text-color));
|
|
175
|
-
}
|
|
176
|
-
`}function _t({P:e,media:o,isVisible:n}){const s=a.useRef(null),[l,c]=a.useState(!1),p=wt(o),f=w(`${e}-media`,o.objectFit==="contain"&&`${e}-media-contain`,n&&l&&`${e}-media-visible`);return a.useEffect(()=>{var r;const m=s.current;!p||!m||(n?(r=m.play())==null||r.catch(()=>{}):m.pause())},[p,n]),p?i.jsx("video",{ref:s,className:f,src:o.assetId,muted:!0,loop:!0,playsInline:!0,preload:"auto",onLoadedData:()=>c(!0)}):i.jsx("img",{className:f,src:o.assetId,alt:"",decoding:"async",onLoad:()=>c(!0)})}function Et(e,o,n,s,l){const c=o[o.length-1];let p=n;return o.slice(0,-1).map((f,m)=>{const r=p+f+s/2;return p+=f+s,i.jsx("div",{"data-controls":R[m],"data-controls-axis":"x","data-controls-variant":"column-width","data-controls-min":String(yt),"data-controls-max-fraction":String(f+c),className:`${e}-control-anchor`,style:{top:0,left:l(r-we/2),width:l(we),height:"100%"}},R[m])})}function Lt(e,o,n,s){const l=c=>s(Math.max(c,Ae));return i.jsxs(i.Fragment,{children:[i.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)}}),i.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)}}),i.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%"}}),i.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 At({settings:e,content:o,isEditor:n,isEditMode:s,isPreviewMode:l,activeEvent:c,portalId:p,currentState:f,unavailableStates:m}){const{prefix:r}=pt.useScopedStyles(),{type:He="a",triggerLabel:Y="Archive",closeLabel:Ue="Close",columns:Ve=M,columnGap:K=Re,panelPosition:ze,panelWidth:Z=Ie,panelPadding:b=Oe,panelRadius:We=0,groupGap:J=.0139,triggerColor:Be="#000000",triggerHoverColor:De="#666666",closeColor:ke="#000000",closeHoverColor:qe="#666666",panelColor:Ge="#FFFFFF",textColor:Xe="#333132",textHoverColor:Ye="#BBBBBB",overlayColor:Ke="#FFFFFFE6"}=e,Q=o??[],H=a.useRef(null),U=a.useRef(null),V=a.useRef(null),P=a.useRef(null),ee=a.useRef(null),te=a.useRef(null),[Ze,I]=a.useState(!1),[L,oe]=a.useState(!1),[O,ne]=a.useState(!1),[re,le]=a.useState(!1),[x,S]=a.useState(null),[ae,Je]=a.useState(()=>new Set),[C,Qe]=a.useState(null),[se,ie]=a.useState({}),[_,z]=a.useState(null),[Pe,ce]=a.useState(!1),A=!!(n&&!l),y=!n||!!l,v=He==="b",et=A&&f==="open"&&!(m!=null&&m.includes("open")),$=!v&&(et||(y||!!s)&&Ze),h=t=>ut.scalingValue(t,n??!1),tt=a.useMemo(()=>St(r),[r]),ot=a.useMemo(()=>Fe(o??[]),[o]),ue=X[ze]??X.center,de=F(Ve),pe=je(e),nt=["title",...Ee].slice(0,de-1);ft.useLightboxScrollLock($&&!A),a.useEffect(()=>{A&&!s&&I(!1)},[A,s]),a.useEffect(()=>{if($){ie(be(H.current)),oe(!0);return}ne(!1),S(null);const t=window.setTimeout(()=>oe(!1),j);return()=>window.clearTimeout(t)},[$]),a.useEffect(()=>{var u;if(!$||!L)return;(u=V.current)==null||u.getBoundingClientRect();const t=requestAnimationFrame(()=>ne(!0));return()=>cancelAnimationFrame(t)},[$,L]),a.useEffect(()=>{if(!O){le(!1);return}const t=window.setTimeout(()=>le(!0),j);return()=>window.clearTimeout(t)},[O]);const N=a.useCallback(()=>{const t=U.current,u=V.current;if(!t||!u)return;const d=t.getBoundingClientRect(),g=u.getBoundingClientRect();Qe({top:d.top-g.top,left:d.left-g.left})},[]);a.useLayoutEffect(()=>{if(L)return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[L,N]),a.useEffect(()=>{var u;if(!$||!y)return;(u=P.current)==null||u.focus({preventScroll:!0});const t=d=>{d.key==="Escape"&&I(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[$,y]),a.useLayoutEffect(()=>{if(!v||x===null)return;const t=ee.current,u=te.current;if(!t||!u)return;const d=t.getBoundingClientRect(),g=u.getBoundingClientRect();z({top:d.top-g.top,left:d.left-g.left,width:d.width})},[v,x]),a.useEffect(()=>{if(x!==null)return;const t=window.setTimeout(()=>z(null),Ne);return()=>window.clearTimeout(t)},[x]);const me=_!==null;a.useEffect(()=>{if(!v||!me)return;const t=()=>{ce(!0),S(null),z(null)};return document.addEventListener("scroll",t,{capture:!0,passive:!0}),window.addEventListener("resize",t),()=>{document.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t)}},[v,me]);const fe=()=>{var t;y&&(I(!1),(t=U.current)==null||t.focus({preventScroll:!0}))},ve=t=>{var u,d;if(!y||!((d=(u=Q[t])==null?void 0:u.image)!=null&&d.assetId)){S(null);return}Je(g=>g.has(t)?g:new Set(g).add(t)),v&&x===null&&ie(be(H.current)),ce(!1),S(t)},he=t=>{S(u=>u===t?null:u)},rt=t=>{!y&&t.target.closest("a")&&t.preventDefault()},ge=T.omitTextColors(T.textStylesToCss(Se(e,"trigger"),n)),ye=Le.slice(0,de).map(t=>T.omitTextColors(T.textStylesToCss(Se(e,t,"list"),n))),W=dt.buildColorVars(r,{triggerColor:Be,triggerHoverColor:De,closeColor:ke,closeHoverColor:qe,panelColor:Ge,textColor:Xe,textHoverColor:Ye,overlayColor:Ke},ht,gt),B=c&&c!=="default"?`${r}-state-${c}`:"",D=y?`${r}-interactive`:"",$e=i.jsx("div",{className:w(`${r}-media-layer`,Pe&&`${r}-media-layer-instant`),"aria-hidden":"true",children:[...ae].map(t=>{var d;const u=(d=Q[t])==null?void 0:d.image;return u!=null&&u.assetId?i.jsx(_t,{P:r,media:u,isVisible:x===t},`${t}-${u.assetId}`):null})}),k=!!s&&(v||re),q=t=>i.jsxs("div",{ref:t?void 0:ee,className:w(`${r}-panel`,O&&re&&`${r}-panel-settled`,v&&`${r}-panel-inline`,t&&`${r}-panel-copy`),style:{width:h(Z),paddingTop:h(b.top),paddingRight:h(b.right),paddingBottom:h(b.bottom),paddingLeft:h(b.left),borderRadius:h(We),[`--${r}-group-gap`]:h(J),[`--${r}-panel-x`]:ue.x,[`--${r}-panel-y`]:ue.y,[`--${r}-grid-columns`]:Ct(pe),[`--${r}-column-gap`]:h(K),...t&&_?{top:_.top,left:_.left,width:_.width}:{}},"data-lightbox-scrollable":v?void 0:"","aria-hidden":t||void 0,onMouseLeave:t?void 0:()=>S(null),onClickCapture:t?void 0:rt,children:[!t&&k&&Lt(r,Z,b,h),!t&&k&&Et(r,pe,b.left,K,h),ot.map((u,d)=>i.jsxs(a.Fragment,{children:[!t&&k&&d>0&&i.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:h(Math.max(J,Ae))}}),i.jsx("div",{className:`${r}-group`,children:u.rows.map(({item:g,index:E},st)=>i.jsxs("div",{className:w(`${r}-row`,t&&E===x&&`${r}-row-active`),...t?{}:{onMouseEnter:()=>ve(E),onMouseLeave:()=>he(E),onFocus:()=>ve(E),onBlur:()=>he(E)},children:[i.jsx("span",{className:`${r}-group-label`,style:ye[0],children:st===0?u.label:""}),nt.map((Ce,it)=>{const G=g[Ce];return i.jsx("div",{className:`${r}-title`,style:ye[it+1],children:Array.isArray(G)?i.jsx(mt.RichTextRenderer,{content:G}):G},Ce)})]},E))})]},d))]}),lt=L?i.jsxs("div",{ref:V,className:w(`${r}-overlay`,n&&`${r}-overlay-editor`,s&&`${r}-overlay-edit-mode`,O&&`${r}-overlay-active`,D,B),style:{...W,...se},role:"dialog","aria-modal":"true","aria-label":Y,"data-selection":"none",children:[i.jsx("div",{className:`${r}-backdrop`,"aria-hidden":"true",onClick:fe}),$e,i.jsx("button",{ref:P,type:"button",className:`${r}-close`,style:{...ge,top:(C==null?void 0:C.top)??0,left:(C==null?void 0:C.left)??0,visibility:C?"visible":"hidden"},onClick:fe,children:Ue}),q(!1)]}):null,at=v&&ae.size>0?i.jsxs("div",{ref:te,className:w(`${r}-inline-layer`,n&&`${r}-overlay-editor`,D,B),style:{...W,...se},"aria-hidden":"true","data-selection":"none",children:[$e,_&&q(!0)]}):null,xe=lt??at;return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:tt}}),i.jsx("div",{ref:H,className:w(A&&`${r}-editor`,D,B),style:W,children:v?q(!1):i.jsx("button",{ref:U,type:"button",className:`${r}-trigger`,style:ge,"aria-haspopup":"dialog","aria-expanded":$,onClick:()=>{y&&I(!0)},children:Y})}),xe&&typeof document<"u"&&ct.createPortal(xe,(p?document.getElementById(p):null)??document.body)]})}exports.ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES=Le;exports.ARCHIVE_POPUP_COLUMN_WIDTH_KEYS=R;exports.ARCHIVE_POPUP_EXTRA_TITLE_KEYS=Ee;exports.ARCHIVE_POPUP_MAX_COLUMNS=_e;exports.ARCHIVE_POPUP_MIN_COLUMNS=M;exports.ARCHIVE_POPUP_PANEL_POSITIONS=vt;exports.ArchivePopup=At;exports.applyArchivePopupColumnCountChange=xt;exports.getArchivePopupEqualColumnWidths=Me;exports.groupArchiveRows=Fe;exports.resolveArchivePopupColumnWidths=je;
|