@cntrl-site/components 1.0.107-alpha.5 → 1.0.107
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/{Burger-EMSn7TPB.mjs → Burger-BkVgNMGU.mjs} +464 -436
- package/dist/Burger-C3yVbQcq.js +669 -0
- package/dist/{ClickGallerie-41L7IKhN.js → ClickGallerie-CYQMgrIr.js} +1 -1
- package/dist/{ClickGallerie-CBquEuXQ.mjs → ClickGallerie-o2U6oyOF.mjs} +1 -1
- package/dist/Components/Burger/Burger.d.ts +3 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +32 -0
- package/dist/Components/Hive/Hive.d.ts +16 -0
- package/dist/Components/Hive/HiveComponent.d.ts +3 -1
- package/dist/Components/utils/LinkWrapper.d.ts +0 -1
- package/dist/{ControlSlider-D91b53un.js → ControlSlider-Kkec-i14.js} +1 -1
- package/dist/{ControlSlider-mp-LvrTR.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
- package/dist/{FAQ-8goVE-aB.js → FAQ-BxhMo7T8.js} +1 -1
- package/dist/{FAQ-KL9X1-xe.mjs → FAQ-CdwSft5p.mjs} +1 -1
- package/dist/{Grid-Dec4bMvK.js → Grid-CFHTP3mb.js} +1 -1
- package/dist/{Grid-wxlTwFLb.mjs → Grid-e-gLfsji.mjs} +1 -1
- package/dist/Hive-CzabuuCc.js +328 -0
- package/dist/Hive-DyxYd5eg.mjs +1504 -0
- package/dist/{ImageRevealSlider-Bv092gwv.js → ImageRevealSlider-BuukTGAK.js} +1 -1
- package/dist/{ImageRevealSlider-K_nNoquq.mjs → ImageRevealSlider-Df9sygk9.mjs} +1 -1
- package/dist/{Lightbox-Cyvva2uu.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
- package/dist/{Lightbox-C2r7Wt_8.js → Lightbox-DaunVrkp.js} +1 -1
- package/dist/LinkWrapper-Ca84iPtg.js +1 -0
- package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
- package/dist/{Marquee-DGbeihUh.mjs → Marquee-DByooiWP.mjs} +1 -1
- package/dist/{Marquee-BacOdRJ9.js → Marquee-DfIP-tIN.js} +1 -1
- package/dist/{MarqueeText-DTlCevPX.mjs → MarqueeText-D6FNCe6P.mjs} +1 -1
- package/dist/{MarqueeText-BuEx2FCt.js → MarqueeText-DsUiV6Zv.js} +1 -1
- package/dist/{ArchivePopupComponent-BrP7Aary.mjs → PretextComponent-BiS9XbZr.mjs} +614 -913
- package/dist/PretextComponent-DWOy-dqD.js +1 -0
- package/dist/{RichTextRenderer-DizfCZEz.mjs → RichTextRenderer-BptwNpbJ.mjs} +1 -1
- package/dist/{RichTextRenderer-CUEc4FaL.js → RichTextRenderer-K90Dd7pt.js} +1 -1
- package/dist/{Slider20-DS-FTzQC.mjs → Slider20-CCzixTiN.mjs} +1 -1
- package/dist/{Slider20-BdeHmG8C.js → Slider20-fMVeRfgx.js} +1 -1
- package/dist/{TestimonialGrid-BOqSqVin.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
- package/dist/{TestimonialGrid-B0JHzqhv.js → TestimonialGrid-CiCagfBU.js} +1 -1
- package/dist/{TestimonialSingle-7-PMnQ7u.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
- package/dist/{TestimonialSingle-Bx_V-cYE.js → TestimonialSingle-BWXynGjv.js} +1 -1
- package/dist/components-CJlisugq.js +1 -0
- package/dist/{components-ChAw6dC4.mjs → components-ljYgHKal.mjs} +14 -15
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +18 -19
- 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 +149 -1183
- package/dist/sources.mjs +172 -1207
- package/dist/types/Component.d.ts +5 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/ArchivePopup-BLfx56G_.js +0 -203
- package/dist/ArchivePopup-DYYtVluM.mjs +0 -794
- package/dist/ArchivePopupComponent-CJsr5Jx9.js +0 -1
- package/dist/Burger-C6jI6C1c.js +0 -661
- package/dist/Components/ArchivePopup/ArchivePopup.d.ts +0 -162
- package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +0 -307
- package/dist/Hive-BsmFHk2i.mjs +0 -1458
- package/dist/Hive-D1j6wZpV.js +0 -321
- package/dist/LinkWrapper-CFEH047t.mjs +0 -14
- package/dist/LinkWrapper-CzFwFtgU.js +0 -1
- package/dist/components-DYLz2yIK.js +0 -1
package/dist/sources.mjs
CHANGED
|
@@ -1,1146 +1,5 @@
|
|
|
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
|
|
2
|
-
const
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
import cn from 'classnames';
|
|
5
|
-
import { CommonComponentProps } from '../props';
|
|
6
|
-
import { buildColorVars, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
7
|
-
import { buildValidUrl } from '../utils/LinkWrapper';
|
|
8
|
-
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
9
|
-
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
10
|
-
|
|
11
|
-
type ArchivePopupMedia = {
|
|
12
|
-
assetId: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
type?: 'image' | 'video';
|
|
15
|
-
objectFit?: 'cover' | 'contain';
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** Columns count the group column too; 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;
|
|
22
|
-
export const ARCHIVE_POPUP_MAX_COLUMNS = 5;
|
|
23
|
-
/** The fields of the columns after the title, in order; \`columns\` decides how many of them a row shows. */
|
|
24
|
-
export const ARCHIVE_POPUP_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
|
|
25
|
-
/** Every column but the last has a width of its own, like Programme's; the last takes what is left of the row. */
|
|
26
|
-
export const ARCHIVE_POPUP_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
|
|
27
|
-
|
|
28
|
-
type ArchivePopupColumnWidthKey = typeof ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[number];
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Where B's panel sits on the screen, as \`left\`/\`top\` of the screen and of the panel alike, so 0% is flush with
|
|
32
|
-
* one edge and 100% with the other. Named like Mercury's title position; center comes first because the editor
|
|
33
|
-
* puts the first value into a popup saved before there was a position, and those were centred.
|
|
34
|
-
*/
|
|
35
|
-
const PANEL_POSITION_OFFSETS = {
|
|
36
|
-
center: { x: '50%', y: '50%' },
|
|
37
|
-
'left-top': { x: '0%', y: '0%' },
|
|
38
|
-
'top-center': { x: '50%', y: '0%' },
|
|
39
|
-
'top-right': { x: '100%', y: '0%' },
|
|
40
|
-
'left-center': { x: '0%', y: '50%' },
|
|
41
|
-
'right-center': { x: '100%', y: '50%' },
|
|
42
|
-
'left-bottom': { x: '0%', y: '100%' },
|
|
43
|
-
'bottom-center': { x: '50%', y: '100%' },
|
|
44
|
-
'right-bottom': { x: '100%', y: '100%' },
|
|
45
|
-
} as const;
|
|
46
|
-
|
|
47
|
-
export type ArchivePopupPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
|
|
48
|
-
|
|
49
|
-
export const ARCHIVE_POPUP_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ArchivePopupPanelPosition[];
|
|
50
|
-
|
|
51
|
-
/** Each column of a row has a text style of its own, the group column's being \`column1\`. */
|
|
52
|
-
export const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
|
|
53
|
-
|
|
54
|
-
type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
|
|
55
|
-
|
|
56
|
-
// Plain text; a row saved while titles were rich text still holds its nodes.
|
|
57
|
-
type ArchivePopupTitle = string | any[];
|
|
58
|
-
|
|
59
|
-
export type ArchivePopupContentItem = {
|
|
60
|
-
group?: string;
|
|
61
|
-
/** Plain text, so the entry's \`link\` is the only link a row has. */
|
|
62
|
-
title?: ArchivePopupTitle;
|
|
63
|
-
title2?: ArchivePopupTitle;
|
|
64
|
-
title3?: ArchivePopupTitle;
|
|
65
|
-
title4?: ArchivePopupTitle;
|
|
66
|
-
image?: ArchivePopupMedia | ArchivePopupMedia[];
|
|
67
|
-
/** The whole row links here. */
|
|
68
|
-
link?: ContentLink;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type FontSettings = { fontWeight: number; fontStyle: string };
|
|
72
|
-
|
|
73
|
-
type Padding = { top: number; right: number; bottom: number; left: number };
|
|
74
|
-
|
|
75
|
-
/** A text style as settings hold it, each field under the name of what it styles, e.g. \`triggerFontSize\`. */
|
|
76
|
-
type TextStyleFields = {
|
|
77
|
-
FontFamily?: string;
|
|
78
|
-
FontSettings?: FontSettings;
|
|
79
|
-
FontSize?: number;
|
|
80
|
-
LineHeight?: number;
|
|
81
|
-
LetterSpacing?: number;
|
|
82
|
-
WordSpacing?: number;
|
|
83
|
-
TextAlign?: TextStyles['textAlign'];
|
|
84
|
-
TextAppearance?: TextStyles['textAppearance'];
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type PrefixedTextStyle<Prefix extends string> = {
|
|
88
|
-
[Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]?: TextStyleFields[Key];
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
|
|
92
|
-
& PrefixedTextStyle<ArchivePopupColumnStylePrefix>
|
|
93
|
-
// One style every column shared before each had its own; a column with no style of its own still shows it.
|
|
94
|
-
& PrefixedTextStyle<'list'>
|
|
95
|
-
& {
|
|
96
|
-
/** \`a\` is always open, in place on the page; \`b\` opens from a label. */
|
|
97
|
-
type?: 'a' | 'b';
|
|
98
|
-
triggerLabel?: string;
|
|
99
|
-
closeLabel?: string;
|
|
100
|
-
/** Every column of a row, the group column included. */
|
|
101
|
-
columns?: number;
|
|
102
|
-
columnGap?: number;
|
|
103
|
-
column1Width?: number;
|
|
104
|
-
column2Width?: number;
|
|
105
|
-
column3Width?: number;
|
|
106
|
-
column4Width?: number;
|
|
107
|
-
/** How long each of a hovered row's images shows before the next, in ms. */
|
|
108
|
-
hoverInterval?: number;
|
|
109
|
-
/** B only: A's panel stays where it is placed on the page. */
|
|
110
|
-
panelPosition?: string;
|
|
111
|
-
panelWidth?: number;
|
|
112
|
-
panelPadding?: Padding;
|
|
113
|
-
panelRadius?: number;
|
|
114
|
-
groupGap?: number;
|
|
115
|
-
triggerColor?: string;
|
|
116
|
-
triggerHoverColor?: string;
|
|
117
|
-
closeColor?: string;
|
|
118
|
-
closeHoverColor?: string;
|
|
119
|
-
panelColor?: string;
|
|
120
|
-
textColor?: string;
|
|
121
|
-
textHoverColor?: string;
|
|
122
|
-
overlayColor?: string;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
type ArchivePopupProps = {
|
|
126
|
-
settings: ArchivePopupSettings;
|
|
127
|
-
content?: ArchivePopupContentItem[];
|
|
128
|
-
isEditor?: boolean;
|
|
129
|
-
isEditMode?: boolean;
|
|
130
|
-
isPreviewMode?: boolean;
|
|
131
|
-
activeEvent?: string;
|
|
132
|
-
portalId?: string;
|
|
133
|
-
} & CommonComponentProps;
|
|
134
|
-
|
|
135
|
-
export type ArchivePopupRow = {
|
|
136
|
-
item: ArchivePopupContentItem;
|
|
137
|
-
index: number;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export type ArchivePopupGroup = {
|
|
141
|
-
label: string;
|
|
142
|
-
rows: ArchivePopupRow[];
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
type ColorKeys =
|
|
146
|
-
| 'triggerColor'
|
|
147
|
-
| 'triggerHoverColor'
|
|
148
|
-
| 'closeColor'
|
|
149
|
-
| 'closeHoverColor'
|
|
150
|
-
| 'panelColor'
|
|
151
|
-
| 'textColor'
|
|
152
|
-
| 'textHoverColor'
|
|
153
|
-
| 'overlayColor';
|
|
154
|
-
|
|
155
|
-
const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
156
|
-
triggerColor: 'trigger-color',
|
|
157
|
-
triggerHoverColor: 'trigger-hover-color',
|
|
158
|
-
closeColor: 'close-color',
|
|
159
|
-
closeHoverColor: 'close-hover-color',
|
|
160
|
-
panelColor: 'panel-color',
|
|
161
|
-
textColor: 'text-color',
|
|
162
|
-
textHoverColor: 'text-hover-color',
|
|
163
|
-
overlayColor: 'overlay-color',
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const STATE_KEYS = ['hover', 'open'] as const;
|
|
167
|
-
|
|
168
|
-
const OVERLAY_ANIM_MS = 300;
|
|
169
|
-
// The least a padding handle is drawn at, so a zero padding can still be grabbed.
|
|
170
|
-
const PADDING_HANDLE_SIZE = 0.004;
|
|
171
|
-
const COLUMN_RESIZE_HANDLE_WIDTH = 0.004;
|
|
172
|
-
// The least a column is dragged down to, in pixels of the layout.
|
|
173
|
-
const MIN_COLUMN_WIDTH_PX = 20;
|
|
174
|
-
const DEFAULT_COLUMN_GAP = 0.0139;
|
|
175
|
-
const DEFAULT_PANEL_WIDTH = 0.3194;
|
|
176
|
-
const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
|
|
177
|
-
const IMAGE_FADE_MS = 300;
|
|
178
|
-
const DEFAULT_HOVER_INTERVAL_MS = 1000;
|
|
179
|
-
|
|
180
|
-
const LIGHTBOX_CSS_VARS = [
|
|
181
|
-
'--cntrl-article-width',
|
|
182
|
-
'--cntrl-article-top',
|
|
183
|
-
'--cntrl-article-left',
|
|
184
|
-
'--cntrl-viewport-height',
|
|
185
|
-
] as const;
|
|
186
|
-
|
|
187
|
-
// A row with an empty group continues the group above it, so the label only has to be typed once.
|
|
188
|
-
type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'>
|
|
189
|
-
& Partial<Record<ArchivePopupColumnWidthKey, number>>;
|
|
190
|
-
|
|
191
|
-
function getColumnCount(columns: number | undefined): number {
|
|
192
|
-
return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_DEFAULT_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/** The width a row's columns share: the panel's, less its padding and the gaps between them. */
|
|
196
|
-
function getColumnsSpace(settings: ColumnLayoutSettings): number {
|
|
197
|
-
const { panelWidth = DEFAULT_PANEL_WIDTH, panelPadding = DEFAULT_PANEL_PADDING, columnGap = DEFAULT_COLUMN_GAP } = settings;
|
|
198
|
-
const gaps = (getColumnCount(settings.columns) - 1) * columnGap;
|
|
199
|
-
return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - gaps);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>> {
|
|
203
|
-
const count = getColumnCount(settings.columns);
|
|
204
|
-
const width = getColumnsSpace(settings) / count;
|
|
205
|
-
return Object.fromEntries(ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => [key, width]));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
|
|
210
|
-
* and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
|
|
211
|
-
*/
|
|
212
|
-
export function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[] {
|
|
213
|
-
const count = getColumnCount(settings.columns);
|
|
214
|
-
const space = getColumnsSpace(settings);
|
|
215
|
-
const sized = ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => {
|
|
216
|
-
const width = settings[key];
|
|
217
|
-
return typeof width === 'number' ? Math.max(0, width) : space / count;
|
|
218
|
-
});
|
|
219
|
-
const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
|
|
220
|
-
const scale = sizedTotal > space ? space / sizedTotal : 1;
|
|
221
|
-
const fitted = sized.map((width) => width * scale);
|
|
222
|
-
return [...fitted, Math.max(0, space - sizedTotal * scale)];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/** Like Programme, a new column count starts the columns over at equal widths. */
|
|
226
|
-
export function applyArchivePopupColumnCountChange(
|
|
227
|
-
nextSettings: Record<string, any>,
|
|
228
|
-
prevSettings: Record<string, any>,
|
|
229
|
-
): Record<string, any> {
|
|
230
|
-
if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
|
|
231
|
-
return nextSettings;
|
|
232
|
-
}
|
|
233
|
-
return { ...nextSettings, ...getArchivePopupEqualColumnWidths({ ...prevSettings, ...nextSettings }) };
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// The columns stay in proportion when the panel is drawn narrower than its width, on a small screen.
|
|
237
|
-
function getGridTemplateColumns(widths: number[]): string {
|
|
238
|
-
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
239
|
-
return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[] {
|
|
243
|
-
const groups: ArchivePopupGroup[] = [];
|
|
244
|
-
items.forEach((item, index) => {
|
|
245
|
-
const label = item.group?.trim() ?? '';
|
|
246
|
-
const current = groups[groups.length - 1];
|
|
247
|
-
if (!current || (label !== '' && label !== current.label)) {
|
|
248
|
-
groups.push({ label, rows: [{ item, index }] });
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
current.rows.push({ item, index });
|
|
252
|
-
});
|
|
253
|
-
return groups;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefined): ArchivePopupMedia[] {
|
|
257
|
-
const { image } = item ?? {};
|
|
258
|
-
return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
|
|
259
|
-
}
|
|
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
|
-
|
|
272
|
-
function isVideoMedia(media: ArchivePopupMedia): boolean {
|
|
273
|
-
if (media.type === 'video') return true;
|
|
274
|
-
if (media.type === 'image') return false;
|
|
275
|
-
return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
279
|
-
let el = element;
|
|
280
|
-
while (el) {
|
|
281
|
-
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) {
|
|
282
|
-
return el;
|
|
283
|
-
}
|
|
284
|
-
el = el.parentElement;
|
|
285
|
-
}
|
|
286
|
-
return element;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function getLightboxLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
290
|
-
const style: Record<string, string> = {};
|
|
291
|
-
const layoutContainer = findLayoutContainer(container);
|
|
292
|
-
if (!layoutContainer) return style;
|
|
293
|
-
const computed = getComputedStyle(layoutContainer);
|
|
294
|
-
for (const varName of LIGHTBOX_CSS_VARS) {
|
|
295
|
-
const value = computed.getPropertyValue(varName).trim();
|
|
296
|
-
if (value) {
|
|
297
|
-
style[varName] = value;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return style;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function resolveTextStyle(settings: ArchivePopupSettings, prefix: string, fallbackPrefix?: string): TextStyles {
|
|
304
|
-
const values = settings as Record<string, unknown>;
|
|
305
|
-
const read = <Key extends keyof TextStyleFields>(key: Key) => (
|
|
306
|
-
values[\`\${prefix}\${key}\`] ?? (fallbackPrefix ? values[\`\${fallbackPrefix}\${key}\`] : undefined)
|
|
307
|
-
) as TextStyleFields[Key];
|
|
308
|
-
const fontSettings = read('FontSettings');
|
|
309
|
-
return {
|
|
310
|
-
fontSettings: {
|
|
311
|
-
fontFamily: read('FontFamily'),
|
|
312
|
-
fontWeight: fontSettings?.fontWeight ?? 400,
|
|
313
|
-
fontStyle: fontSettings?.fontStyle ?? 'normal',
|
|
314
|
-
},
|
|
315
|
-
fontSize: read('FontSize') ?? 0.01,
|
|
316
|
-
lineHeight: read('LineHeight'),
|
|
317
|
-
letterSpacing: read('LetterSpacing') ?? 0,
|
|
318
|
-
wordSpacing: read('WordSpacing') ?? 0,
|
|
319
|
-
textAlign: read('TextAlign'),
|
|
320
|
-
textAppearance: read('TextAppearance'),
|
|
321
|
-
color: '#000000',
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function getCSS(P: string): string {
|
|
326
|
-
return \`
|
|
327
|
-
.\${P}-trigger,
|
|
328
|
-
.\${P}-close {
|
|
329
|
-
display: inline-block;
|
|
330
|
-
margin: 0;
|
|
331
|
-
padding: 0;
|
|
332
|
-
border: 0;
|
|
333
|
-
background: none;
|
|
334
|
-
cursor: pointer;
|
|
335
|
-
white-space: nowrap;
|
|
336
|
-
transition: color 150ms ease;
|
|
337
|
-
-webkit-appearance: none;
|
|
338
|
-
appearance: none;
|
|
339
|
-
-webkit-tap-highlight-color: transparent;
|
|
340
|
-
}
|
|
341
|
-
.\${P}-trigger {
|
|
342
|
-
color: var(--\${P}-trigger-color);
|
|
343
|
-
transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
344
|
-
}
|
|
345
|
-
.\${P}-trigger-hidden {
|
|
346
|
-
opacity: 0;
|
|
347
|
-
}
|
|
348
|
-
.\${P}-close {
|
|
349
|
-
color: var(--\${P}-close-color);
|
|
350
|
-
}
|
|
351
|
-
.\${P}-trigger:focus,
|
|
352
|
-
.\${P}-close:focus {
|
|
353
|
-
outline: none;
|
|
354
|
-
}
|
|
355
|
-
.\${P}-trigger:focus-visible,
|
|
356
|
-
.\${P}-close:focus-visible {
|
|
357
|
-
outline: 1px solid currentColor;
|
|
358
|
-
outline-offset: 2px;
|
|
359
|
-
}
|
|
360
|
-
.\${P}-interactive .\${P}-trigger:hover,
|
|
361
|
-
.\${P}-state-hover .\${P}-trigger {
|
|
362
|
-
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
363
|
-
}
|
|
364
|
-
.\${P}-close:hover {
|
|
365
|
-
color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
|
|
366
|
-
}
|
|
367
|
-
.\${P}-editor .\${P}-trigger {
|
|
368
|
-
cursor: default;
|
|
369
|
-
}
|
|
370
|
-
.\${P}-overlay {
|
|
371
|
-
position: fixed;
|
|
372
|
-
inset: 0;
|
|
373
|
-
z-index: 9997;
|
|
374
|
-
overflow: hidden;
|
|
375
|
-
overscroll-behavior: none;
|
|
376
|
-
opacity: 0;
|
|
377
|
-
pointer-events: none;
|
|
378
|
-
transition: opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
379
|
-
}
|
|
380
|
-
.\${P}-inline-layer {
|
|
381
|
-
position: fixed;
|
|
382
|
-
inset: 0;
|
|
383
|
-
z-index: 9997;
|
|
384
|
-
overflow: hidden;
|
|
385
|
-
pointer-events: none;
|
|
386
|
-
}
|
|
387
|
-
.\${P}-overlay-editor {
|
|
388
|
-
inset: auto;
|
|
389
|
-
top: var(--cntrl-article-top, 0);
|
|
390
|
-
left: var(--cntrl-article-left, 0);
|
|
391
|
-
width: var(--cntrl-article-width, 100vw) !important;
|
|
392
|
-
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
393
|
-
}
|
|
394
|
-
.\${P}-overlay-edit-mode {
|
|
395
|
-
z-index: 1;
|
|
396
|
-
}
|
|
397
|
-
.\${P}-overlay-active {
|
|
398
|
-
opacity: 1;
|
|
399
|
-
pointer-events: auto;
|
|
400
|
-
}
|
|
401
|
-
.\${P}-backdrop {
|
|
402
|
-
position: absolute;
|
|
403
|
-
inset: 0;
|
|
404
|
-
background-color: var(--\${P}-overlay-color);
|
|
405
|
-
}
|
|
406
|
-
.\${P}-media-layer {
|
|
407
|
-
position: absolute;
|
|
408
|
-
inset: 0;
|
|
409
|
-
pointer-events: none;
|
|
410
|
-
}
|
|
411
|
-
.\${P}-media {
|
|
412
|
-
position: absolute;
|
|
413
|
-
inset: 0;
|
|
414
|
-
width: 100%;
|
|
415
|
-
height: 100%;
|
|
416
|
-
object-fit: cover;
|
|
417
|
-
opacity: 0;
|
|
418
|
-
}
|
|
419
|
-
.\${P}-media-contain {
|
|
420
|
-
object-fit: contain;
|
|
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
|
-
}
|
|
428
|
-
.\${P}-media-visible {
|
|
429
|
-
z-index: 1;
|
|
430
|
-
opacity: 1;
|
|
431
|
-
}
|
|
432
|
-
.\${P}-media-covered {
|
|
433
|
-
opacity: 1;
|
|
434
|
-
}
|
|
435
|
-
.\${P}-media-fading {
|
|
436
|
-
opacity: 0;
|
|
437
|
-
}
|
|
438
|
-
.\${P}-close {
|
|
439
|
-
position: absolute;
|
|
440
|
-
z-index: 2;
|
|
441
|
-
}
|
|
442
|
-
.\${P}-panel {
|
|
443
|
-
position: absolute;
|
|
444
|
-
top: var(--\${P}-panel-y);
|
|
445
|
-
left: var(--\${P}-panel-x);
|
|
446
|
-
z-index: 1;
|
|
447
|
-
box-sizing: border-box;
|
|
448
|
-
max-width: 100%;
|
|
449
|
-
max-height: 100%;
|
|
450
|
-
overflow-y: auto;
|
|
451
|
-
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
|
|
452
|
-
background-color: var(--\${P}-panel-color);
|
|
453
|
-
color: var(--\${P}-text-color);
|
|
454
|
-
overscroll-behavior: contain;
|
|
455
|
-
transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
456
|
-
}
|
|
457
|
-
.\${P}-overlay-active .\${P}-panel {
|
|
458
|
-
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
|
|
459
|
-
}
|
|
460
|
-
.\${P}-panel-settled {
|
|
461
|
-
transition: none;
|
|
462
|
-
}
|
|
463
|
-
.\${P}-panel-inline {
|
|
464
|
-
position: relative;
|
|
465
|
-
top: auto;
|
|
466
|
-
left: auto;
|
|
467
|
-
max-height: none;
|
|
468
|
-
transform: none;
|
|
469
|
-
transition: none;
|
|
470
|
-
}
|
|
471
|
-
.\${P}-media-layer-instant .\${P}-media {
|
|
472
|
-
transition: none;
|
|
473
|
-
}
|
|
474
|
-
.\${P}-panel-copy {
|
|
475
|
-
position: absolute;
|
|
476
|
-
pointer-events: none;
|
|
477
|
-
}
|
|
478
|
-
@media (prefers-reduced-motion: reduce) {
|
|
479
|
-
.\${P}-panel {
|
|
480
|
-
transition: none;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
.\${P}-group ~ .\${P}-group {
|
|
484
|
-
margin-top: var(--\${P}-group-gap);
|
|
485
|
-
}
|
|
486
|
-
.\${P}-group {
|
|
487
|
-
display: grid;
|
|
488
|
-
grid-template-columns: var(--\${P}-grid-columns);
|
|
489
|
-
column-gap: var(--\${P}-column-gap);
|
|
490
|
-
}
|
|
491
|
-
.\${P}-row {
|
|
492
|
-
grid-column: 2 / -1;
|
|
493
|
-
display: grid;
|
|
494
|
-
grid-template-columns: subgrid;
|
|
495
|
-
align-items: baseline;
|
|
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
|
-
}
|
|
504
|
-
.\${P}-group-label {
|
|
505
|
-
grid-column: 1;
|
|
506
|
-
align-self: start;
|
|
507
|
-
min-width: 0;
|
|
508
|
-
overflow-wrap: anywhere;
|
|
509
|
-
}
|
|
510
|
-
.\${P}-title {
|
|
511
|
-
min-width: 0;
|
|
512
|
-
overflow-wrap: anywhere;
|
|
513
|
-
white-space: pre-line;
|
|
514
|
-
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
515
|
-
}
|
|
516
|
-
.\${P}-control-anchor {
|
|
517
|
-
position: absolute;
|
|
518
|
-
pointer-events: none;
|
|
519
|
-
z-index: 2;
|
|
520
|
-
}
|
|
521
|
-
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
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 {
|
|
525
|
-
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
526
|
-
}
|
|
527
|
-
\`;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
function ArchivePopupMediaItem({
|
|
531
|
-
P,
|
|
532
|
-
media,
|
|
533
|
-
isVisible,
|
|
534
|
-
isLoaded,
|
|
535
|
-
isCovered,
|
|
536
|
-
isFading,
|
|
537
|
-
onLoad,
|
|
538
|
-
}: {
|
|
539
|
-
P: string;
|
|
540
|
-
media: ArchivePopupMedia;
|
|
541
|
-
isVisible: boolean;
|
|
542
|
-
isLoaded: boolean;
|
|
543
|
-
isCovered: boolean;
|
|
544
|
-
isFading: boolean;
|
|
545
|
-
onLoad: () => void;
|
|
546
|
-
}) {
|
|
547
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
548
|
-
const isVideo = isVideoMedia(media);
|
|
549
|
-
const className = cn(
|
|
550
|
-
\`\${P}-media\`,
|
|
551
|
-
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
552
|
-
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
553
|
-
isCovered && \`\${P}-media-covered\`,
|
|
554
|
-
isFading && \`\${P}-media-fading\`,
|
|
555
|
-
);
|
|
556
|
-
|
|
557
|
-
useEffect(() => {
|
|
558
|
-
const video = videoRef.current;
|
|
559
|
-
if (!isVideo || !video) return;
|
|
560
|
-
if (isVisible) {
|
|
561
|
-
video.play()?.catch(() => {});
|
|
562
|
-
} else {
|
|
563
|
-
video.pause();
|
|
564
|
-
}
|
|
565
|
-
}, [isVideo, isVisible]);
|
|
566
|
-
|
|
567
|
-
if (isVideo) {
|
|
568
|
-
return (
|
|
569
|
-
<video
|
|
570
|
-
ref={videoRef}
|
|
571
|
-
className={className}
|
|
572
|
-
src={media.assetId}
|
|
573
|
-
muted
|
|
574
|
-
loop
|
|
575
|
-
playsInline
|
|
576
|
-
preload="auto"
|
|
577
|
-
onLoadedData={onLoad}
|
|
578
|
-
/>
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
return (
|
|
583
|
-
<img
|
|
584
|
-
className={className}
|
|
585
|
-
src={media.assetId}
|
|
586
|
-
alt=""
|
|
587
|
-
decoding="async"
|
|
588
|
-
onLoad={onLoad}
|
|
589
|
-
/>
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
// A line in each gap, at the right edge of the column it sizes, as Programme's are.
|
|
594
|
-
function renderColumnWidthControls(
|
|
595
|
-
P: string,
|
|
596
|
-
widths: number[],
|
|
597
|
-
paddingLeft: number,
|
|
598
|
-
columnGap: number,
|
|
599
|
-
scaled: (value: number) => string,
|
|
600
|
-
) {
|
|
601
|
-
const lastWidth = widths[widths.length - 1];
|
|
602
|
-
let columnLeft = paddingLeft;
|
|
603
|
-
return widths.slice(0, -1).map((width, index) => {
|
|
604
|
-
const gapCenter = columnLeft + width + columnGap / 2;
|
|
605
|
-
columnLeft += width + columnGap;
|
|
606
|
-
return (
|
|
607
|
-
<div
|
|
608
|
-
key={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
|
|
609
|
-
data-controls={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
|
|
610
|
-
data-controls-axis="x"
|
|
611
|
-
data-controls-variant="column-width"
|
|
612
|
-
data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
|
|
613
|
-
// a column grows into the last one, which the editor keeps from going under its own least
|
|
614
|
-
data-controls-max-fraction={String(width + lastWidth)}
|
|
615
|
-
className={\`\${P}-control-anchor\`}
|
|
616
|
-
style={{ top: 0, left: scaled(gapCenter - COLUMN_RESIZE_HANDLE_WIDTH / 2), width: scaled(COLUMN_RESIZE_HANDLE_WIDTH), height: '100%' }}
|
|
617
|
-
/>
|
|
618
|
-
);
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
function renderPanelPaddingControls(
|
|
623
|
-
P: string,
|
|
624
|
-
panelWidth: number,
|
|
625
|
-
padding: Padding,
|
|
626
|
-
scaled: (value: number) => string,
|
|
627
|
-
) {
|
|
628
|
-
const handleSize = (value: number) => scaled(Math.max(value, PADDING_HANDLE_SIZE));
|
|
629
|
-
return (
|
|
630
|
-
<>
|
|
631
|
-
<div
|
|
632
|
-
data-controls="panelPadding.top"
|
|
633
|
-
data-controls-axis="y"
|
|
634
|
-
data-controls-variant="row-padding"
|
|
635
|
-
data-controls-min="0"
|
|
636
|
-
className={\`\${P}-control-anchor\`}
|
|
637
|
-
style={{ top: 0, left: 0, width: '100%', height: handleSize(padding.top) }}
|
|
638
|
-
/>
|
|
639
|
-
<div
|
|
640
|
-
data-controls="panelPadding.bottom"
|
|
641
|
-
data-controls-axis="y"
|
|
642
|
-
data-controls-variant="row-padding"
|
|
643
|
-
data-controls-reverse=""
|
|
644
|
-
data-controls-min="0"
|
|
645
|
-
className={\`\${P}-control-anchor\`}
|
|
646
|
-
style={{ bottom: 0, left: 0, width: '100%', height: handleSize(padding.bottom) }}
|
|
647
|
-
/>
|
|
648
|
-
<div
|
|
649
|
-
data-controls="panelPadding.left"
|
|
650
|
-
data-controls-axis="x"
|
|
651
|
-
data-controls-variant="column-padding"
|
|
652
|
-
data-controls-min="0"
|
|
653
|
-
data-controls-max-fraction={String(Math.max(0, panelWidth - padding.right))}
|
|
654
|
-
className={\`\${P}-control-anchor\`}
|
|
655
|
-
style={{ top: 0, left: 0, width: handleSize(padding.left), height: '100%' }}
|
|
656
|
-
/>
|
|
657
|
-
<div
|
|
658
|
-
data-controls="panelPadding.right"
|
|
659
|
-
data-controls-axis="x"
|
|
660
|
-
data-controls-variant="column-padding"
|
|
661
|
-
data-controls-reverse=""
|
|
662
|
-
data-controls-min="0"
|
|
663
|
-
data-controls-max-fraction={String(Math.max(0, panelWidth - padding.left))}
|
|
664
|
-
className={\`\${P}-control-anchor\`}
|
|
665
|
-
style={{ top: 0, right: 0, width: handleSize(padding.right), height: '100%' }}
|
|
666
|
-
/>
|
|
667
|
-
</>
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
export function ArchivePopup({
|
|
672
|
-
settings,
|
|
673
|
-
content,
|
|
674
|
-
isEditor,
|
|
675
|
-
isEditMode,
|
|
676
|
-
isPreviewMode,
|
|
677
|
-
activeEvent,
|
|
678
|
-
portalId,
|
|
679
|
-
currentState,
|
|
680
|
-
unavailableStates,
|
|
681
|
-
}: ArchivePopupProps) {
|
|
682
|
-
const { prefix: P } = useScopedStyles();
|
|
683
|
-
const {
|
|
684
|
-
type = 'b',
|
|
685
|
-
triggerLabel = 'Archive',
|
|
686
|
-
closeLabel = 'Close',
|
|
687
|
-
columns = ARCHIVE_POPUP_DEFAULT_COLUMNS,
|
|
688
|
-
columnGap = DEFAULT_COLUMN_GAP,
|
|
689
|
-
hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
|
|
690
|
-
panelPosition,
|
|
691
|
-
panelWidth = DEFAULT_PANEL_WIDTH,
|
|
692
|
-
panelPadding = DEFAULT_PANEL_PADDING,
|
|
693
|
-
panelRadius = 0,
|
|
694
|
-
groupGap = 0.0139,
|
|
695
|
-
triggerColor = '#000000',
|
|
696
|
-
triggerHoverColor = '#666666',
|
|
697
|
-
closeColor = '#000000',
|
|
698
|
-
closeHoverColor = '#666666',
|
|
699
|
-
panelColor = '#FFFFFF',
|
|
700
|
-
textColor = '#333132',
|
|
701
|
-
textHoverColor = '#BBBBBB',
|
|
702
|
-
overlayColor = '#FFFFFFE6',
|
|
703
|
-
} = settings;
|
|
704
|
-
const items = content ?? [];
|
|
705
|
-
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
706
|
-
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
707
|
-
const overlayRef = useRef<HTMLDivElement>(null);
|
|
708
|
-
const closeRef = useRef<HTMLButtonElement>(null);
|
|
709
|
-
const panelRef = useRef<HTMLDivElement>(null);
|
|
710
|
-
const inlineLayerRef = useRef<HTMLDivElement>(null);
|
|
711
|
-
const [isOpenUser, setIsOpen] = useState(false);
|
|
712
|
-
const [isOverlayMounted, setIsOverlayMounted] = useState(false);
|
|
713
|
-
const [isOverlayActive, setIsOverlayActive] = useState(false);
|
|
714
|
-
const [isOverlaySettled, setIsOverlaySettled] = useState(false);
|
|
715
|
-
const [activeIndex, setActiveIndex] = useState<number | null>(null);
|
|
716
|
-
// Which of the hovered row's images shows, counted afresh on every hover.
|
|
717
|
-
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
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);
|
|
724
|
-
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
725
|
-
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
726
|
-
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
727
|
-
const [isMediaCut, setIsMediaCut] = useState(false);
|
|
728
|
-
|
|
729
|
-
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
730
|
-
const isInteractive = !isEditor || Boolean(isPreviewMode);
|
|
731
|
-
// A has no popup to open: its panel is always shown in place of the label.
|
|
732
|
-
const isInline = type === 'a';
|
|
733
|
-
const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
|
|
734
|
-
// Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
|
|
735
|
-
const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
|
|
736
|
-
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
737
|
-
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
738
|
-
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
|
|
739
|
-
const columnCount = getColumnCount(columns);
|
|
740
|
-
const columnWidths = resolveArchivePopupColumnWidths(settings);
|
|
741
|
-
// the group takes the first column, the titles the rest
|
|
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]);
|
|
750
|
-
|
|
751
|
-
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
752
|
-
|
|
753
|
-
useEffect(() => {
|
|
754
|
-
if (isEditorCanvas && !isEditMode) setIsOpen(false);
|
|
755
|
-
}, [isEditorCanvas, isEditMode]);
|
|
756
|
-
|
|
757
|
-
useEffect(() => {
|
|
758
|
-
if (isOpen) {
|
|
759
|
-
setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
|
|
760
|
-
setIsOverlayMounted(true);
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
setIsOverlayActive(false);
|
|
764
|
-
setActiveIndex(null);
|
|
765
|
-
const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
|
|
766
|
-
return () => window.clearTimeout(timer);
|
|
767
|
-
}, [isOpen]);
|
|
768
|
-
|
|
769
|
-
// Activate only after the mounted overlay's hidden styles are applied, or the appear has nothing to transition from.
|
|
770
|
-
useEffect(() => {
|
|
771
|
-
if (!isOpen || !isOverlayMounted) return;
|
|
772
|
-
overlayRef.current?.getBoundingClientRect();
|
|
773
|
-
const frame = requestAnimationFrame(() => setIsOverlayActive(true));
|
|
774
|
-
return () => cancelAnimationFrame(frame);
|
|
775
|
-
}, [isOpen, isOverlayMounted]);
|
|
776
|
-
|
|
777
|
-
// Canvas controls measure their anchors once, so they wait for the panel to finish sliding in.
|
|
778
|
-
useEffect(() => {
|
|
779
|
-
if (!isOverlayActive) {
|
|
780
|
-
setIsOverlaySettled(false);
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
|
|
784
|
-
return () => window.clearTimeout(timer);
|
|
785
|
-
}, [isOverlayActive]);
|
|
786
|
-
|
|
787
|
-
// The close button sits exactly where the trigger is, so the label swaps in place.
|
|
788
|
-
const updateClosePosition = useCallback(() => {
|
|
789
|
-
const trigger = triggerRef.current;
|
|
790
|
-
const overlay = overlayRef.current;
|
|
791
|
-
if (!trigger || !overlay) return;
|
|
792
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
793
|
-
const overlayRect = overlay.getBoundingClientRect();
|
|
794
|
-
setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
|
|
795
|
-
}, []);
|
|
796
|
-
|
|
797
|
-
useLayoutEffect(() => {
|
|
798
|
-
if (!isOverlayMounted) return;
|
|
799
|
-
updateClosePosition();
|
|
800
|
-
window.addEventListener('resize', updateClosePosition);
|
|
801
|
-
return () => window.removeEventListener('resize', updateClosePosition);
|
|
802
|
-
}, [isOverlayMounted, updateClosePosition]);
|
|
803
|
-
|
|
804
|
-
useEffect(() => {
|
|
805
|
-
if (!isOpen || !isInteractive) return;
|
|
806
|
-
closeRef.current?.focus({ preventScroll: true });
|
|
807
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
808
|
-
if (event.key === 'Escape') setIsOpen(false);
|
|
809
|
-
};
|
|
810
|
-
document.addEventListener('keydown', onKeyDown);
|
|
811
|
-
return () => document.removeEventListener('keydown', onKeyDown);
|
|
812
|
-
}, [isOpen, isInteractive]);
|
|
813
|
-
|
|
814
|
-
// 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.
|
|
815
|
-
useLayoutEffect(() => {
|
|
816
|
-
if (!isInline || activeIndex === null) return;
|
|
817
|
-
const panelEl = panelRef.current;
|
|
818
|
-
const layer = inlineLayerRef.current;
|
|
819
|
-
if (!panelEl || !layer) return;
|
|
820
|
-
const panelRect = panelEl.getBoundingClientRect();
|
|
821
|
-
const layerRect = layer.getBoundingClientRect();
|
|
822
|
-
setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
|
|
823
|
-
}, [isInline, activeIndex]);
|
|
824
|
-
|
|
825
|
-
// The copy stays over the list while the media fades out, so the list never shows through a fading image.
|
|
826
|
-
useEffect(() => {
|
|
827
|
-
if (activeIndex !== null) return;
|
|
828
|
-
const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
|
|
829
|
-
return () => window.clearTimeout(timer);
|
|
830
|
-
}, [activeIndex]);
|
|
831
|
-
|
|
832
|
-
// The copy is only true to the panel until the page moves, so scrolling cuts the media at once rather than locking it,
|
|
833
|
-
// fading out included: a copy left over the list would stay put while the list scrolls away under it.
|
|
834
|
-
const isCopyShown = copyRect !== null;
|
|
835
|
-
useEffect(() => {
|
|
836
|
-
if (!isInline || !isCopyShown) return;
|
|
837
|
-
const cut = () => {
|
|
838
|
-
setIsMediaCut(true);
|
|
839
|
-
setActiveIndex(null);
|
|
840
|
-
setCopyRect(null);
|
|
841
|
-
};
|
|
842
|
-
document.addEventListener('scroll', cut, { capture: true, passive: true });
|
|
843
|
-
window.addEventListener('resize', cut);
|
|
844
|
-
return () => {
|
|
845
|
-
document.removeEventListener('scroll', cut, { capture: true });
|
|
846
|
-
window.removeEventListener('resize', cut);
|
|
847
|
-
};
|
|
848
|
-
}, [isInline, isCopyShown]);
|
|
849
|
-
|
|
850
|
-
const close = () => {
|
|
851
|
-
if (!isInteractive) return;
|
|
852
|
-
setIsOpen(false);
|
|
853
|
-
triggerRef.current?.focus({ preventScroll: true });
|
|
854
|
-
};
|
|
855
|
-
|
|
856
|
-
// Every row's images are fetched once the list can be hovered, so a row's first hover shows its image at once
|
|
857
|
-
// rather than after it loads; videos are left to load on hover.
|
|
858
|
-
const isListShown = isInteractive && (isInline || isOpen);
|
|
859
|
-
useEffect(() => {
|
|
860
|
-
if (!isListShown) return;
|
|
861
|
-
(content ?? []).forEach((item) => getArchivePopupRowMedia(item).forEach((media) => {
|
|
862
|
-
if (!isVideoMedia(media)) new Image().src = media.assetId;
|
|
863
|
-
}));
|
|
864
|
-
}, [isListShown, content]);
|
|
865
|
-
|
|
866
|
-
// A hovered row with several images shows them in turn, round and round, for as long as it stays hovered.
|
|
867
|
-
const activeRowMediaCount = activeIndex === null ? 0 : getArchivePopupRowMedia(items[activeIndex]).length;
|
|
868
|
-
useEffect(() => {
|
|
869
|
-
if (activeRowMediaCount < 2) return;
|
|
870
|
-
const timer = window.setInterval(() => {
|
|
871
|
-
setActiveMediaIndex((current) => (current + 1) % activeRowMediaCount);
|
|
872
|
-
}, Math.max(100, hoverInterval));
|
|
873
|
-
return () => window.clearInterval(timer);
|
|
874
|
-
}, [activeIndex, activeRowMediaCount, hoverInterval]);
|
|
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
|
-
|
|
896
|
-
const showRowMedia = (index: number) => {
|
|
897
|
-
if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
|
|
898
|
-
setActiveIndex(null);
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
// A row's images all load on its first hover, so the next is ready by the time it shows.
|
|
902
|
-
setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
|
|
903
|
-
if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
|
|
904
|
-
if (activeIndex !== index) setActiveMediaIndex(0);
|
|
905
|
-
setIsMediaCut(false);
|
|
906
|
-
setActiveIndex(index);
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
const hideRowMedia = (index: number) => {
|
|
910
|
-
setActiveIndex((current) => (current === index ? null : current));
|
|
911
|
-
};
|
|
912
|
-
|
|
913
|
-
// Row links only navigate on a live page or in preview, not on the editor canvas.
|
|
914
|
-
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
915
|
-
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
916
|
-
event.preventDefault();
|
|
917
|
-
}
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
|
|
921
|
-
const columnTypographyCss = ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES.slice(0, columnCount).map((prefix) => (
|
|
922
|
-
omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix, 'list'), isEditor))
|
|
923
|
-
));
|
|
924
|
-
// Half the difference of the two line heights sets the label's first line on the first title's, exactly
|
|
925
|
-
// while both columns share a font size.
|
|
926
|
-
const labelLineHeight = columnTypographyCss[0].lineHeight;
|
|
927
|
-
const titleLineHeight = columnTypographyCss[1]?.lineHeight;
|
|
928
|
-
const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
|
|
929
|
-
? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
|
|
930
|
-
: undefined;
|
|
931
|
-
|
|
932
|
-
const colorVars = buildColorVars(P, {
|
|
933
|
-
triggerColor,
|
|
934
|
-
triggerHoverColor,
|
|
935
|
-
closeColor,
|
|
936
|
-
closeHoverColor,
|
|
937
|
-
panelColor,
|
|
938
|
-
textColor,
|
|
939
|
-
textHoverColor,
|
|
940
|
-
overlayColor,
|
|
941
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
942
|
-
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
943
|
-
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
944
|
-
|
|
945
|
-
const mediaLayer = (
|
|
946
|
-
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
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
|
-
}))}
|
|
962
|
-
</div>
|
|
963
|
-
);
|
|
964
|
-
// Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
|
|
965
|
-
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
966
|
-
|
|
967
|
-
const renderPanel = (isCopy: boolean) => (
|
|
968
|
-
<div
|
|
969
|
-
ref={isCopy ? undefined : panelRef}
|
|
970
|
-
className={cn(
|
|
971
|
-
\`\${P}-panel\`,
|
|
972
|
-
// Only the open and close slide; once open, a new position or size moves the panel straight there.
|
|
973
|
-
isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
|
|
974
|
-
isInline && \`\${P}-panel-inline\`,
|
|
975
|
-
isCopy && \`\${P}-panel-copy\`,
|
|
976
|
-
)}
|
|
977
|
-
style={{
|
|
978
|
-
width: scaled(panelWidth),
|
|
979
|
-
paddingTop: scaled(panelPadding.top),
|
|
980
|
-
paddingRight: scaled(panelPadding.right),
|
|
981
|
-
paddingBottom: scaled(panelPadding.bottom),
|
|
982
|
-
paddingLeft: scaled(panelPadding.left),
|
|
983
|
-
borderRadius: scaled(panelRadius),
|
|
984
|
-
[\`--\${P}-group-gap\`]: scaled(groupGap),
|
|
985
|
-
[\`--\${P}-panel-x\`]: panelOffset.x,
|
|
986
|
-
[\`--\${P}-panel-y\`]: panelOffset.y,
|
|
987
|
-
[\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
|
|
988
|
-
[\`--\${P}-column-gap\`]: scaled(columnGap),
|
|
989
|
-
...(isCopy && copyRect ? { top: copyRect.top, left: copyRect.left, width: copyRect.width } : {}),
|
|
990
|
-
} as CSSProperties}
|
|
991
|
-
data-lightbox-scrollable={isInline ? undefined : ''}
|
|
992
|
-
aria-hidden={isCopy || undefined}
|
|
993
|
-
onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
|
|
994
|
-
onClickCapture={isCopy ? undefined : onPanelClickCapture}
|
|
995
|
-
>
|
|
996
|
-
{!isCopy && showPanelControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
|
|
997
|
-
{!isCopy && showPanelControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
|
|
998
|
-
{groups.map((group, groupIndex) => (
|
|
999
|
-
<Fragment key={groupIndex}>
|
|
1000
|
-
{!isCopy && showPanelControls && groupIndex > 0 && (
|
|
1001
|
-
// Left at its static top, the anchor sits right where the gap above this group starts.
|
|
1002
|
-
<div
|
|
1003
|
-
data-controls="groupGap"
|
|
1004
|
-
data-controls-paired=""
|
|
1005
|
-
data-controls-axis="y"
|
|
1006
|
-
data-controls-reverse=""
|
|
1007
|
-
data-controls-min="0"
|
|
1008
|
-
className={\`\${P}-control-anchor\`}
|
|
1009
|
-
style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, PADDING_HANDLE_SIZE)) }}
|
|
1010
|
-
/>
|
|
1011
|
-
)}
|
|
1012
|
-
{/* The label spans its group's rows, so its line height spaces only its own lines, never the rows beside it;
|
|
1013
|
-
a label longer than its rows grows the last track, below them. */}
|
|
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 }}
|
|
1022
|
-
>
|
|
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
|
-
})}
|
|
1053
|
-
</div>
|
|
1054
|
-
</Fragment>
|
|
1055
|
-
))}
|
|
1056
|
-
</div>
|
|
1057
|
-
);
|
|
1058
|
-
|
|
1059
|
-
const overlay = isOverlayMounted ? (
|
|
1060
|
-
<div
|
|
1061
|
-
ref={overlayRef}
|
|
1062
|
-
className={cn(
|
|
1063
|
-
\`\${P}-overlay\`,
|
|
1064
|
-
isEditor && \`\${P}-overlay-editor\`,
|
|
1065
|
-
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
1066
|
-
isOverlayActive && \`\${P}-overlay-active\`,
|
|
1067
|
-
interactiveClass,
|
|
1068
|
-
stateClass,
|
|
1069
|
-
)}
|
|
1070
|
-
style={{ ...colorVars, ...layoutStyle }}
|
|
1071
|
-
role="dialog"
|
|
1072
|
-
aria-modal="true"
|
|
1073
|
-
aria-label={triggerLabel}
|
|
1074
|
-
data-selection="none"
|
|
1075
|
-
>
|
|
1076
|
-
<div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
|
|
1077
|
-
{mediaLayer}
|
|
1078
|
-
<button
|
|
1079
|
-
ref={closeRef}
|
|
1080
|
-
type="button"
|
|
1081
|
-
className={\`\${P}-close\`}
|
|
1082
|
-
style={{
|
|
1083
|
-
...triggerTypographyCss,
|
|
1084
|
-
top: closePosition?.top ?? 0,
|
|
1085
|
-
left: closePosition?.left ?? 0,
|
|
1086
|
-
visibility: closePosition ? 'visible' : 'hidden',
|
|
1087
|
-
}}
|
|
1088
|
-
onClick={close}
|
|
1089
|
-
>
|
|
1090
|
-
{closeLabel}
|
|
1091
|
-
</button>
|
|
1092
|
-
{renderPanel(false)}
|
|
1093
|
-
</div>
|
|
1094
|
-
) : null;
|
|
1095
|
-
|
|
1096
|
-
const inlineLayer = isInline && mountedMedia.size > 0 ? (
|
|
1097
|
-
<div
|
|
1098
|
-
ref={inlineLayerRef}
|
|
1099
|
-
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
|
|
1100
|
-
style={{ ...colorVars, ...layoutStyle }}
|
|
1101
|
-
aria-hidden="true"
|
|
1102
|
-
data-selection="none"
|
|
1103
|
-
>
|
|
1104
|
-
{mediaLayer}
|
|
1105
|
-
{copyRect && renderPanel(true)}
|
|
1106
|
-
</div>
|
|
1107
|
-
) : null;
|
|
1108
|
-
const portalContent = overlay ?? inlineLayer;
|
|
1109
|
-
|
|
1110
|
-
return (
|
|
1111
|
-
<>
|
|
1112
|
-
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
1113
|
-
<div
|
|
1114
|
-
ref={wrapperRef}
|
|
1115
|
-
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
|
|
1116
|
-
style={colorVars}
|
|
1117
|
-
>
|
|
1118
|
-
{isInline ? renderPanel(false) : (
|
|
1119
|
-
// The overlay lets the page show through, so the label fades out with it rather than sit under the close.
|
|
1120
|
-
// Only faded, it keeps the component's size and can still take focus back on close.
|
|
1121
|
-
<button
|
|
1122
|
-
ref={triggerRef}
|
|
1123
|
-
type="button"
|
|
1124
|
-
className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
|
|
1125
|
-
style={triggerTypographyCss}
|
|
1126
|
-
aria-haspopup="dialog"
|
|
1127
|
-
aria-expanded={isOpen}
|
|
1128
|
-
onClick={() => {
|
|
1129
|
-
if (isInteractive) setIsOpen(true);
|
|
1130
|
-
}}
|
|
1131
|
-
>
|
|
1132
|
-
{triggerLabel}
|
|
1133
|
-
</button>
|
|
1134
|
-
)}
|
|
1135
|
-
</div>
|
|
1136
|
-
{portalContent && typeof document !== 'undefined' && createPortal(
|
|
1137
|
-
portalContent,
|
|
1138
|
-
(portalId ? document.getElementById(portalId) : null) ?? document.body,
|
|
1139
|
-
)}
|
|
1140
|
-
</>
|
|
1141
|
-
);
|
|
1142
|
-
}
|
|
1143
|
-
`, w = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
1
|
+
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, B as b } from "./PretextComponent-BiS9XbZr.mjs";
|
|
2
|
+
const y = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
1144
3
|
import { CommonComponentProps } from '../props';
|
|
1145
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
1146
5
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -1199,6 +58,7 @@ type BurgerPosition =
|
|
|
1199
58
|
type BurgerSettings = {
|
|
1200
59
|
link?: BurgerLink[];
|
|
1201
60
|
logo?: BurgerLogo | null;
|
|
61
|
+
logoLink?: string;
|
|
1202
62
|
logoMaxWidth?: number;
|
|
1203
63
|
logoMaxHeight?: number;
|
|
1204
64
|
logoPosition?: BurgerLogoPosition;
|
|
@@ -1292,7 +152,7 @@ function resolveCurrentState(value?: string | null): BurgerVisualState | undefin
|
|
|
1292
152
|
return undefined;
|
|
1293
153
|
}
|
|
1294
154
|
|
|
1295
|
-
type BurgerShowIn = 'always' | 'open only' | 'open and compact' | 'default and open' | 'default and compact';
|
|
155
|
+
type BurgerShowIn = 'always' | 'open only' | 'default only' | 'open and compact' | 'default and open' | 'default and compact';
|
|
1296
156
|
|
|
1297
157
|
function resolveLogoPosition(value?: string): BurgerLogoPosition {
|
|
1298
158
|
if (value === 'center' || value === 'right') return value;
|
|
@@ -1330,6 +190,7 @@ function pickShowIn(value?: BurgerShowInValue, layoutId?: string): string | unde
|
|
|
1330
190
|
function resolveShowIn(value?: BurgerShowInValue, layoutId?: string): BurgerShowIn {
|
|
1331
191
|
const showIn = (pickShowIn(value, layoutId) ?? 'always').trim().toLowerCase().replace(/[_-]+/g, ' ');
|
|
1332
192
|
if (showIn === 'open only' || showIn === 'openonly') return 'open only';
|
|
193
|
+
if (showIn === 'default only' || showIn === 'defaultonly') return 'default only';
|
|
1333
194
|
if (showIn === 'open and compact' || showIn === 'openandcompact') return 'open and compact';
|
|
1334
195
|
if (showIn === 'default and open' || showIn === 'defaultandopen') return 'default and open';
|
|
1335
196
|
if (showIn === 'default and compact' || showIn === 'defaultandcompact') return 'default and compact';
|
|
@@ -1340,6 +201,8 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
1340
201
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
1341
202
|
case 'open only':
|
|
1342
203
|
return false;
|
|
204
|
+
case 'default only':
|
|
205
|
+
return navigationState === 'default';
|
|
1343
206
|
case 'open and compact':
|
|
1344
207
|
return navigationState === 'compact';
|
|
1345
208
|
case 'default and compact':
|
|
@@ -1353,6 +216,7 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
1353
216
|
|
|
1354
217
|
function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
1355
218
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
219
|
+
case 'default only':
|
|
1356
220
|
case 'default and compact':
|
|
1357
221
|
return false;
|
|
1358
222
|
default:
|
|
@@ -1360,6 +224,12 @@ function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
|
1360
224
|
}
|
|
1361
225
|
}
|
|
1362
226
|
|
|
227
|
+
/** The open menu is unavailable when every link is shown in the default state only. */
|
|
228
|
+
export function isBurgerOpenMenuAvailable(links: unknown, layoutId?: string): boolean {
|
|
229
|
+
if (!Array.isArray(links) || links.length === 0) return true;
|
|
230
|
+
return (links as BurgerLink[]).some((item) => resolveShowIn(item?.showIn, layoutId) !== 'default only');
|
|
231
|
+
}
|
|
232
|
+
|
|
1363
233
|
type BurgerPageRef = {
|
|
1364
234
|
id: string;
|
|
1365
235
|
slug: string;
|
|
@@ -1415,6 +285,13 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
1415
285
|
return { type: 'page', value: item.page ?? '', target, anchor: item.anchor };
|
|
1416
286
|
}
|
|
1417
287
|
|
|
288
|
+
function normalizeLogoHref(value: string): string {
|
|
289
|
+
if (/^[a-z][a-z\\d+\\-.]*:/i.test(value) || value.startsWith('/') || value.startsWith('#')) {
|
|
290
|
+
return value;
|
|
291
|
+
}
|
|
292
|
+
return \`https://\${value}\`;
|
|
293
|
+
}
|
|
294
|
+
|
|
1418
295
|
function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
1419
296
|
label: string;
|
|
1420
297
|
href: string;
|
|
@@ -2443,6 +1320,14 @@ function getCSS(P: string): string {
|
|
|
2443
1320
|
right: 0;
|
|
2444
1321
|
transform: none;
|
|
2445
1322
|
}
|
|
1323
|
+
.\${P}-nav-logo-link {
|
|
1324
|
+
display: flex;
|
|
1325
|
+
align-items: center;
|
|
1326
|
+
height: 100%;
|
|
1327
|
+
color: inherit;
|
|
1328
|
+
text-decoration: none;
|
|
1329
|
+
cursor: pointer;
|
|
1330
|
+
}
|
|
2446
1331
|
.\${P}-nav-logo-inner {
|
|
2447
1332
|
position: relative;
|
|
2448
1333
|
flex-shrink: 0;
|
|
@@ -3039,8 +1924,9 @@ export function Burger({
|
|
|
3039
1924
|
const pinnedState = resolveCurrentState(currentStateProp);
|
|
3040
1925
|
const unavailableStateSet = useMemo(() => new Set(unavailableStates), [unavailableStates]);
|
|
3041
1926
|
const isStateUnavailable = (state?: string | null) => Boolean(state && unavailableStateSet.has(state));
|
|
1927
|
+
const isOpenMenuAvailable = isBurgerOpenMenuAvailable(settingsProp.link, layoutId);
|
|
3042
1928
|
const isOpenPinned = Boolean(isEditor && !isPreviewMode && pinnedState === 'open' && !isStateUnavailable('open'));
|
|
3043
|
-
const isOpen = isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser);
|
|
1929
|
+
const isOpen = isOpenMenuAvailable && (isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser));
|
|
3044
1930
|
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
3045
1931
|
const shouldLockScroll = isOpen && !isEditorCanvas;
|
|
3046
1932
|
useLightboxScrollLock(shouldLockScroll);
|
|
@@ -3073,6 +1959,7 @@ export function Burger({
|
|
|
3073
1959
|
|
|
3074
1960
|
const {
|
|
3075
1961
|
logo,
|
|
1962
|
+
logoLink = '',
|
|
3076
1963
|
logoMaxHeight = 120 / 1440,
|
|
3077
1964
|
logoPosition = 'left',
|
|
3078
1965
|
panelHeight = 60 / 1440,
|
|
@@ -3166,7 +2053,7 @@ export function Burger({
|
|
|
3166
2053
|
const closedNavPaddingRight = isCompactNav ? compactNavPaddingRight : navPaddingRight;
|
|
3167
2054
|
|
|
3168
2055
|
const resolvedNavTextWidth = closedNavTextWidth ?? textWidth;
|
|
3169
|
-
const showBurgerButton = isOpen || (isCompactNav ? compactShowIcon : showIcon) !== 'off';
|
|
2056
|
+
const showBurgerButton = isOpen || (isOpenMenuAvailable && (isCompactNav ? compactShowIcon : showIcon) !== 'off');
|
|
3170
2057
|
|
|
3171
2058
|
const colorVars = buildColorVars(P, {
|
|
3172
2059
|
iconColor,
|
|
@@ -3353,6 +2240,9 @@ export function Burger({
|
|
|
3353
2240
|
const tintLogo = Boolean(logoMaskUrl);
|
|
3354
2241
|
const logoHeight = scaled(Math.min(closedLogoMaxHeight, closedPanelHeight));
|
|
3355
2242
|
const isLogoOnRight = Boolean(showLogo && logoSrc && closedLogoPosition === 'right');
|
|
2243
|
+
const logoLinkItem: BurgerLink | null = logoLink.trim()
|
|
2244
|
+
? { link: { type: 'url', value: normalizeLogoHref(logoLink.trim()), target: 'self' } }
|
|
2245
|
+
: null;
|
|
3356
2246
|
const toggleSide = isLogoOnRight ? 'left' : 'right';
|
|
3357
2247
|
|
|
3358
2248
|
const items = Array.isArray(linkItems) ? linkItems : [];
|
|
@@ -3703,6 +2593,23 @@ export function Burger({
|
|
|
3703
2593
|
);
|
|
3704
2594
|
};
|
|
3705
2595
|
|
|
2596
|
+
const logoNode = (
|
|
2597
|
+
<div
|
|
2598
|
+
className={\`\${P}-nav-logo-inner\${tintLogo ? \` \${P}-nav-logo-tinted\` : ''}\`}
|
|
2599
|
+
style={{
|
|
2600
|
+
height: logoHeight,
|
|
2601
|
+
...(tintLogo && logoMaskUrl ? { [\`--\${P}-logo-image\`]: cssMaskImageUrl(logoMaskUrl) } : {}),
|
|
2602
|
+
} as CSSProperties}
|
|
2603
|
+
>
|
|
2604
|
+
<img
|
|
2605
|
+
src={tintLogo && logoMaskUrl ? logoMaskUrl : logoSrc}
|
|
2606
|
+
alt=""
|
|
2607
|
+
className={\`\${P}-nav-logo-img\`}
|
|
2608
|
+
/>
|
|
2609
|
+
{tintLogo ? <span className={\`\${P}-nav-logo-tint\`} aria-hidden="true" /> : null}
|
|
2610
|
+
</div>
|
|
2611
|
+
);
|
|
2612
|
+
|
|
3706
2613
|
const navBarStyle: CSSProperties = {
|
|
3707
2614
|
...colorVars,
|
|
3708
2615
|
height: scalingValue(closedPanelHeight, isEditor),
|
|
@@ -3737,20 +2644,16 @@ export function Burger({
|
|
|
3737
2644
|
{showLogo && logoSrc ? (
|
|
3738
2645
|
<div className={\`\${P}-nav-logo \${P}-nav-logo-\${closedLogoPosition}\`}>
|
|
3739
2646
|
{closedLogoPosition === 'left' ? renderNavEdgePadding('left') : null}
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
className={\`\${P}-nav-logo-img\`}
|
|
3751
|
-
/>
|
|
3752
|
-
{tintLogo ? <span className={\`\${P}-nav-logo-tint\`} aria-hidden="true" /> : null}
|
|
3753
|
-
</div>
|
|
2647
|
+
{logoLinkItem ? (
|
|
2648
|
+
<a
|
|
2649
|
+
href={logoLinkItem.link?.value}
|
|
2650
|
+
className={\`\${P}-nav-logo-link\`}
|
|
2651
|
+
aria-label="Home"
|
|
2652
|
+
onClick={(event) => onNavLinkClick(event, logoLinkItem)}
|
|
2653
|
+
>
|
|
2654
|
+
{logoNode}
|
|
2655
|
+
</a>
|
|
2656
|
+
) : logoNode}
|
|
3754
2657
|
{closedLogoPosition === 'right' ? renderNavEdgePadding('right') : null}
|
|
3755
2658
|
</div>
|
|
3756
2659
|
) : null}
|
|
@@ -3781,7 +2684,7 @@ export function Burger({
|
|
|
3781
2684
|
</div>
|
|
3782
2685
|
);
|
|
3783
2686
|
}
|
|
3784
|
-
`,
|
|
2687
|
+
`, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3785
2688
|
import { CommonComponentProps } from '../props';
|
|
3786
2689
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3787
2690
|
|
|
@@ -4310,7 +3213,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4310
3213
|
</>
|
|
4311
3214
|
);
|
|
4312
3215
|
}
|
|
4313
|
-
`,
|
|
3216
|
+
`, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4314
3217
|
import cn from 'classnames';
|
|
4315
3218
|
import { CommonComponentProps } from '../props';
|
|
4316
3219
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -5058,7 +3961,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
5058
3961
|
</>
|
|
5059
3962
|
);
|
|
5060
3963
|
}
|
|
5061
|
-
`,
|
|
3964
|
+
`, C = `import React, { useMemo, useState } from 'react';
|
|
5062
3965
|
import { CommonComponentProps } from '../props';
|
|
5063
3966
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
5064
3967
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5696,7 +4599,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5696
4599
|
};
|
|
5697
4600
|
|
|
5698
4601
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5699
|
-
`,
|
|
4602
|
+
`, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5700
4603
|
import '@splidejs/react-splide/css/core';
|
|
5701
4604
|
import { CommonComponentProps } from '../props';
|
|
5702
4605
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -8011,7 +6914,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
8011
6914
|
};
|
|
8012
6915
|
|
|
8013
6916
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
8014
|
-
`,
|
|
6917
|
+
`, I = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
8015
6918
|
import { CommonComponentProps } from '../props';
|
|
8016
6919
|
import { scalingValue } from '../utils/scalingValue';
|
|
8017
6920
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8584,7 +7487,7 @@ export function Helix({
|
|
|
8584
7487
|
</>
|
|
8585
7488
|
);
|
|
8586
7489
|
}
|
|
8587
|
-
`,
|
|
7490
|
+
`, T = `import { CommonComponentProps } from '../props';
|
|
8588
7491
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8589
7492
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8590
7493
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -8595,6 +7498,7 @@ import {
|
|
|
8595
7498
|
type HiveLightboxTitleSettings,
|
|
8596
7499
|
} from './HiveLightboxTitles';
|
|
8597
7500
|
import { getDisplayedImageRect } from '../utils/getImageRect';
|
|
7501
|
+
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
8598
7502
|
|
|
8599
7503
|
function sv(px: number): string {
|
|
8600
7504
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -8921,6 +7825,13 @@ function getCSS(P: string): string {
|
|
|
8921
7825
|
pointer-events: auto;
|
|
8922
7826
|
flex-shrink: 0;
|
|
8923
7827
|
}
|
|
7828
|
+
.\${P}-item-text {
|
|
7829
|
+
flex-shrink: 0;
|
|
7830
|
+
margin: 0;
|
|
7831
|
+
white-space: normal;
|
|
7832
|
+
overflow-wrap: anywhere;
|
|
7833
|
+
word-break: break-word;
|
|
7834
|
+
}
|
|
8924
7835
|
\`;
|
|
8925
7836
|
}
|
|
8926
7837
|
|
|
@@ -8933,8 +7844,20 @@ type GridLayoutConfig = {
|
|
|
8933
7844
|
};
|
|
8934
7845
|
|
|
8935
7846
|
type HiveSettings = {
|
|
7847
|
+
type?: 'a' | 'b';
|
|
8936
7848
|
gridLayout: GridLayoutConfig;
|
|
8937
7849
|
verticalGap: number;
|
|
7850
|
+
textBoxWidth?: number;
|
|
7851
|
+
textMarginTop?: number;
|
|
7852
|
+
entryTitleColor?: string;
|
|
7853
|
+
entryTitleFontFamily?: string;
|
|
7854
|
+
entryTitleFontSettings?: { fontWeight: number; fontStyle: string };
|
|
7855
|
+
entryTitleFontSize?: number;
|
|
7856
|
+
entryTitleLineHeight?: number;
|
|
7857
|
+
entryTitleLetterSpacing?: number;
|
|
7858
|
+
entryTitleWordSpacing?: number;
|
|
7859
|
+
entryTitleTextAlign?: TextStyles['textAlign'];
|
|
7860
|
+
entryTitleTextAppearance?: TextStyles['textAppearance'];
|
|
8938
7861
|
align?: 'top' | 'center' | 'bottom';
|
|
8939
7862
|
imageDisplay: {
|
|
8940
7863
|
display: 'fit' | 'cover';
|
|
@@ -10725,7 +9648,16 @@ export function Hive({
|
|
|
10725
9648
|
portalId,
|
|
10726
9649
|
}: HiveProps) {
|
|
10727
9650
|
const { prefix: P } = useScopedStyles();
|
|
10728
|
-
const {
|
|
9651
|
+
const {
|
|
9652
|
+
type = 'a',
|
|
9653
|
+
gridLayout,
|
|
9654
|
+
verticalGap,
|
|
9655
|
+
textBoxWidth = 100,
|
|
9656
|
+
textMarginTop = 0,
|
|
9657
|
+
align = 'top',
|
|
9658
|
+
imageDisplay,
|
|
9659
|
+
} = settings;
|
|
9660
|
+
const showEntryText = type === 'b';
|
|
10729
9661
|
|
|
10730
9662
|
const isCover = imageDisplay?.display === 'cover';
|
|
10731
9663
|
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
@@ -10741,6 +9673,27 @@ export function Hive({
|
|
|
10741
9673
|
const horizontalGapScaled = scalingValue(gridLayout.horizontalGap ?? 0, isEditor);
|
|
10742
9674
|
const imageWrapperWidth = entryWidthScaled;
|
|
10743
9675
|
const controlWidthStyle = entryWidthScaled;
|
|
9676
|
+
const textBoxWidthStyle = \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
9677
|
+
const textControlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
9678
|
+
// like Neptune, a text box wider than the entry widens the whole cell so the image stays centered
|
|
9679
|
+
const itemInnerWidth = showEntryText && textBoxWidth > 100 ? textBoxWidthStyle : entryWidthScaled;
|
|
9680
|
+
const entryTextStyle = useMemo(
|
|
9681
|
+
() => textStylesToCss({
|
|
9682
|
+
fontSettings: {
|
|
9683
|
+
fontFamily: settings.entryTitleFontFamily ?? 'Arial',
|
|
9684
|
+
fontWeight: settings.entryTitleFontSettings?.fontWeight ?? 400,
|
|
9685
|
+
fontStyle: settings.entryTitleFontSettings?.fontStyle ?? 'normal',
|
|
9686
|
+
},
|
|
9687
|
+
fontSize: settings.entryTitleFontSize ?? 0.0098,
|
|
9688
|
+
lineHeight: settings.entryTitleLineHeight,
|
|
9689
|
+
letterSpacing: settings.entryTitleLetterSpacing ?? 0,
|
|
9690
|
+
wordSpacing: settings.entryTitleWordSpacing ?? 0,
|
|
9691
|
+
textAlign: settings.entryTitleTextAlign ?? 'left',
|
|
9692
|
+
textAppearance: settings.entryTitleTextAppearance,
|
|
9693
|
+
color: settings.entryTitleColor ?? '#000000',
|
|
9694
|
+
}, isEditor),
|
|
9695
|
+
[settings, isEditor],
|
|
9696
|
+
);
|
|
10744
9697
|
|
|
10745
9698
|
const imageWrapperStyle: React.CSSProperties = {
|
|
10746
9699
|
width: imageWrapperWidth,
|
|
@@ -10925,7 +9878,7 @@ export function Hive({
|
|
|
10925
9878
|
isLastRow ? \`\${P}-item-inner-last-row\` : '',
|
|
10926
9879
|
].filter(Boolean).join(' ')}
|
|
10927
9880
|
style={{
|
|
10928
|
-
width:
|
|
9881
|
+
width: itemInnerWidth,
|
|
10929
9882
|
...(gridColumn ? { gridColumn } : {}),
|
|
10930
9883
|
}}
|
|
10931
9884
|
>
|
|
@@ -10936,7 +9889,20 @@ export function Hive({
|
|
|
10936
9889
|
{imageContent}
|
|
10937
9890
|
</a>
|
|
10938
9891
|
<div className={\`\${P}-item-subtitle-row\`}>
|
|
10939
|
-
|
|
9892
|
+
{showEntryText && item.title1?.trim() ? (
|
|
9893
|
+
<>
|
|
9894
|
+
<div
|
|
9895
|
+
data-controls={isEditMode ? 'textMarginTop' : undefined}
|
|
9896
|
+
className={isEditMode ? \`\${P}-control\` : undefined}
|
|
9897
|
+
style={{ height: scalingValue(textMarginTop, isEditor), width: textControlWidthStyle }}
|
|
9898
|
+
/>
|
|
9899
|
+
<p className={\`\${P}-item-text\`} style={{ ...entryTextStyle, width: textBoxWidthStyle }}>
|
|
9900
|
+
{item.title1}
|
|
9901
|
+
</p>
|
|
9902
|
+
</>
|
|
9903
|
+
) : (
|
|
9904
|
+
<div style={{ height: 0, width: controlWidthStyle }} />
|
|
9905
|
+
)}
|
|
10940
9906
|
</div>
|
|
10941
9907
|
</div>
|
|
10942
9908
|
</div>
|
|
@@ -10973,7 +9939,7 @@ export function Hive({
|
|
|
10973
9939
|
</>
|
|
10974
9940
|
);
|
|
10975
9941
|
}
|
|
10976
|
-
`,
|
|
9942
|
+
`, E = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
10977
9943
|
import { createPortal } from 'react-dom';
|
|
10978
9944
|
import { CommonComponentProps } from '../props';
|
|
10979
9945
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11738,7 +10704,7 @@ export type LightboxJournalSettings = {
|
|
|
11738
10704
|
closeIconColor: string;
|
|
11739
10705
|
closeIconHoverColor: string;
|
|
11740
10706
|
};
|
|
11741
|
-
`,
|
|
10707
|
+
`, R = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11742
10708
|
import { createPortal } from 'react-dom';
|
|
11743
10709
|
import { CommonComponentProps } from '../props';
|
|
11744
10710
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12284,7 +11250,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12284
11250
|
</>
|
|
12285
11251
|
);
|
|
12286
11252
|
};
|
|
12287
|
-
`,
|
|
11253
|
+
`, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12288
11254
|
import { createPortal } from 'react-dom';
|
|
12289
11255
|
import { CommonComponentProps } from '../props';
|
|
12290
11256
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15389,7 +14355,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15389
14355
|
</>
|
|
15390
14356
|
);
|
|
15391
14357
|
}
|
|
15392
|
-
`,
|
|
14358
|
+
`, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15393
14359
|
import cn from 'classnames';
|
|
15394
14360
|
import { CommonComponentProps } from '../props';
|
|
15395
14361
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16247,7 +15213,7 @@ type MarqueeProps = {
|
|
|
16247
15213
|
isPreviewMode?: boolean;
|
|
16248
15214
|
isEditMode?: boolean;
|
|
16249
15215
|
} & CommonComponentProps;
|
|
16250
|
-
`,
|
|
15216
|
+
`, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16251
15217
|
import cn from 'classnames';
|
|
16252
15218
|
import { CommonComponentProps } from '../props';
|
|
16253
15219
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17190,7 +16156,7 @@ type MarqueeTextProps = {
|
|
|
17190
16156
|
isPreviewMode?: boolean;
|
|
17191
16157
|
isEditMode?: boolean;
|
|
17192
16158
|
} & CommonComponentProps;
|
|
17193
|
-
`,
|
|
16159
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17194
16160
|
import { createPortal } from 'react-dom';
|
|
17195
16161
|
import type React from 'react';
|
|
17196
16162
|
import { CommonComponentProps } from '../props';
|
|
@@ -19672,7 +18638,7 @@ export function Mercury({
|
|
|
19672
18638
|
</>
|
|
19673
18639
|
);
|
|
19674
18640
|
}
|
|
19675
|
-
`,
|
|
18641
|
+
`, N = `import React, { useMemo, useState } from 'react';
|
|
19676
18642
|
import { CommonComponentProps } from '../props';
|
|
19677
18643
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19678
18644
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20251,7 +19217,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20251
19217
|
};
|
|
20252
19218
|
|
|
20253
19219
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20254
|
-
`,
|
|
19220
|
+
`, H = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20255
19221
|
import type React from 'react';
|
|
20256
19222
|
import { CommonComponentProps } from '../props';
|
|
20257
19223
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21090,7 +20056,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21090
20056
|
</>
|
|
21091
20057
|
);
|
|
21092
20058
|
}
|
|
21093
|
-
`,
|
|
20059
|
+
`, O = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21094
20060
|
import cn from 'classnames';
|
|
21095
20061
|
import { CommonComponentProps } from '../props';
|
|
21096
20062
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -21718,7 +20684,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21718
20684
|
</>
|
|
21719
20685
|
);
|
|
21720
20686
|
}
|
|
21721
|
-
`,
|
|
20687
|
+
`, F = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21722
20688
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21723
20689
|
import { CommonComponentProps } from '../props';
|
|
21724
20690
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22350,7 +21316,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22350
21316
|
</>
|
|
22351
21317
|
);
|
|
22352
21318
|
}
|
|
22353
|
-
`,
|
|
21319
|
+
`, _ = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22354
21320
|
import cn from 'classnames';
|
|
22355
21321
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22356
21322
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23532,7 +22498,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23532
22498
|
</svg>
|
|
23533
22499
|
);
|
|
23534
22500
|
}
|
|
23535
|
-
`,
|
|
22501
|
+
`, W = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23536
22502
|
import cn from 'classnames';
|
|
23537
22503
|
import { CommonComponentProps } from '../props';
|
|
23538
22504
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24163,7 +23129,7 @@ type TestimonialsSettings = {
|
|
|
24163
23129
|
logoHeight: number;
|
|
24164
23130
|
captionMarginTop: number;
|
|
24165
23131
|
};
|
|
24166
|
-
`,
|
|
23132
|
+
`, D = `import cn from 'classnames';
|
|
24167
23133
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24168
23134
|
import { CommonComponentProps } from '../props';
|
|
24169
23135
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24659,7 +23625,7 @@ type TestimonialsSettings = {
|
|
|
24659
23625
|
icon?: string | null;
|
|
24660
23626
|
};
|
|
24661
23627
|
};
|
|
24662
|
-
`,
|
|
23628
|
+
`, B = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24663
23629
|
import type React from 'react';
|
|
24664
23630
|
import { createPortal } from 'react-dom';
|
|
24665
23631
|
import { CommonComponentProps } from '../props';
|
|
@@ -25192,30 +24158,29 @@ export function Waterfall({
|
|
|
25192
24158
|
</>
|
|
25193
24159
|
);
|
|
25194
24160
|
}
|
|
25195
|
-
`,
|
|
25196
|
-
[
|
|
25197
|
-
[
|
|
25198
|
-
[
|
|
25199
|
-
[
|
|
25200
|
-
[
|
|
25201
|
-
[
|
|
25202
|
-
[
|
|
25203
|
-
[
|
|
25204
|
-
[
|
|
25205
|
-
[
|
|
25206
|
-
[
|
|
25207
|
-
[
|
|
25208
|
-
[
|
|
25209
|
-
[
|
|
25210
|
-
[
|
|
25211
|
-
[
|
|
25212
|
-
[
|
|
25213
|
-
[
|
|
25214
|
-
[
|
|
25215
|
-
[
|
|
25216
|
-
[
|
|
25217
|
-
[n.id]: V
|
|
24161
|
+
`, V = {
|
|
24162
|
+
[b.id]: y,
|
|
24163
|
+
[x.id]: S,
|
|
24164
|
+
[P.id]: w,
|
|
24165
|
+
[v.id]: C,
|
|
24166
|
+
[f.id]: $,
|
|
24167
|
+
[h.id]: I,
|
|
24168
|
+
[p.id]: T,
|
|
24169
|
+
[m.id]: E,
|
|
24170
|
+
[g.id]: R,
|
|
24171
|
+
[u.id]: M,
|
|
24172
|
+
[d.id]: L,
|
|
24173
|
+
[c.id]: k,
|
|
24174
|
+
[l.id]: A,
|
|
24175
|
+
[s.id]: N,
|
|
24176
|
+
[a.id]: H,
|
|
24177
|
+
[r.id]: O,
|
|
24178
|
+
[o.id]: F,
|
|
24179
|
+
[i.id]: _,
|
|
24180
|
+
[t.id]: W,
|
|
24181
|
+
[e.id]: D,
|
|
24182
|
+
[n.id]: B
|
|
25218
24183
|
};
|
|
25219
24184
|
export {
|
|
25220
|
-
|
|
24185
|
+
V as componentSources
|
|
25221
24186
|
};
|