@cntrl-site/components 1.0.107-alpha.4 → 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/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/Hive-CzabuuCc.js +328 -0
- package/dist/Hive-DyxYd5eg.mjs +1504 -0
- package/dist/{ArchivePopupComponent-DA_D-g4H.mjs → PretextComponent-BiS9XbZr.mjs} +614 -904
- package/dist/PretextComponent-DWOy-dqD.js +1 -0
- package/dist/components-CJlisugq.js +1 -0
- package/dist/{components-TTO7gMs8.mjs → components-ljYgHKal.mjs} +11 -12
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +7 -8
- 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 -1114
- package/dist/sources.mjs +172 -1138
- package/dist/types/Component.d.ts +5 -0
- package/package.json +1 -1
- package/dist/ArchivePopup-BxBwrctO.mjs +0 -746
- package/dist/ArchivePopup-Dc2eKEqf.js +0 -190
- package/dist/ArchivePopupComponent-BWLaTjap.js +0 -1
- package/dist/Burger-C6jI6C1c.js +0 -661
- package/dist/Components/ArchivePopup/ArchivePopup.d.ts +0 -160
- package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +0 -298
- package/dist/Hive-BsmFHk2i.mjs +0 -1458
- package/dist/Hive-D1j6wZpV.js +0 -321
- package/dist/components-D_zkX3D5.js +0 -1
package/dist/sources.mjs
CHANGED
|
@@ -1,1077 +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 } from '../utils/index';
|
|
7
|
-
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
8
|
-
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
9
|
-
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
10
|
-
|
|
11
|
-
type ArchivePopupMedia = {
|
|
12
|
-
assetId: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
type?: 'image' | 'video';
|
|
15
|
-
objectFit?: 'cover' | 'contain';
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** Columns count the group column too; 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
|
-
type ArchivePopupTitle = any[] | string;
|
|
57
|
-
|
|
58
|
-
export type ArchivePopupContentItem = {
|
|
59
|
-
group?: string;
|
|
60
|
-
/** Rich text, so parts of a title can be linked; a plain string is still shown as is. */
|
|
61
|
-
title?: ArchivePopupTitle;
|
|
62
|
-
title2?: ArchivePopupTitle;
|
|
63
|
-
title3?: ArchivePopupTitle;
|
|
64
|
-
title4?: ArchivePopupTitle;
|
|
65
|
-
/** The row's hover images, shown in turn while it is hovered; a row saved before there could be several holds just one. */
|
|
66
|
-
image?: ArchivePopupMedia | ArchivePopupMedia[];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
type FontSettings = { fontWeight: number; fontStyle: string };
|
|
70
|
-
|
|
71
|
-
type Padding = { top: number; right: number; bottom: number; left: number };
|
|
72
|
-
|
|
73
|
-
/** A text style as settings hold it, each field under the name of what it styles, e.g. \`triggerFontSize\`. */
|
|
74
|
-
type TextStyleFields = {
|
|
75
|
-
FontFamily?: string;
|
|
76
|
-
FontSettings?: FontSettings;
|
|
77
|
-
FontSize?: number;
|
|
78
|
-
LineHeight?: number;
|
|
79
|
-
LetterSpacing?: number;
|
|
80
|
-
WordSpacing?: number;
|
|
81
|
-
TextAlign?: TextStyles['textAlign'];
|
|
82
|
-
TextAppearance?: TextStyles['textAppearance'];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
type PrefixedTextStyle<Prefix extends string> = {
|
|
86
|
-
[Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]?: TextStyleFields[Key];
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
|
|
90
|
-
& PrefixedTextStyle<ArchivePopupColumnStylePrefix>
|
|
91
|
-
// One style every column shared before each had its own; a column with no style of its own still shows it.
|
|
92
|
-
& PrefixedTextStyle<'list'>
|
|
93
|
-
& {
|
|
94
|
-
/** \`a\` is always open, in place on the page; \`b\` opens from a label. */
|
|
95
|
-
type?: 'a' | 'b';
|
|
96
|
-
triggerLabel?: string;
|
|
97
|
-
closeLabel?: string;
|
|
98
|
-
/** Every column of a row, the group column included. */
|
|
99
|
-
columns?: number;
|
|
100
|
-
columnGap?: number;
|
|
101
|
-
column1Width?: number;
|
|
102
|
-
column2Width?: number;
|
|
103
|
-
column3Width?: number;
|
|
104
|
-
column4Width?: number;
|
|
105
|
-
/** How long each of a hovered row's images shows before the next, in ms. */
|
|
106
|
-
hoverInterval?: number;
|
|
107
|
-
/** B only: A's panel stays where it is placed on the page. */
|
|
108
|
-
panelPosition?: string;
|
|
109
|
-
panelWidth?: number;
|
|
110
|
-
panelPadding?: Padding;
|
|
111
|
-
panelRadius?: number;
|
|
112
|
-
groupGap?: number;
|
|
113
|
-
triggerColor?: string;
|
|
114
|
-
triggerHoverColor?: string;
|
|
115
|
-
closeColor?: string;
|
|
116
|
-
closeHoverColor?: string;
|
|
117
|
-
panelColor?: string;
|
|
118
|
-
textColor?: string;
|
|
119
|
-
textHoverColor?: string;
|
|
120
|
-
overlayColor?: string;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
type ArchivePopupProps = {
|
|
124
|
-
settings: ArchivePopupSettings;
|
|
125
|
-
content?: ArchivePopupContentItem[];
|
|
126
|
-
isEditor?: boolean;
|
|
127
|
-
isEditMode?: boolean;
|
|
128
|
-
isPreviewMode?: boolean;
|
|
129
|
-
activeEvent?: string;
|
|
130
|
-
portalId?: string;
|
|
131
|
-
} & CommonComponentProps;
|
|
132
|
-
|
|
133
|
-
export type ArchivePopupRow = {
|
|
134
|
-
item: ArchivePopupContentItem;
|
|
135
|
-
index: number;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export type ArchivePopupGroup = {
|
|
139
|
-
label: string;
|
|
140
|
-
rows: ArchivePopupRow[];
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
type ColorKeys =
|
|
144
|
-
| 'triggerColor'
|
|
145
|
-
| 'triggerHoverColor'
|
|
146
|
-
| 'closeColor'
|
|
147
|
-
| 'closeHoverColor'
|
|
148
|
-
| 'panelColor'
|
|
149
|
-
| 'textColor'
|
|
150
|
-
| 'textHoverColor'
|
|
151
|
-
| 'overlayColor';
|
|
152
|
-
|
|
153
|
-
const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
154
|
-
triggerColor: 'trigger-color',
|
|
155
|
-
triggerHoverColor: 'trigger-hover-color',
|
|
156
|
-
closeColor: 'close-color',
|
|
157
|
-
closeHoverColor: 'close-hover-color',
|
|
158
|
-
panelColor: 'panel-color',
|
|
159
|
-
textColor: 'text-color',
|
|
160
|
-
textHoverColor: 'text-hover-color',
|
|
161
|
-
overlayColor: 'overlay-color',
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const STATE_KEYS = ['hover', 'open'] as const;
|
|
165
|
-
|
|
166
|
-
const OVERLAY_ANIM_MS = 300;
|
|
167
|
-
// The least a padding handle is drawn at, so a zero padding can still be grabbed.
|
|
168
|
-
const PADDING_HANDLE_SIZE = 0.004;
|
|
169
|
-
const COLUMN_RESIZE_HANDLE_WIDTH = 0.004;
|
|
170
|
-
// The least a column is dragged down to, in pixels of the layout.
|
|
171
|
-
const MIN_COLUMN_WIDTH_PX = 20;
|
|
172
|
-
const DEFAULT_COLUMN_GAP = 0.0139;
|
|
173
|
-
const DEFAULT_PANEL_WIDTH = 0.3194;
|
|
174
|
-
const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
|
|
175
|
-
const IMAGE_FADE_MS = 300;
|
|
176
|
-
const DEFAULT_HOVER_INTERVAL_MS = 1000;
|
|
177
|
-
|
|
178
|
-
const LIGHTBOX_CSS_VARS = [
|
|
179
|
-
'--cntrl-article-width',
|
|
180
|
-
'--cntrl-article-top',
|
|
181
|
-
'--cntrl-article-left',
|
|
182
|
-
'--cntrl-viewport-height',
|
|
183
|
-
] as const;
|
|
184
|
-
|
|
185
|
-
// A row with an empty group continues the group above it, so the label only has to be typed once.
|
|
186
|
-
type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'>
|
|
187
|
-
& Partial<Record<ArchivePopupColumnWidthKey, number>>;
|
|
188
|
-
|
|
189
|
-
function getColumnCount(columns: number | undefined): number {
|
|
190
|
-
return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_DEFAULT_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** The width a row's columns share: the panel's, less its padding and the gaps between them. */
|
|
194
|
-
function getColumnsSpace(settings: ColumnLayoutSettings): number {
|
|
195
|
-
const { panelWidth = DEFAULT_PANEL_WIDTH, panelPadding = DEFAULT_PANEL_PADDING, columnGap = DEFAULT_COLUMN_GAP } = settings;
|
|
196
|
-
const gaps = (getColumnCount(settings.columns) - 1) * columnGap;
|
|
197
|
-
return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - gaps);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>> {
|
|
201
|
-
const count = getColumnCount(settings.columns);
|
|
202
|
-
const width = getColumnsSpace(settings) / count;
|
|
203
|
-
return Object.fromEntries(ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => [key, width]));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
|
|
208
|
-
* and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
|
|
209
|
-
*/
|
|
210
|
-
export function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[] {
|
|
211
|
-
const count = getColumnCount(settings.columns);
|
|
212
|
-
const space = getColumnsSpace(settings);
|
|
213
|
-
const sized = ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => {
|
|
214
|
-
const width = settings[key];
|
|
215
|
-
return typeof width === 'number' ? Math.max(0, width) : space / count;
|
|
216
|
-
});
|
|
217
|
-
const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
|
|
218
|
-
const scale = sizedTotal > space ? space / sizedTotal : 1;
|
|
219
|
-
const fitted = sized.map((width) => width * scale);
|
|
220
|
-
return [...fitted, Math.max(0, space - sizedTotal * scale)];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** Like Programme, a new column count starts the columns over at equal widths. */
|
|
224
|
-
export function applyArchivePopupColumnCountChange(
|
|
225
|
-
nextSettings: Record<string, any>,
|
|
226
|
-
prevSettings: Record<string, any>,
|
|
227
|
-
): Record<string, any> {
|
|
228
|
-
if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
|
|
229
|
-
return nextSettings;
|
|
230
|
-
}
|
|
231
|
-
return { ...nextSettings, ...getArchivePopupEqualColumnWidths({ ...prevSettings, ...nextSettings }) };
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// The columns stay in proportion when the panel is drawn narrower than its width, on a small screen.
|
|
235
|
-
function getGridTemplateColumns(widths: number[]): string {
|
|
236
|
-
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
237
|
-
return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[] {
|
|
241
|
-
const groups: ArchivePopupGroup[] = [];
|
|
242
|
-
items.forEach((item, index) => {
|
|
243
|
-
const label = item.group?.trim() ?? '';
|
|
244
|
-
const current = groups[groups.length - 1];
|
|
245
|
-
if (!current || (label !== '' && label !== current.label)) {
|
|
246
|
-
groups.push({ label, rows: [{ item, index }] });
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
current.rows.push({ item, index });
|
|
250
|
-
});
|
|
251
|
-
return groups;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export function getArchivePopupRowMedia(item: ArchivePopupContentItem | undefined): ArchivePopupMedia[] {
|
|
255
|
-
const { image } = item ?? {};
|
|
256
|
-
return (Array.isArray(image) ? image : image ? [image] : []).filter((media) => Boolean(media?.assetId));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function isVideoMedia(media: ArchivePopupMedia): boolean {
|
|
260
|
-
if (media.type === 'video') return true;
|
|
261
|
-
if (media.type === 'image') return false;
|
|
262
|
-
return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
266
|
-
let el = element;
|
|
267
|
-
while (el) {
|
|
268
|
-
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) {
|
|
269
|
-
return el;
|
|
270
|
-
}
|
|
271
|
-
el = el.parentElement;
|
|
272
|
-
}
|
|
273
|
-
return element;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function getLightboxLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
277
|
-
const style: Record<string, string> = {};
|
|
278
|
-
const layoutContainer = findLayoutContainer(container);
|
|
279
|
-
if (!layoutContainer) return style;
|
|
280
|
-
const computed = getComputedStyle(layoutContainer);
|
|
281
|
-
for (const varName of LIGHTBOX_CSS_VARS) {
|
|
282
|
-
const value = computed.getPropertyValue(varName).trim();
|
|
283
|
-
if (value) {
|
|
284
|
-
style[varName] = value;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return style;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function resolveTextStyle(settings: ArchivePopupSettings, prefix: string, fallbackPrefix?: string): TextStyles {
|
|
291
|
-
const values = settings as Record<string, unknown>;
|
|
292
|
-
const read = <Key extends keyof TextStyleFields>(key: Key) => (
|
|
293
|
-
values[\`\${prefix}\${key}\`] ?? (fallbackPrefix ? values[\`\${fallbackPrefix}\${key}\`] : undefined)
|
|
294
|
-
) as TextStyleFields[Key];
|
|
295
|
-
const fontSettings = read('FontSettings');
|
|
296
|
-
return {
|
|
297
|
-
fontSettings: {
|
|
298
|
-
fontFamily: read('FontFamily'),
|
|
299
|
-
fontWeight: fontSettings?.fontWeight ?? 400,
|
|
300
|
-
fontStyle: fontSettings?.fontStyle ?? 'normal',
|
|
301
|
-
},
|
|
302
|
-
fontSize: read('FontSize') ?? 0.01,
|
|
303
|
-
lineHeight: read('LineHeight'),
|
|
304
|
-
letterSpacing: read('LetterSpacing') ?? 0,
|
|
305
|
-
wordSpacing: read('WordSpacing') ?? 0,
|
|
306
|
-
textAlign: read('TextAlign'),
|
|
307
|
-
textAppearance: read('TextAppearance'),
|
|
308
|
-
color: '#000000',
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function getCSS(P: string): string {
|
|
313
|
-
return \`
|
|
314
|
-
.\${P}-trigger,
|
|
315
|
-
.\${P}-close {
|
|
316
|
-
display: inline-block;
|
|
317
|
-
margin: 0;
|
|
318
|
-
padding: 0;
|
|
319
|
-
border: 0;
|
|
320
|
-
background: none;
|
|
321
|
-
cursor: pointer;
|
|
322
|
-
white-space: nowrap;
|
|
323
|
-
transition: color 150ms ease;
|
|
324
|
-
-webkit-appearance: none;
|
|
325
|
-
appearance: none;
|
|
326
|
-
-webkit-tap-highlight-color: transparent;
|
|
327
|
-
}
|
|
328
|
-
.\${P}-trigger {
|
|
329
|
-
color: var(--\${P}-trigger-color);
|
|
330
|
-
transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
331
|
-
}
|
|
332
|
-
.\${P}-trigger-hidden {
|
|
333
|
-
opacity: 0;
|
|
334
|
-
}
|
|
335
|
-
.\${P}-close {
|
|
336
|
-
color: var(--\${P}-close-color);
|
|
337
|
-
}
|
|
338
|
-
.\${P}-trigger:focus,
|
|
339
|
-
.\${P}-close:focus {
|
|
340
|
-
outline: none;
|
|
341
|
-
}
|
|
342
|
-
.\${P}-trigger:focus-visible,
|
|
343
|
-
.\${P}-close:focus-visible {
|
|
344
|
-
outline: 1px solid currentColor;
|
|
345
|
-
outline-offset: 2px;
|
|
346
|
-
}
|
|
347
|
-
.\${P}-interactive .\${P}-trigger:hover,
|
|
348
|
-
.\${P}-state-hover .\${P}-trigger {
|
|
349
|
-
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
350
|
-
}
|
|
351
|
-
.\${P}-close:hover {
|
|
352
|
-
color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
|
|
353
|
-
}
|
|
354
|
-
.\${P}-editor .\${P}-trigger {
|
|
355
|
-
cursor: default;
|
|
356
|
-
}
|
|
357
|
-
.\${P}-overlay {
|
|
358
|
-
position: fixed;
|
|
359
|
-
inset: 0;
|
|
360
|
-
z-index: 9997;
|
|
361
|
-
overflow: hidden;
|
|
362
|
-
overscroll-behavior: none;
|
|
363
|
-
opacity: 0;
|
|
364
|
-
pointer-events: none;
|
|
365
|
-
transition: opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
366
|
-
}
|
|
367
|
-
.\${P}-inline-layer {
|
|
368
|
-
position: fixed;
|
|
369
|
-
inset: 0;
|
|
370
|
-
z-index: 9997;
|
|
371
|
-
overflow: hidden;
|
|
372
|
-
pointer-events: none;
|
|
373
|
-
}
|
|
374
|
-
.\${P}-overlay-editor {
|
|
375
|
-
inset: auto;
|
|
376
|
-
top: var(--cntrl-article-top, 0);
|
|
377
|
-
left: var(--cntrl-article-left, 0);
|
|
378
|
-
width: var(--cntrl-article-width, 100vw) !important;
|
|
379
|
-
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
380
|
-
}
|
|
381
|
-
.\${P}-overlay-edit-mode {
|
|
382
|
-
z-index: 1;
|
|
383
|
-
}
|
|
384
|
-
.\${P}-overlay-active {
|
|
385
|
-
opacity: 1;
|
|
386
|
-
pointer-events: auto;
|
|
387
|
-
}
|
|
388
|
-
.\${P}-backdrop {
|
|
389
|
-
position: absolute;
|
|
390
|
-
inset: 0;
|
|
391
|
-
background-color: var(--\${P}-overlay-color);
|
|
392
|
-
}
|
|
393
|
-
.\${P}-media-layer {
|
|
394
|
-
position: absolute;
|
|
395
|
-
inset: 0;
|
|
396
|
-
pointer-events: none;
|
|
397
|
-
}
|
|
398
|
-
.\${P}-media {
|
|
399
|
-
position: absolute;
|
|
400
|
-
inset: 0;
|
|
401
|
-
width: 100%;
|
|
402
|
-
height: 100%;
|
|
403
|
-
object-fit: cover;
|
|
404
|
-
opacity: 0;
|
|
405
|
-
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
406
|
-
}
|
|
407
|
-
.\${P}-media-contain {
|
|
408
|
-
object-fit: contain;
|
|
409
|
-
}
|
|
410
|
-
.\${P}-media-visible {
|
|
411
|
-
opacity: 1;
|
|
412
|
-
}
|
|
413
|
-
.\${P}-close {
|
|
414
|
-
position: absolute;
|
|
415
|
-
z-index: 2;
|
|
416
|
-
}
|
|
417
|
-
.\${P}-panel {
|
|
418
|
-
position: absolute;
|
|
419
|
-
top: var(--\${P}-panel-y);
|
|
420
|
-
left: var(--\${P}-panel-x);
|
|
421
|
-
z-index: 1;
|
|
422
|
-
box-sizing: border-box;
|
|
423
|
-
max-width: 100%;
|
|
424
|
-
max-height: 100%;
|
|
425
|
-
overflow-y: auto;
|
|
426
|
-
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
|
|
427
|
-
background-color: var(--\${P}-panel-color);
|
|
428
|
-
color: var(--\${P}-text-color);
|
|
429
|
-
overscroll-behavior: contain;
|
|
430
|
-
transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
431
|
-
}
|
|
432
|
-
.\${P}-overlay-active .\${P}-panel {
|
|
433
|
-
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
|
|
434
|
-
}
|
|
435
|
-
.\${P}-panel-settled {
|
|
436
|
-
transition: none;
|
|
437
|
-
}
|
|
438
|
-
.\${P}-panel-inline {
|
|
439
|
-
position: relative;
|
|
440
|
-
top: auto;
|
|
441
|
-
left: auto;
|
|
442
|
-
max-height: none;
|
|
443
|
-
transform: none;
|
|
444
|
-
transition: none;
|
|
445
|
-
}
|
|
446
|
-
.\${P}-media-layer-instant .\${P}-media {
|
|
447
|
-
transition: none;
|
|
448
|
-
}
|
|
449
|
-
.\${P}-panel-copy {
|
|
450
|
-
position: absolute;
|
|
451
|
-
pointer-events: none;
|
|
452
|
-
}
|
|
453
|
-
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
454
|
-
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
455
|
-
}
|
|
456
|
-
@media (prefers-reduced-motion: reduce) {
|
|
457
|
-
.\${P}-panel {
|
|
458
|
-
transition: none;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
.\${P}-group ~ .\${P}-group {
|
|
462
|
-
margin-top: var(--\${P}-group-gap);
|
|
463
|
-
}
|
|
464
|
-
.\${P}-group {
|
|
465
|
-
display: grid;
|
|
466
|
-
grid-template-columns: var(--\${P}-grid-columns);
|
|
467
|
-
column-gap: var(--\${P}-column-gap);
|
|
468
|
-
}
|
|
469
|
-
.\${P}-row {
|
|
470
|
-
grid-column: 2 / -1;
|
|
471
|
-
display: grid;
|
|
472
|
-
grid-template-columns: subgrid;
|
|
473
|
-
align-items: baseline;
|
|
474
|
-
}
|
|
475
|
-
.\${P}-group-unlabeled .\${P}-row {
|
|
476
|
-
grid-column: 1 / -1;
|
|
477
|
-
}
|
|
478
|
-
.\${P}-group-label {
|
|
479
|
-
grid-column: 1;
|
|
480
|
-
align-self: start;
|
|
481
|
-
min-width: 0;
|
|
482
|
-
overflow-wrap: anywhere;
|
|
483
|
-
}
|
|
484
|
-
.\${P}-title {
|
|
485
|
-
min-width: 0;
|
|
486
|
-
overflow-wrap: anywhere;
|
|
487
|
-
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
488
|
-
}
|
|
489
|
-
.\${P}-control-anchor {
|
|
490
|
-
position: absolute;
|
|
491
|
-
pointer-events: none;
|
|
492
|
-
z-index: 2;
|
|
493
|
-
}
|
|
494
|
-
.\${P}-title a {
|
|
495
|
-
text-decoration: inherit;
|
|
496
|
-
}
|
|
497
|
-
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
498
|
-
.\${P}-row:focus-within .\${P}-title,
|
|
499
|
-
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
500
|
-
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
501
|
-
}
|
|
502
|
-
\`;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function ArchivePopupMediaItem({
|
|
506
|
-
P,
|
|
507
|
-
media,
|
|
508
|
-
isVisible,
|
|
509
|
-
}: {
|
|
510
|
-
P: string;
|
|
511
|
-
media: ArchivePopupMedia;
|
|
512
|
-
isVisible: boolean;
|
|
513
|
-
}) {
|
|
514
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
515
|
-
const [isLoaded, setIsLoaded] = useState(false);
|
|
516
|
-
const isVideo = isVideoMedia(media);
|
|
517
|
-
const className = cn(
|
|
518
|
-
\`\${P}-media\`,
|
|
519
|
-
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
520
|
-
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
521
|
-
);
|
|
522
|
-
|
|
523
|
-
useEffect(() => {
|
|
524
|
-
const video = videoRef.current;
|
|
525
|
-
if (!isVideo || !video) return;
|
|
526
|
-
if (isVisible) {
|
|
527
|
-
video.play()?.catch(() => {});
|
|
528
|
-
} else {
|
|
529
|
-
video.pause();
|
|
530
|
-
}
|
|
531
|
-
}, [isVideo, isVisible]);
|
|
532
|
-
|
|
533
|
-
if (isVideo) {
|
|
534
|
-
return (
|
|
535
|
-
<video
|
|
536
|
-
ref={videoRef}
|
|
537
|
-
className={className}
|
|
538
|
-
src={media.assetId}
|
|
539
|
-
muted
|
|
540
|
-
loop
|
|
541
|
-
playsInline
|
|
542
|
-
preload="auto"
|
|
543
|
-
onLoadedData={() => setIsLoaded(true)}
|
|
544
|
-
/>
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return (
|
|
549
|
-
<img
|
|
550
|
-
className={className}
|
|
551
|
-
src={media.assetId}
|
|
552
|
-
alt=""
|
|
553
|
-
decoding="async"
|
|
554
|
-
onLoad={() => setIsLoaded(true)}
|
|
555
|
-
/>
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// A line in each gap, at the right edge of the column it sizes, as Programme's are.
|
|
560
|
-
function renderColumnWidthControls(
|
|
561
|
-
P: string,
|
|
562
|
-
widths: number[],
|
|
563
|
-
paddingLeft: number,
|
|
564
|
-
columnGap: number,
|
|
565
|
-
scaled: (value: number) => string,
|
|
566
|
-
) {
|
|
567
|
-
const lastWidth = widths[widths.length - 1];
|
|
568
|
-
let columnLeft = paddingLeft;
|
|
569
|
-
return widths.slice(0, -1).map((width, index) => {
|
|
570
|
-
const gapCenter = columnLeft + width + columnGap / 2;
|
|
571
|
-
columnLeft += width + columnGap;
|
|
572
|
-
return (
|
|
573
|
-
<div
|
|
574
|
-
key={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
|
|
575
|
-
data-controls={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
|
|
576
|
-
data-controls-axis="x"
|
|
577
|
-
data-controls-variant="column-width"
|
|
578
|
-
data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
|
|
579
|
-
// a column grows into the last one, which the editor keeps from going under its own least
|
|
580
|
-
data-controls-max-fraction={String(width + lastWidth)}
|
|
581
|
-
className={\`\${P}-control-anchor\`}
|
|
582
|
-
style={{ top: 0, left: scaled(gapCenter - COLUMN_RESIZE_HANDLE_WIDTH / 2), width: scaled(COLUMN_RESIZE_HANDLE_WIDTH), height: '100%' }}
|
|
583
|
-
/>
|
|
584
|
-
);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
function renderPanelPaddingControls(
|
|
589
|
-
P: string,
|
|
590
|
-
panelWidth: number,
|
|
591
|
-
padding: Padding,
|
|
592
|
-
scaled: (value: number) => string,
|
|
593
|
-
) {
|
|
594
|
-
const handleSize = (value: number) => scaled(Math.max(value, PADDING_HANDLE_SIZE));
|
|
595
|
-
return (
|
|
596
|
-
<>
|
|
597
|
-
<div
|
|
598
|
-
data-controls="panelPadding.top"
|
|
599
|
-
data-controls-axis="y"
|
|
600
|
-
data-controls-variant="row-padding"
|
|
601
|
-
data-controls-min="0"
|
|
602
|
-
className={\`\${P}-control-anchor\`}
|
|
603
|
-
style={{ top: 0, left: 0, width: '100%', height: handleSize(padding.top) }}
|
|
604
|
-
/>
|
|
605
|
-
<div
|
|
606
|
-
data-controls="panelPadding.bottom"
|
|
607
|
-
data-controls-axis="y"
|
|
608
|
-
data-controls-variant="row-padding"
|
|
609
|
-
data-controls-reverse=""
|
|
610
|
-
data-controls-min="0"
|
|
611
|
-
className={\`\${P}-control-anchor\`}
|
|
612
|
-
style={{ bottom: 0, left: 0, width: '100%', height: handleSize(padding.bottom) }}
|
|
613
|
-
/>
|
|
614
|
-
<div
|
|
615
|
-
data-controls="panelPadding.left"
|
|
616
|
-
data-controls-axis="x"
|
|
617
|
-
data-controls-variant="column-padding"
|
|
618
|
-
data-controls-min="0"
|
|
619
|
-
data-controls-max-fraction={String(Math.max(0, panelWidth - padding.right))}
|
|
620
|
-
className={\`\${P}-control-anchor\`}
|
|
621
|
-
style={{ top: 0, left: 0, width: handleSize(padding.left), height: '100%' }}
|
|
622
|
-
/>
|
|
623
|
-
<div
|
|
624
|
-
data-controls="panelPadding.right"
|
|
625
|
-
data-controls-axis="x"
|
|
626
|
-
data-controls-variant="column-padding"
|
|
627
|
-
data-controls-reverse=""
|
|
628
|
-
data-controls-min="0"
|
|
629
|
-
data-controls-max-fraction={String(Math.max(0, panelWidth - padding.left))}
|
|
630
|
-
className={\`\${P}-control-anchor\`}
|
|
631
|
-
style={{ top: 0, right: 0, width: handleSize(padding.right), height: '100%' }}
|
|
632
|
-
/>
|
|
633
|
-
</>
|
|
634
|
-
);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
export function ArchivePopup({
|
|
638
|
-
settings,
|
|
639
|
-
content,
|
|
640
|
-
isEditor,
|
|
641
|
-
isEditMode,
|
|
642
|
-
isPreviewMode,
|
|
643
|
-
activeEvent,
|
|
644
|
-
portalId,
|
|
645
|
-
currentState,
|
|
646
|
-
unavailableStates,
|
|
647
|
-
}: ArchivePopupProps) {
|
|
648
|
-
const { prefix: P } = useScopedStyles();
|
|
649
|
-
const {
|
|
650
|
-
type = 'b',
|
|
651
|
-
triggerLabel = 'Archive',
|
|
652
|
-
closeLabel = 'Close',
|
|
653
|
-
columns = ARCHIVE_POPUP_DEFAULT_COLUMNS,
|
|
654
|
-
columnGap = DEFAULT_COLUMN_GAP,
|
|
655
|
-
hoverInterval = DEFAULT_HOVER_INTERVAL_MS,
|
|
656
|
-
panelPosition,
|
|
657
|
-
panelWidth = DEFAULT_PANEL_WIDTH,
|
|
658
|
-
panelPadding = DEFAULT_PANEL_PADDING,
|
|
659
|
-
panelRadius = 0,
|
|
660
|
-
groupGap = 0.0139,
|
|
661
|
-
triggerColor = '#000000',
|
|
662
|
-
triggerHoverColor = '#666666',
|
|
663
|
-
closeColor = '#000000',
|
|
664
|
-
closeHoverColor = '#666666',
|
|
665
|
-
panelColor = '#FFFFFF',
|
|
666
|
-
textColor = '#333132',
|
|
667
|
-
textHoverColor = '#BBBBBB',
|
|
668
|
-
overlayColor = '#FFFFFFE6',
|
|
669
|
-
} = settings;
|
|
670
|
-
const items = content ?? [];
|
|
671
|
-
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
672
|
-
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
673
|
-
const overlayRef = useRef<HTMLDivElement>(null);
|
|
674
|
-
const closeRef = useRef<HTMLButtonElement>(null);
|
|
675
|
-
const panelRef = useRef<HTMLDivElement>(null);
|
|
676
|
-
const inlineLayerRef = useRef<HTMLDivElement>(null);
|
|
677
|
-
const [isOpenUser, setIsOpen] = useState(false);
|
|
678
|
-
const [isOverlayMounted, setIsOverlayMounted] = useState(false);
|
|
679
|
-
const [isOverlayActive, setIsOverlayActive] = useState(false);
|
|
680
|
-
const [isOverlaySettled, setIsOverlaySettled] = useState(false);
|
|
681
|
-
const [activeIndex, setActiveIndex] = useState<number | null>(null);
|
|
682
|
-
// Which of the hovered row's images shows, counted afresh on every hover.
|
|
683
|
-
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
684
|
-
const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
|
|
685
|
-
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
686
|
-
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
687
|
-
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
688
|
-
const [isMediaCut, setIsMediaCut] = useState(false);
|
|
689
|
-
|
|
690
|
-
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
691
|
-
const isInteractive = !isEditor || Boolean(isPreviewMode);
|
|
692
|
-
// A has no popup to open: its panel is always shown in place of the label.
|
|
693
|
-
const isInline = type === 'a';
|
|
694
|
-
const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
|
|
695
|
-
// Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
|
|
696
|
-
const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
|
|
697
|
-
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
698
|
-
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
699
|
-
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
|
|
700
|
-
const columnCount = getColumnCount(columns);
|
|
701
|
-
const columnWidths = resolveArchivePopupColumnWidths(settings);
|
|
702
|
-
// the group takes the first column, the titles the rest
|
|
703
|
-
const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
|
|
704
|
-
// With the first column alone there is nothing for a group to span, so every row shows its own first column, as one list.
|
|
705
|
-
const hasGroupColumn = columnCount > 1;
|
|
706
|
-
const groups = useMemo<ArchivePopupGroup[]>(() => (
|
|
707
|
-
hasGroupColumn
|
|
708
|
-
? groupArchiveRows(content ?? [])
|
|
709
|
-
: [{ label: '', rows: (content ?? []).map((item, index) => ({ item, index })) }]
|
|
710
|
-
), [content, hasGroupColumn]);
|
|
711
|
-
|
|
712
|
-
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
713
|
-
|
|
714
|
-
useEffect(() => {
|
|
715
|
-
if (isEditorCanvas && !isEditMode) setIsOpen(false);
|
|
716
|
-
}, [isEditorCanvas, isEditMode]);
|
|
717
|
-
|
|
718
|
-
useEffect(() => {
|
|
719
|
-
if (isOpen) {
|
|
720
|
-
setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
|
|
721
|
-
setIsOverlayMounted(true);
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
setIsOverlayActive(false);
|
|
725
|
-
setActiveIndex(null);
|
|
726
|
-
const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
|
|
727
|
-
return () => window.clearTimeout(timer);
|
|
728
|
-
}, [isOpen]);
|
|
729
|
-
|
|
730
|
-
// Activate only after the mounted overlay's hidden styles are applied, or the appear has nothing to transition from.
|
|
731
|
-
useEffect(() => {
|
|
732
|
-
if (!isOpen || !isOverlayMounted) return;
|
|
733
|
-
overlayRef.current?.getBoundingClientRect();
|
|
734
|
-
const frame = requestAnimationFrame(() => setIsOverlayActive(true));
|
|
735
|
-
return () => cancelAnimationFrame(frame);
|
|
736
|
-
}, [isOpen, isOverlayMounted]);
|
|
737
|
-
|
|
738
|
-
// Canvas controls measure their anchors once, so they wait for the panel to finish sliding in.
|
|
739
|
-
useEffect(() => {
|
|
740
|
-
if (!isOverlayActive) {
|
|
741
|
-
setIsOverlaySettled(false);
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
|
|
745
|
-
return () => window.clearTimeout(timer);
|
|
746
|
-
}, [isOverlayActive]);
|
|
747
|
-
|
|
748
|
-
// The close button sits exactly where the trigger is, so the label swaps in place.
|
|
749
|
-
const updateClosePosition = useCallback(() => {
|
|
750
|
-
const trigger = triggerRef.current;
|
|
751
|
-
const overlay = overlayRef.current;
|
|
752
|
-
if (!trigger || !overlay) return;
|
|
753
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
754
|
-
const overlayRect = overlay.getBoundingClientRect();
|
|
755
|
-
setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
|
|
756
|
-
}, []);
|
|
757
|
-
|
|
758
|
-
useLayoutEffect(() => {
|
|
759
|
-
if (!isOverlayMounted) return;
|
|
760
|
-
updateClosePosition();
|
|
761
|
-
window.addEventListener('resize', updateClosePosition);
|
|
762
|
-
return () => window.removeEventListener('resize', updateClosePosition);
|
|
763
|
-
}, [isOverlayMounted, updateClosePosition]);
|
|
764
|
-
|
|
765
|
-
useEffect(() => {
|
|
766
|
-
if (!isOpen || !isInteractive) return;
|
|
767
|
-
closeRef.current?.focus({ preventScroll: true });
|
|
768
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
769
|
-
if (event.key === 'Escape') setIsOpen(false);
|
|
770
|
-
};
|
|
771
|
-
document.addEventListener('keydown', onKeyDown);
|
|
772
|
-
return () => document.removeEventListener('keydown', onKeyDown);
|
|
773
|
-
}, [isOpen, isInteractive]);
|
|
774
|
-
|
|
775
|
-
// 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.
|
|
776
|
-
useLayoutEffect(() => {
|
|
777
|
-
if (!isInline || activeIndex === null) return;
|
|
778
|
-
const panelEl = panelRef.current;
|
|
779
|
-
const layer = inlineLayerRef.current;
|
|
780
|
-
if (!panelEl || !layer) return;
|
|
781
|
-
const panelRect = panelEl.getBoundingClientRect();
|
|
782
|
-
const layerRect = layer.getBoundingClientRect();
|
|
783
|
-
setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
|
|
784
|
-
}, [isInline, activeIndex]);
|
|
785
|
-
|
|
786
|
-
// The copy stays over the list while the media fades out, so the list never shows through a fading image.
|
|
787
|
-
useEffect(() => {
|
|
788
|
-
if (activeIndex !== null) return;
|
|
789
|
-
const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
|
|
790
|
-
return () => window.clearTimeout(timer);
|
|
791
|
-
}, [activeIndex]);
|
|
792
|
-
|
|
793
|
-
// The copy is only true to the panel until the page moves, so scrolling cuts the media at once rather than locking it,
|
|
794
|
-
// fading out included: a copy left over the list would stay put while the list scrolls away under it.
|
|
795
|
-
const isCopyShown = copyRect !== null;
|
|
796
|
-
useEffect(() => {
|
|
797
|
-
if (!isInline || !isCopyShown) return;
|
|
798
|
-
const cut = () => {
|
|
799
|
-
setIsMediaCut(true);
|
|
800
|
-
setActiveIndex(null);
|
|
801
|
-
setCopyRect(null);
|
|
802
|
-
};
|
|
803
|
-
document.addEventListener('scroll', cut, { capture: true, passive: true });
|
|
804
|
-
window.addEventListener('resize', cut);
|
|
805
|
-
return () => {
|
|
806
|
-
document.removeEventListener('scroll', cut, { capture: true });
|
|
807
|
-
window.removeEventListener('resize', cut);
|
|
808
|
-
};
|
|
809
|
-
}, [isInline, isCopyShown]);
|
|
810
|
-
|
|
811
|
-
const close = () => {
|
|
812
|
-
if (!isInteractive) return;
|
|
813
|
-
setIsOpen(false);
|
|
814
|
-
triggerRef.current?.focus({ preventScroll: true });
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
// Every row's images are fetched once the list can be hovered, so a row's first hover shows its image at once
|
|
818
|
-
// rather than after it loads; videos are left to load on hover.
|
|
819
|
-
const isListShown = isInteractive && (isInline || isOpen);
|
|
820
|
-
useEffect(() => {
|
|
821
|
-
if (!isListShown) return;
|
|
822
|
-
(content ?? []).forEach((item) => getArchivePopupRowMedia(item).forEach((media) => {
|
|
823
|
-
if (!isVideoMedia(media)) new Image().src = media.assetId;
|
|
824
|
-
}));
|
|
825
|
-
}, [isListShown, content]);
|
|
826
|
-
|
|
827
|
-
// A hovered row with several images shows them in turn, round and round, for as long as it stays hovered.
|
|
828
|
-
const activeRowMediaCount = activeIndex === null ? 0 : getArchivePopupRowMedia(items[activeIndex]).length;
|
|
829
|
-
useEffect(() => {
|
|
830
|
-
if (activeRowMediaCount < 2) return;
|
|
831
|
-
const timer = window.setInterval(() => {
|
|
832
|
-
setActiveMediaIndex((current) => (current + 1) % activeRowMediaCount);
|
|
833
|
-
}, Math.max(100, hoverInterval));
|
|
834
|
-
return () => window.clearInterval(timer);
|
|
835
|
-
}, [activeIndex, activeRowMediaCount, hoverInterval]);
|
|
836
|
-
|
|
837
|
-
const showRowMedia = (index: number) => {
|
|
838
|
-
if (!isInteractive || getArchivePopupRowMedia(items[index]).length === 0) {
|
|
839
|
-
setActiveIndex(null);
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
// A row's images all load on its first hover, so the next is ready by the time it shows.
|
|
843
|
-
setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
|
|
844
|
-
if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
|
|
845
|
-
if (activeIndex !== index) setActiveMediaIndex(0);
|
|
846
|
-
setIsMediaCut(false);
|
|
847
|
-
setActiveIndex(index);
|
|
848
|
-
};
|
|
849
|
-
|
|
850
|
-
const hideRowMedia = (index: number) => {
|
|
851
|
-
setActiveIndex((current) => (current === index ? null : current));
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
// Title links only navigate on a live page or in preview, not on the editor canvas.
|
|
855
|
-
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
856
|
-
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
857
|
-
event.preventDefault();
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
|
|
862
|
-
const columnTypographyCss = ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES.slice(0, columnCount).map((prefix) => (
|
|
863
|
-
omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix, 'list'), isEditor))
|
|
864
|
-
));
|
|
865
|
-
// Half the difference of the two line heights sets the label's first line on the first title's, exactly
|
|
866
|
-
// while both columns share a font size.
|
|
867
|
-
const labelLineHeight = columnTypographyCss[0].lineHeight;
|
|
868
|
-
const titleLineHeight = columnTypographyCss[1]?.lineHeight;
|
|
869
|
-
const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
|
|
870
|
-
? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
|
|
871
|
-
: undefined;
|
|
872
|
-
|
|
873
|
-
const colorVars = buildColorVars(P, {
|
|
874
|
-
triggerColor,
|
|
875
|
-
triggerHoverColor,
|
|
876
|
-
closeColor,
|
|
877
|
-
closeHoverColor,
|
|
878
|
-
panelColor,
|
|
879
|
-
textColor,
|
|
880
|
-
textHoverColor,
|
|
881
|
-
overlayColor,
|
|
882
|
-
}, COLOR_VAR_MAP, STATE_KEYS);
|
|
883
|
-
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
884
|
-
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
885
|
-
|
|
886
|
-
const mediaLayer = (
|
|
887
|
-
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
888
|
-
{[...mountedMedia].flatMap((index) => getArchivePopupRowMedia(items[index]).map((media, mediaIndex) => (
|
|
889
|
-
<ArchivePopupMediaItem
|
|
890
|
-
key={\`\${index}-\${mediaIndex}-\${media.assetId}\`}
|
|
891
|
-
P={P}
|
|
892
|
-
media={media}
|
|
893
|
-
isVisible={activeIndex === index && activeMediaIndex === mediaIndex}
|
|
894
|
-
/>
|
|
895
|
-
)))}
|
|
896
|
-
</div>
|
|
897
|
-
);
|
|
898
|
-
// Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
|
|
899
|
-
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
900
|
-
|
|
901
|
-
const renderPanel = (isCopy: boolean) => (
|
|
902
|
-
<div
|
|
903
|
-
ref={isCopy ? undefined : panelRef}
|
|
904
|
-
className={cn(
|
|
905
|
-
\`\${P}-panel\`,
|
|
906
|
-
// Only the open and close slide; once open, a new position or size moves the panel straight there.
|
|
907
|
-
isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
|
|
908
|
-
isInline && \`\${P}-panel-inline\`,
|
|
909
|
-
isCopy && \`\${P}-panel-copy\`,
|
|
910
|
-
)}
|
|
911
|
-
style={{
|
|
912
|
-
width: scaled(panelWidth),
|
|
913
|
-
paddingTop: scaled(panelPadding.top),
|
|
914
|
-
paddingRight: scaled(panelPadding.right),
|
|
915
|
-
paddingBottom: scaled(panelPadding.bottom),
|
|
916
|
-
paddingLeft: scaled(panelPadding.left),
|
|
917
|
-
borderRadius: scaled(panelRadius),
|
|
918
|
-
[\`--\${P}-group-gap\`]: scaled(groupGap),
|
|
919
|
-
[\`--\${P}-panel-x\`]: panelOffset.x,
|
|
920
|
-
[\`--\${P}-panel-y\`]: panelOffset.y,
|
|
921
|
-
[\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
|
|
922
|
-
[\`--\${P}-column-gap\`]: scaled(columnGap),
|
|
923
|
-
...(isCopy && copyRect ? { top: copyRect.top, left: copyRect.left, width: copyRect.width } : {}),
|
|
924
|
-
} as CSSProperties}
|
|
925
|
-
data-lightbox-scrollable={isInline ? undefined : ''}
|
|
926
|
-
aria-hidden={isCopy || undefined}
|
|
927
|
-
onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
|
|
928
|
-
onClickCapture={isCopy ? undefined : onPanelClickCapture}
|
|
929
|
-
>
|
|
930
|
-
{!isCopy && showPanelControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
|
|
931
|
-
{!isCopy && showPanelControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
|
|
932
|
-
{groups.map((group, groupIndex) => (
|
|
933
|
-
<Fragment key={groupIndex}>
|
|
934
|
-
{!isCopy && showPanelControls && groupIndex > 0 && (
|
|
935
|
-
// Left at its static top, the anchor sits right where the gap above this group starts.
|
|
936
|
-
<div
|
|
937
|
-
data-controls="groupGap"
|
|
938
|
-
data-controls-paired=""
|
|
939
|
-
data-controls-axis="y"
|
|
940
|
-
data-controls-reverse=""
|
|
941
|
-
data-controls-min="0"
|
|
942
|
-
className={\`\${P}-control-anchor\`}
|
|
943
|
-
style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, PADDING_HANDLE_SIZE)) }}
|
|
944
|
-
/>
|
|
945
|
-
)}
|
|
946
|
-
{/* The label spans its group's rows, so its line height spaces only its own lines, never the rows beside it;
|
|
947
|
-
a label longer than its rows grows the last track, below them. */}
|
|
948
|
-
<div
|
|
949
|
-
className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
|
|
950
|
-
style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
|
|
951
|
-
>
|
|
952
|
-
{hasGroupColumn && (
|
|
953
|
-
<span
|
|
954
|
-
className={\`\${P}-group-label\`}
|
|
955
|
-
style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
|
|
956
|
-
>
|
|
957
|
-
{group.label}
|
|
958
|
-
</span>
|
|
959
|
-
)}
|
|
960
|
-
{group.rows.map(({ item, index }) => (
|
|
961
|
-
<div
|
|
962
|
-
key={index}
|
|
963
|
-
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
964
|
-
{...(isCopy ? {} : {
|
|
965
|
-
onMouseEnter: () => showRowMedia(index),
|
|
966
|
-
onMouseLeave: () => hideRowMedia(index),
|
|
967
|
-
onFocus: () => showRowMedia(index),
|
|
968
|
-
onBlur: () => hideRowMedia(index),
|
|
969
|
-
})}
|
|
970
|
-
>
|
|
971
|
-
{!hasGroupColumn && (
|
|
972
|
-
<div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
|
|
973
|
-
)}
|
|
974
|
-
{titleKeys.map((key, titleIndex) => {
|
|
975
|
-
const title = item[key];
|
|
976
|
-
return (
|
|
977
|
-
<div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>
|
|
978
|
-
{Array.isArray(title) ? <RichTextRenderer content={title} /> : title}
|
|
979
|
-
</div>
|
|
980
|
-
);
|
|
981
|
-
})}
|
|
982
|
-
</div>
|
|
983
|
-
))}
|
|
984
|
-
</div>
|
|
985
|
-
</Fragment>
|
|
986
|
-
))}
|
|
987
|
-
</div>
|
|
988
|
-
);
|
|
989
|
-
|
|
990
|
-
const overlay = isOverlayMounted ? (
|
|
991
|
-
<div
|
|
992
|
-
ref={overlayRef}
|
|
993
|
-
className={cn(
|
|
994
|
-
\`\${P}-overlay\`,
|
|
995
|
-
isEditor && \`\${P}-overlay-editor\`,
|
|
996
|
-
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
997
|
-
isOverlayActive && \`\${P}-overlay-active\`,
|
|
998
|
-
interactiveClass,
|
|
999
|
-
stateClass,
|
|
1000
|
-
)}
|
|
1001
|
-
style={{ ...colorVars, ...layoutStyle }}
|
|
1002
|
-
role="dialog"
|
|
1003
|
-
aria-modal="true"
|
|
1004
|
-
aria-label={triggerLabel}
|
|
1005
|
-
data-selection="none"
|
|
1006
|
-
>
|
|
1007
|
-
<div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
|
|
1008
|
-
{mediaLayer}
|
|
1009
|
-
<button
|
|
1010
|
-
ref={closeRef}
|
|
1011
|
-
type="button"
|
|
1012
|
-
className={\`\${P}-close\`}
|
|
1013
|
-
style={{
|
|
1014
|
-
...triggerTypographyCss,
|
|
1015
|
-
top: closePosition?.top ?? 0,
|
|
1016
|
-
left: closePosition?.left ?? 0,
|
|
1017
|
-
visibility: closePosition ? 'visible' : 'hidden',
|
|
1018
|
-
}}
|
|
1019
|
-
onClick={close}
|
|
1020
|
-
>
|
|
1021
|
-
{closeLabel}
|
|
1022
|
-
</button>
|
|
1023
|
-
{renderPanel(false)}
|
|
1024
|
-
</div>
|
|
1025
|
-
) : null;
|
|
1026
|
-
|
|
1027
|
-
const inlineLayer = isInline && mountedMedia.size > 0 ? (
|
|
1028
|
-
<div
|
|
1029
|
-
ref={inlineLayerRef}
|
|
1030
|
-
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
|
|
1031
|
-
style={{ ...colorVars, ...layoutStyle }}
|
|
1032
|
-
aria-hidden="true"
|
|
1033
|
-
data-selection="none"
|
|
1034
|
-
>
|
|
1035
|
-
{mediaLayer}
|
|
1036
|
-
{copyRect && renderPanel(true)}
|
|
1037
|
-
</div>
|
|
1038
|
-
) : null;
|
|
1039
|
-
const portalContent = overlay ?? inlineLayer;
|
|
1040
|
-
|
|
1041
|
-
return (
|
|
1042
|
-
<>
|
|
1043
|
-
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
1044
|
-
<div
|
|
1045
|
-
ref={wrapperRef}
|
|
1046
|
-
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
|
|
1047
|
-
style={colorVars}
|
|
1048
|
-
>
|
|
1049
|
-
{isInline ? renderPanel(false) : (
|
|
1050
|
-
// The overlay lets the page show through, so the label fades out with it rather than sit under the close.
|
|
1051
|
-
// Only faded, it keeps the component's size and can still take focus back on close.
|
|
1052
|
-
<button
|
|
1053
|
-
ref={triggerRef}
|
|
1054
|
-
type="button"
|
|
1055
|
-
className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
|
|
1056
|
-
style={triggerTypographyCss}
|
|
1057
|
-
aria-haspopup="dialog"
|
|
1058
|
-
aria-expanded={isOpen}
|
|
1059
|
-
onClick={() => {
|
|
1060
|
-
if (isInteractive) setIsOpen(true);
|
|
1061
|
-
}}
|
|
1062
|
-
>
|
|
1063
|
-
{triggerLabel}
|
|
1064
|
-
</button>
|
|
1065
|
-
)}
|
|
1066
|
-
</div>
|
|
1067
|
-
{portalContent && typeof document !== 'undefined' && createPortal(
|
|
1068
|
-
portalContent,
|
|
1069
|
-
(portalId ? document.getElementById(portalId) : null) ?? document.body,
|
|
1070
|
-
)}
|
|
1071
|
-
</>
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
`, 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';
|
|
1075
3
|
import { CommonComponentProps } from '../props';
|
|
1076
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
1077
5
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -1130,6 +58,7 @@ type BurgerPosition =
|
|
|
1130
58
|
type BurgerSettings = {
|
|
1131
59
|
link?: BurgerLink[];
|
|
1132
60
|
logo?: BurgerLogo | null;
|
|
61
|
+
logoLink?: string;
|
|
1133
62
|
logoMaxWidth?: number;
|
|
1134
63
|
logoMaxHeight?: number;
|
|
1135
64
|
logoPosition?: BurgerLogoPosition;
|
|
@@ -1223,7 +152,7 @@ function resolveCurrentState(value?: string | null): BurgerVisualState | undefin
|
|
|
1223
152
|
return undefined;
|
|
1224
153
|
}
|
|
1225
154
|
|
|
1226
|
-
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';
|
|
1227
156
|
|
|
1228
157
|
function resolveLogoPosition(value?: string): BurgerLogoPosition {
|
|
1229
158
|
if (value === 'center' || value === 'right') return value;
|
|
@@ -1261,6 +190,7 @@ function pickShowIn(value?: BurgerShowInValue, layoutId?: string): string | unde
|
|
|
1261
190
|
function resolveShowIn(value?: BurgerShowInValue, layoutId?: string): BurgerShowIn {
|
|
1262
191
|
const showIn = (pickShowIn(value, layoutId) ?? 'always').trim().toLowerCase().replace(/[_-]+/g, ' ');
|
|
1263
192
|
if (showIn === 'open only' || showIn === 'openonly') return 'open only';
|
|
193
|
+
if (showIn === 'default only' || showIn === 'defaultonly') return 'default only';
|
|
1264
194
|
if (showIn === 'open and compact' || showIn === 'openandcompact') return 'open and compact';
|
|
1265
195
|
if (showIn === 'default and open' || showIn === 'defaultandopen') return 'default and open';
|
|
1266
196
|
if (showIn === 'default and compact' || showIn === 'defaultandcompact') return 'default and compact';
|
|
@@ -1271,6 +201,8 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
1271
201
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
1272
202
|
case 'open only':
|
|
1273
203
|
return false;
|
|
204
|
+
case 'default only':
|
|
205
|
+
return navigationState === 'default';
|
|
1274
206
|
case 'open and compact':
|
|
1275
207
|
return navigationState === 'compact';
|
|
1276
208
|
case 'default and compact':
|
|
@@ -1284,6 +216,7 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
1284
216
|
|
|
1285
217
|
function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
1286
218
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
219
|
+
case 'default only':
|
|
1287
220
|
case 'default and compact':
|
|
1288
221
|
return false;
|
|
1289
222
|
default:
|
|
@@ -1291,6 +224,12 @@ function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
|
1291
224
|
}
|
|
1292
225
|
}
|
|
1293
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
|
+
|
|
1294
233
|
type BurgerPageRef = {
|
|
1295
234
|
id: string;
|
|
1296
235
|
slug: string;
|
|
@@ -1346,6 +285,13 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
1346
285
|
return { type: 'page', value: item.page ?? '', target, anchor: item.anchor };
|
|
1347
286
|
}
|
|
1348
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
|
+
|
|
1349
295
|
function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
1350
296
|
label: string;
|
|
1351
297
|
href: string;
|
|
@@ -2374,6 +1320,14 @@ function getCSS(P: string): string {
|
|
|
2374
1320
|
right: 0;
|
|
2375
1321
|
transform: none;
|
|
2376
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
|
+
}
|
|
2377
1331
|
.\${P}-nav-logo-inner {
|
|
2378
1332
|
position: relative;
|
|
2379
1333
|
flex-shrink: 0;
|
|
@@ -2970,8 +1924,9 @@ export function Burger({
|
|
|
2970
1924
|
const pinnedState = resolveCurrentState(currentStateProp);
|
|
2971
1925
|
const unavailableStateSet = useMemo(() => new Set(unavailableStates), [unavailableStates]);
|
|
2972
1926
|
const isStateUnavailable = (state?: string | null) => Boolean(state && unavailableStateSet.has(state));
|
|
1927
|
+
const isOpenMenuAvailable = isBurgerOpenMenuAvailable(settingsProp.link, layoutId);
|
|
2973
1928
|
const isOpenPinned = Boolean(isEditor && !isPreviewMode && pinnedState === 'open' && !isStateUnavailable('open'));
|
|
2974
|
-
const isOpen = isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser);
|
|
1929
|
+
const isOpen = isOpenMenuAvailable && (isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser));
|
|
2975
1930
|
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
2976
1931
|
const shouldLockScroll = isOpen && !isEditorCanvas;
|
|
2977
1932
|
useLightboxScrollLock(shouldLockScroll);
|
|
@@ -3004,6 +1959,7 @@ export function Burger({
|
|
|
3004
1959
|
|
|
3005
1960
|
const {
|
|
3006
1961
|
logo,
|
|
1962
|
+
logoLink = '',
|
|
3007
1963
|
logoMaxHeight = 120 / 1440,
|
|
3008
1964
|
logoPosition = 'left',
|
|
3009
1965
|
panelHeight = 60 / 1440,
|
|
@@ -3097,7 +2053,7 @@ export function Burger({
|
|
|
3097
2053
|
const closedNavPaddingRight = isCompactNav ? compactNavPaddingRight : navPaddingRight;
|
|
3098
2054
|
|
|
3099
2055
|
const resolvedNavTextWidth = closedNavTextWidth ?? textWidth;
|
|
3100
|
-
const showBurgerButton = isOpen || (isCompactNav ? compactShowIcon : showIcon) !== 'off';
|
|
2056
|
+
const showBurgerButton = isOpen || (isOpenMenuAvailable && (isCompactNav ? compactShowIcon : showIcon) !== 'off');
|
|
3101
2057
|
|
|
3102
2058
|
const colorVars = buildColorVars(P, {
|
|
3103
2059
|
iconColor,
|
|
@@ -3284,6 +2240,9 @@ export function Burger({
|
|
|
3284
2240
|
const tintLogo = Boolean(logoMaskUrl);
|
|
3285
2241
|
const logoHeight = scaled(Math.min(closedLogoMaxHeight, closedPanelHeight));
|
|
3286
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;
|
|
3287
2246
|
const toggleSide = isLogoOnRight ? 'left' : 'right';
|
|
3288
2247
|
|
|
3289
2248
|
const items = Array.isArray(linkItems) ? linkItems : [];
|
|
@@ -3634,6 +2593,23 @@ export function Burger({
|
|
|
3634
2593
|
);
|
|
3635
2594
|
};
|
|
3636
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
|
+
|
|
3637
2613
|
const navBarStyle: CSSProperties = {
|
|
3638
2614
|
...colorVars,
|
|
3639
2615
|
height: scalingValue(closedPanelHeight, isEditor),
|
|
@@ -3668,20 +2644,16 @@ export function Burger({
|
|
|
3668
2644
|
{showLogo && logoSrc ? (
|
|
3669
2645
|
<div className={\`\${P}-nav-logo \${P}-nav-logo-\${closedLogoPosition}\`}>
|
|
3670
2646
|
{closedLogoPosition === 'left' ? renderNavEdgePadding('left') : null}
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
className={\`\${P}-nav-logo-img\`}
|
|
3682
|
-
/>
|
|
3683
|
-
{tintLogo ? <span className={\`\${P}-nav-logo-tint\`} aria-hidden="true" /> : null}
|
|
3684
|
-
</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}
|
|
3685
2657
|
{closedLogoPosition === 'right' ? renderNavEdgePadding('right') : null}
|
|
3686
2658
|
</div>
|
|
3687
2659
|
) : null}
|
|
@@ -3712,7 +2684,7 @@ export function Burger({
|
|
|
3712
2684
|
</div>
|
|
3713
2685
|
);
|
|
3714
2686
|
}
|
|
3715
|
-
`,
|
|
2687
|
+
`, S = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3716
2688
|
import { CommonComponentProps } from '../props';
|
|
3717
2689
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
3718
2690
|
|
|
@@ -4241,7 +3213,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
4241
3213
|
</>
|
|
4242
3214
|
);
|
|
4243
3215
|
}
|
|
4244
|
-
`,
|
|
3216
|
+
`, w = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4245
3217
|
import cn from 'classnames';
|
|
4246
3218
|
import { CommonComponentProps } from '../props';
|
|
4247
3219
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -4989,7 +3961,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
4989
3961
|
</>
|
|
4990
3962
|
);
|
|
4991
3963
|
}
|
|
4992
|
-
`,
|
|
3964
|
+
`, C = `import React, { useMemo, useState } from 'react';
|
|
4993
3965
|
import { CommonComponentProps } from '../props';
|
|
4994
3966
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
4995
3967
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -5627,7 +4599,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
5627
4599
|
};
|
|
5628
4600
|
|
|
5629
4601
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
5630
|
-
`,
|
|
4602
|
+
`, $ = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
5631
4603
|
import '@splidejs/react-splide/css/core';
|
|
5632
4604
|
import { CommonComponentProps } from '../props';
|
|
5633
4605
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -7942,7 +6914,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
7942
6914
|
};
|
|
7943
6915
|
|
|
7944
6916
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
7945
|
-
`,
|
|
6917
|
+
`, I = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
7946
6918
|
import { CommonComponentProps } from '../props';
|
|
7947
6919
|
import { scalingValue } from '../utils/scalingValue';
|
|
7948
6920
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -8515,7 +7487,7 @@ export function Helix({
|
|
|
8515
7487
|
</>
|
|
8516
7488
|
);
|
|
8517
7489
|
}
|
|
8518
|
-
`,
|
|
7490
|
+
`, T = `import { CommonComponentProps } from '../props';
|
|
8519
7491
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
8520
7492
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
8521
7493
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -8526,6 +7498,7 @@ import {
|
|
|
8526
7498
|
type HiveLightboxTitleSettings,
|
|
8527
7499
|
} from './HiveLightboxTitles';
|
|
8528
7500
|
import { getDisplayedImageRect } from '../utils/getImageRect';
|
|
7501
|
+
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
8529
7502
|
|
|
8530
7503
|
function sv(px: number): string {
|
|
8531
7504
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -8852,6 +7825,13 @@ function getCSS(P: string): string {
|
|
|
8852
7825
|
pointer-events: auto;
|
|
8853
7826
|
flex-shrink: 0;
|
|
8854
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
|
+
}
|
|
8855
7835
|
\`;
|
|
8856
7836
|
}
|
|
8857
7837
|
|
|
@@ -8864,8 +7844,20 @@ type GridLayoutConfig = {
|
|
|
8864
7844
|
};
|
|
8865
7845
|
|
|
8866
7846
|
type HiveSettings = {
|
|
7847
|
+
type?: 'a' | 'b';
|
|
8867
7848
|
gridLayout: GridLayoutConfig;
|
|
8868
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'];
|
|
8869
7861
|
align?: 'top' | 'center' | 'bottom';
|
|
8870
7862
|
imageDisplay: {
|
|
8871
7863
|
display: 'fit' | 'cover';
|
|
@@ -10656,7 +9648,16 @@ export function Hive({
|
|
|
10656
9648
|
portalId,
|
|
10657
9649
|
}: HiveProps) {
|
|
10658
9650
|
const { prefix: P } = useScopedStyles();
|
|
10659
|
-
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';
|
|
10660
9661
|
|
|
10661
9662
|
const isCover = imageDisplay?.display === 'cover';
|
|
10662
9663
|
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
@@ -10672,6 +9673,27 @@ export function Hive({
|
|
|
10672
9673
|
const horizontalGapScaled = scalingValue(gridLayout.horizontalGap ?? 0, isEditor);
|
|
10673
9674
|
const imageWrapperWidth = entryWidthScaled;
|
|
10674
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
|
+
);
|
|
10675
9697
|
|
|
10676
9698
|
const imageWrapperStyle: React.CSSProperties = {
|
|
10677
9699
|
width: imageWrapperWidth,
|
|
@@ -10856,7 +9878,7 @@ export function Hive({
|
|
|
10856
9878
|
isLastRow ? \`\${P}-item-inner-last-row\` : '',
|
|
10857
9879
|
].filter(Boolean).join(' ')}
|
|
10858
9880
|
style={{
|
|
10859
|
-
width:
|
|
9881
|
+
width: itemInnerWidth,
|
|
10860
9882
|
...(gridColumn ? { gridColumn } : {}),
|
|
10861
9883
|
}}
|
|
10862
9884
|
>
|
|
@@ -10867,7 +9889,20 @@ export function Hive({
|
|
|
10867
9889
|
{imageContent}
|
|
10868
9890
|
</a>
|
|
10869
9891
|
<div className={\`\${P}-item-subtitle-row\`}>
|
|
10870
|
-
|
|
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
|
+
)}
|
|
10871
9906
|
</div>
|
|
10872
9907
|
</div>
|
|
10873
9908
|
</div>
|
|
@@ -10904,7 +9939,7 @@ export function Hive({
|
|
|
10904
9939
|
</>
|
|
10905
9940
|
);
|
|
10906
9941
|
}
|
|
10907
|
-
`,
|
|
9942
|
+
`, E = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
10908
9943
|
import { createPortal } from 'react-dom';
|
|
10909
9944
|
import { CommonComponentProps } from '../props';
|
|
10910
9945
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11669,7 +10704,7 @@ export type LightboxJournalSettings = {
|
|
|
11669
10704
|
closeIconColor: string;
|
|
11670
10705
|
closeIconHoverColor: string;
|
|
11671
10706
|
};
|
|
11672
|
-
`,
|
|
10707
|
+
`, R = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
11673
10708
|
import { createPortal } from 'react-dom';
|
|
11674
10709
|
import { CommonComponentProps } from '../props';
|
|
11675
10710
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -12215,7 +11250,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
12215
11250
|
</>
|
|
12216
11251
|
);
|
|
12217
11252
|
};
|
|
12218
|
-
`,
|
|
11253
|
+
`, M = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
12219
11254
|
import { createPortal } from 'react-dom';
|
|
12220
11255
|
import { CommonComponentProps } from '../props';
|
|
12221
11256
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15320,7 +14355,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
15320
14355
|
</>
|
|
15321
14356
|
);
|
|
15322
14357
|
}
|
|
15323
|
-
`,
|
|
14358
|
+
`, L = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
15324
14359
|
import cn from 'classnames';
|
|
15325
14360
|
import { CommonComponentProps } from '../props';
|
|
15326
14361
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16178,7 +15213,7 @@ type MarqueeProps = {
|
|
|
16178
15213
|
isPreviewMode?: boolean;
|
|
16179
15214
|
isEditMode?: boolean;
|
|
16180
15215
|
} & CommonComponentProps;
|
|
16181
|
-
`,
|
|
15216
|
+
`, k = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
16182
15217
|
import cn from 'classnames';
|
|
16183
15218
|
import { CommonComponentProps } from '../props';
|
|
16184
15219
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -17121,7 +16156,7 @@ type MarqueeTextProps = {
|
|
|
17121
16156
|
isPreviewMode?: boolean;
|
|
17122
16157
|
isEditMode?: boolean;
|
|
17123
16158
|
} & CommonComponentProps;
|
|
17124
|
-
`,
|
|
16159
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17125
16160
|
import { createPortal } from 'react-dom';
|
|
17126
16161
|
import type React from 'react';
|
|
17127
16162
|
import { CommonComponentProps } from '../props';
|
|
@@ -19603,7 +18638,7 @@ export function Mercury({
|
|
|
19603
18638
|
</>
|
|
19604
18639
|
);
|
|
19605
18640
|
}
|
|
19606
|
-
`,
|
|
18641
|
+
`, N = `import React, { useMemo, useState } from 'react';
|
|
19607
18642
|
import { CommonComponentProps } from '../props';
|
|
19608
18643
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
19609
18644
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -20182,7 +19217,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
20182
19217
|
};
|
|
20183
19218
|
|
|
20184
19219
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
20185
|
-
`,
|
|
19220
|
+
`, H = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20186
19221
|
import type React from 'react';
|
|
20187
19222
|
import { CommonComponentProps } from '../props';
|
|
20188
19223
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -21021,7 +20056,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
21021
20056
|
</>
|
|
21022
20057
|
);
|
|
21023
20058
|
}
|
|
21024
|
-
`,
|
|
20059
|
+
`, O = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21025
20060
|
import cn from 'classnames';
|
|
21026
20061
|
import { CommonComponentProps } from '../props';
|
|
21027
20062
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -21649,7 +20684,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
21649
20684
|
</>
|
|
21650
20685
|
);
|
|
21651
20686
|
}
|
|
21652
|
-
`,
|
|
20687
|
+
`, F = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
21653
20688
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
21654
20689
|
import { CommonComponentProps } from '../props';
|
|
21655
20690
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -22281,7 +21316,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
22281
21316
|
</>
|
|
22282
21317
|
);
|
|
22283
21318
|
}
|
|
22284
|
-
`,
|
|
21319
|
+
`, _ = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
22285
21320
|
import cn from 'classnames';
|
|
22286
21321
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
22287
21322
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -23463,7 +22498,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
23463
22498
|
</svg>
|
|
23464
22499
|
);
|
|
23465
22500
|
}
|
|
23466
|
-
`,
|
|
22501
|
+
`, W = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23467
22502
|
import cn from 'classnames';
|
|
23468
22503
|
import { CommonComponentProps } from '../props';
|
|
23469
22504
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24094,7 +23129,7 @@ type TestimonialsSettings = {
|
|
|
24094
23129
|
logoHeight: number;
|
|
24095
23130
|
captionMarginTop: number;
|
|
24096
23131
|
};
|
|
24097
|
-
`,
|
|
23132
|
+
`, D = `import cn from 'classnames';
|
|
24098
23133
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
24099
23134
|
import { CommonComponentProps } from '../props';
|
|
24100
23135
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -24590,7 +23625,7 @@ type TestimonialsSettings = {
|
|
|
24590
23625
|
icon?: string | null;
|
|
24591
23626
|
};
|
|
24592
23627
|
};
|
|
24593
|
-
`,
|
|
23628
|
+
`, B = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24594
23629
|
import type React from 'react';
|
|
24595
23630
|
import { createPortal } from 'react-dom';
|
|
24596
23631
|
import { CommonComponentProps } from '../props';
|
|
@@ -25123,30 +24158,29 @@ export function Waterfall({
|
|
|
25123
24158
|
</>
|
|
25124
24159
|
);
|
|
25125
24160
|
}
|
|
25126
|
-
`,
|
|
25127
|
-
[
|
|
25128
|
-
[
|
|
25129
|
-
[
|
|
25130
|
-
[
|
|
25131
|
-
[
|
|
25132
|
-
[
|
|
25133
|
-
[
|
|
25134
|
-
[
|
|
25135
|
-
[
|
|
25136
|
-
[
|
|
25137
|
-
[
|
|
25138
|
-
[
|
|
25139
|
-
[
|
|
25140
|
-
[
|
|
25141
|
-
[
|
|
25142
|
-
[
|
|
25143
|
-
[
|
|
25144
|
-
[
|
|
25145
|
-
[
|
|
25146
|
-
[
|
|
25147
|
-
[
|
|
25148
|
-
[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
|
|
25149
24183
|
};
|
|
25150
24184
|
export {
|
|
25151
|
-
|
|
24185
|
+
V as componentSources
|
|
25152
24186
|
};
|