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