@expofp/ui 0.0.0-experimental.cf063fc
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/README.md +30 -0
- package/dist/components/Alert/Alert.d.ts +20 -0
- package/dist/components/Alert/Alert.js +23 -0
- package/dist/components/Alert/index.d.ts +3 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +28 -0
- package/dist/components/Autocomplete/Autocomplete.js +292 -0
- package/dist/components/Autocomplete/index.d.ts +3 -0
- package/dist/components/Autocomplete/index.js +1 -0
- package/dist/components/Badge/Badge.d.ts +14 -0
- package/dist/components/Badge/Badge.js +15 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Button/Button.d.ts +30 -0
- package/dist/components/Button/Button.js +41 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.js +19 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/CheckboxButton/CheckboxButton.d.ts +12 -0
- package/dist/components/CheckboxButton/CheckboxButton.js +19 -0
- package/dist/components/CheckboxButton/index.d.ts +3 -0
- package/dist/components/CheckboxButton/index.js +1 -0
- package/dist/components/DownloadList/DownloadList.d.ts +15 -0
- package/dist/components/DownloadList/DownloadList.js +9 -0
- package/dist/components/DownloadList/index.d.ts +3 -0
- package/dist/components/DownloadList/index.js +2 -0
- package/dist/components/Draggable/Draggable.d.ts +9 -0
- package/dist/components/Draggable/Draggable.js +92 -0
- package/dist/components/Draggable/index.d.ts +3 -0
- package/dist/components/Draggable/index.js +2 -0
- package/dist/components/EntityItem/EntityItem.d.ts +46 -0
- package/dist/components/EntityItem/EntityItem.js +29 -0
- package/dist/components/EntityItem/index.d.ts +3 -0
- package/dist/components/EntityItem/index.js +1 -0
- package/dist/components/EventBadge/EventBadge.d.ts +13 -0
- package/dist/components/EventBadge/EventBadge.js +10 -0
- package/dist/components/EventBadge/index.d.ts +3 -0
- package/dist/components/EventBadge/index.js +1 -0
- package/dist/components/Gallery/Gallery.d.ts +24 -0
- package/dist/components/Gallery/Gallery.js +28 -0
- package/dist/components/Gallery/GalleryBadges/GalleryBadges.d.ts +8 -0
- package/dist/components/Gallery/GalleryBadges/GalleryBadges.js +5 -0
- package/dist/components/Gallery/GalleryControls/GalleryControls.d.ts +11 -0
- package/dist/components/Gallery/GalleryControls/GalleryControls.js +5 -0
- package/dist/components/Gallery/GalleryImg/GalleryImg.d.ts +13 -0
- package/dist/components/Gallery/GalleryImg/GalleryImg.js +37 -0
- package/dist/components/Gallery/GalleryItem/GalleryItem.d.ts +14 -0
- package/dist/components/Gallery/GalleryItem/GalleryItem.js +6 -0
- package/dist/components/Gallery/GalleryModal/GalleryModal.d.ts +20 -0
- package/dist/components/Gallery/GalleryModal/GalleryModal.js +90 -0
- package/dist/components/Gallery/GalleryPreLoader.d.ts +7 -0
- package/dist/components/Gallery/GalleryPreLoader.js +29 -0
- package/dist/components/Gallery/TransformImg/TransformImg.d.ts +10 -0
- package/dist/components/Gallery/TransformImg/TransformImg.js +15 -0
- package/dist/components/Gallery/index.d.ts +4 -0
- package/dist/components/Gallery/index.js +1 -0
- package/dist/components/Gallery/types.d.ts +6 -0
- package/dist/components/Gallery/types.js +1 -0
- package/dist/components/HeatmapLegend/HeatmapLegend.d.ts +15 -0
- package/dist/components/HeatmapLegend/HeatmapLegend.js +11 -0
- package/dist/components/HeatmapLegend/index.d.ts +3 -0
- package/dist/components/HeatmapLegend/index.js +2 -0
- package/dist/components/HighlightText/HighlightText.d.ts +7 -0
- package/dist/components/HighlightText/HighlightText.js +14 -0
- package/dist/components/HighlightText/index.d.ts +2 -0
- package/dist/components/HighlightText/index.js +1 -0
- package/dist/components/LevelBadge/LevelBadge.d.ts +9 -0
- package/dist/components/LevelBadge/LevelBadge.js +10 -0
- package/dist/components/LevelBadge/index.d.ts +3 -0
- package/dist/components/LevelBadge/index.js +2 -0
- package/dist/components/LevelSelector/LevelSelector.d.ts +18 -0
- package/dist/components/LevelSelector/LevelSelector.js +91 -0
- package/dist/components/LevelSelector/index.d.ts +3 -0
- package/dist/components/LevelSelector/index.js +2 -0
- package/dist/components/MapControls/MapControls.d.ts +33 -0
- package/dist/components/MapControls/MapControls.js +38 -0
- package/dist/components/MapControls/index.d.ts +3 -0
- package/dist/components/MapControls/index.js +2 -0
- package/dist/components/MobileToggleButton/MobileToggleButton.d.ts +11 -0
- package/dist/components/MobileToggleButton/MobileToggleButton.js +8 -0
- package/dist/components/MobileToggleButton/index.d.ts +3 -0
- package/dist/components/MobileToggleButton/index.js +1 -0
- package/dist/components/Modal/Modal.d.ts +34 -0
- package/dist/components/Modal/Modal.js +103 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/MultiSelectGroups/MultiSelectGroups.d.ts +37 -0
- package/dist/components/MultiSelectGroups/MultiSelectGroups.js +80 -0
- package/dist/components/MultiSelectGroups/index.d.ts +3 -0
- package/dist/components/MultiSelectGroups/index.js +1 -0
- package/dist/components/Overlay/Overlay.d.ts +30 -0
- package/dist/components/Overlay/Overlay.js +250 -0
- package/dist/components/Overlay/OverlayHeaderContext.d.ts +7 -0
- package/dist/components/Overlay/OverlayHeaderContext.js +7 -0
- package/dist/components/Overlay/OverlayKeyboardInsetContext.d.ts +7 -0
- package/dist/components/Overlay/OverlayKeyboardInsetContext.js +7 -0
- package/dist/components/Overlay/OverlayScrollContext.d.ts +7 -0
- package/dist/components/Overlay/OverlayScrollContext.js +7 -0
- package/dist/components/Overlay/index.d.ts +5 -0
- package/dist/components/Overlay/index.js +3 -0
- package/dist/components/OverlayGrip/OverlayGrip.d.ts +11 -0
- package/dist/components/OverlayGrip/OverlayGrip.js +8 -0
- package/dist/components/OverlayGrip/index.d.ts +3 -0
- package/dist/components/OverlayGrip/index.js +2 -0
- package/dist/components/PermissionNotice/PermissionNotice.d.ts +16 -0
- package/dist/components/PermissionNotice/PermissionNotice.js +11 -0
- package/dist/components/PermissionNotice/index.d.ts +3 -0
- package/dist/components/PermissionNotice/index.js +2 -0
- package/dist/components/PlanSelector/PlanSelector.d.ts +13 -0
- package/dist/components/PlanSelector/PlanSelector.js +10 -0
- package/dist/components/PlanSelector/index.d.ts +3 -0
- package/dist/components/PlanSelector/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +15 -0
- package/dist/components/Radio/Radio.js +13 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/RebookingNotes/RebookingNotes.d.ts +11 -0
- package/dist/components/RebookingNotes/RebookingNotes.js +18 -0
- package/dist/components/RebookingNotes/index.d.ts +3 -0
- package/dist/components/RebookingNotes/index.js +1 -0
- package/dist/components/RebookingRadioGroup/RebookingRadioGroup.d.ts +17 -0
- package/dist/components/RebookingRadioGroup/RebookingRadioGroup.js +13 -0
- package/dist/components/RebookingRadioGroup/index.d.ts +3 -0
- package/dist/components/RebookingRadioGroup/index.js +1 -0
- package/dist/components/ScrollableRow/ScrollableRow.d.ts +21 -0
- package/dist/components/ScrollableRow/ScrollableRow.js +155 -0
- package/dist/components/ScrollableRow/index.d.ts +3 -0
- package/dist/components/ScrollableRow/index.js +2 -0
- package/dist/components/Share/Share.d.ts +22 -0
- package/dist/components/Share/Share.js +24 -0
- package/dist/components/Share/index.d.ts +3 -0
- package/dist/components/Share/index.js +1 -0
- package/dist/components/ShowMoreButton/ShowMoreButton.d.ts +11 -0
- package/dist/components/ShowMoreButton/ShowMoreButton.js +7 -0
- package/dist/components/ShowMoreButton/index.d.ts +3 -0
- package/dist/components/ShowMoreButton/index.js +1 -0
- package/dist/components/SidebarActions/SidebarActions.d.ts +26 -0
- package/dist/components/SidebarActions/SidebarActions.js +32 -0
- package/dist/components/SidebarActions/index.d.ts +3 -0
- package/dist/components/SidebarActions/index.js +2 -0
- package/dist/components/SimpleRow/SimpleRow.d.ts +15 -0
- package/dist/components/SimpleRow/SimpleRow.js +11 -0
- package/dist/components/SimpleRow/index.d.ts +3 -0
- package/dist/components/SimpleRow/index.js +2 -0
- package/dist/components/Spinner/Spinner.d.ts +9 -0
- package/dist/components/Spinner/Spinner.js +8 -0
- package/dist/components/Spinner/index.d.ts +3 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +17 -0
- package/dist/components/ToggleButton/ToggleButton.js +8 -0
- package/dist/components/ToggleButton/index.d.ts +3 -0
- package/dist/components/ToggleButton/index.js +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.d.ts +12 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.js +10 -0
- package/dist/components/ToggleSwitch/index.d.ts +3 -0
- package/dist/components/ToggleSwitch/index.js +1 -0
- package/dist/components/TouchHand/TouchHand.d.ts +5 -0
- package/dist/components/TouchHand/TouchHand.js +7 -0
- package/dist/components/TouchHand/index.d.ts +2 -0
- package/dist/components/TouchHand/index.js +1 -0
- package/dist/components/VenuePicker/VenuePicker.d.ts +23 -0
- package/dist/components/VenuePicker/VenuePicker.js +70 -0
- package/dist/components/VenuePicker/index.d.ts +3 -0
- package/dist/components/VenuePicker/index.js +2 -0
- package/dist/components/WayfindingFloorSelector/WayfindingFloorSelector.d.ts +24 -0
- package/dist/components/WayfindingFloorSelector/WayfindingFloorSelector.js +27 -0
- package/dist/components/WayfindingFloorSelector/index.d.ts +3 -0
- package/dist/components/WayfindingFloorSelector/index.js +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +77 -0
- package/dist/shared/activeElement.d.ts +7 -0
- package/dist/shared/activeElement.js +14 -0
- package/dist/shared/debounce.d.ts +2 -0
- package/dist/shared/debounce.js +9 -0
- package/dist/shared/hooks/useKeyboardInset.d.ts +9 -0
- package/dist/shared/hooks/useKeyboardInset.js +84 -0
- package/dist/shared/hooks/useOnClickOutside.d.ts +14 -0
- package/dist/shared/hooks/useOnClickOutside.js +43 -0
- package/dist/shared/hooks/useOnEscape.d.ts +14 -0
- package/dist/shared/hooks/useOnEscape.js +31 -0
- package/dist/shared/hooks/useSheetDrag.d.ts +28 -0
- package/dist/shared/hooks/useSheetDrag.js +274 -0
- package/dist/shared/hooks/useWindowSize.d.ts +5 -0
- package/dist/shared/hooks/useWindowSize.js +38 -0
- package/dist/shared/interactive.d.ts +2 -0
- package/dist/shared/interactive.js +4 -0
- package/dist/shared/selector-option.d.ts +7 -0
- package/dist/shared/selector-option.js +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './DownloadList.scss';
|
|
3
|
+
function DownloadListItem({ fileName, path, downloadLabel }) {
|
|
4
|
+
return (_jsxs("a", { className: "efp-download-list__item", href: path, download: true, target: "_blank", rel: "noopener noreferrer", "aria-label": downloadLabel(fileName), children: [_jsx("div", { className: "efp-download-list__item-icon", children: _jsx("i", { className: "icon-file-solid", "aria-hidden": "true" }) }), _jsx("div", { className: "efp-download-list__item-name", children: _jsx("span", { children: fileName }) }), _jsx("div", { className: "efp-download-list__item-download", children: _jsx("i", { className: "icon-download", "aria-hidden": "true" }) })] }));
|
|
5
|
+
}
|
|
6
|
+
function DownloadList({ list, title, downloadLabel }) {
|
|
7
|
+
return (_jsxs("div", { className: "efp-download-list", children: [_jsx("div", { className: "efp-download-list__title font-medium", children: title }), _jsx("ul", { className: "efp-download-list__list", children: list.map((item) => (_jsx("li", { children: _jsx(DownloadListItem, { fileName: item.fileName, path: item.path, downloadLabel: downloadLabel }) }, item.path))) })] }));
|
|
8
|
+
}
|
|
9
|
+
export default DownloadList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DraggableProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
declare const Draggable: ({ children, className, style }: DraggableProps) => React.JSX.Element;
|
|
8
|
+
export default Draggable;
|
|
9
|
+
//# sourceMappingURL=Draggable.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable @eslint-react/exhaustive-deps */
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { isInteractiveTarget } from '../../shared/interactive';
|
|
5
|
+
const Draggable = ({ children, className, style }) => {
|
|
6
|
+
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
7
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
8
|
+
const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
|
|
9
|
+
const draggableRef = useRef(null);
|
|
10
|
+
const handleMouseDown = (e) => {
|
|
11
|
+
if (isInteractiveTarget(e.target)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
setIsDragging(true);
|
|
15
|
+
setDragStart({
|
|
16
|
+
x: e.clientX - position.x,
|
|
17
|
+
y: e.clientY - position.y,
|
|
18
|
+
});
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
};
|
|
21
|
+
const handleMouseMove = (e) => {
|
|
22
|
+
if (!isDragging)
|
|
23
|
+
return;
|
|
24
|
+
const newX = e.clientX - dragStart.x;
|
|
25
|
+
const newY = e.clientY - dragStart.y;
|
|
26
|
+
setPosition({ x: newX, y: newY });
|
|
27
|
+
};
|
|
28
|
+
const handleMouseUp = () => {
|
|
29
|
+
endDrag();
|
|
30
|
+
};
|
|
31
|
+
const handleTouchStart = (e) => {
|
|
32
|
+
if (isInteractiveTarget(e.target)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const touch = e.touches[0];
|
|
36
|
+
setIsDragging(true);
|
|
37
|
+
setDragStart({
|
|
38
|
+
x: touch.clientX - position.x,
|
|
39
|
+
y: touch.clientY - position.y,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const handleTouchMove = (e) => {
|
|
43
|
+
if (!isDragging)
|
|
44
|
+
return;
|
|
45
|
+
const touch = e.touches[0];
|
|
46
|
+
const newX = touch.clientX - dragStart.x;
|
|
47
|
+
const newY = touch.clientY - dragStart.y;
|
|
48
|
+
setPosition({ x: newX, y: newY });
|
|
49
|
+
};
|
|
50
|
+
const handleTouchEnd = () => {
|
|
51
|
+
endDrag();
|
|
52
|
+
};
|
|
53
|
+
const endDrag = () => {
|
|
54
|
+
if (!draggableRef.current)
|
|
55
|
+
return;
|
|
56
|
+
const rect = draggableRef.current.getBoundingClientRect();
|
|
57
|
+
const viewportWidth = window.innerWidth;
|
|
58
|
+
const viewportHeight = window.innerHeight;
|
|
59
|
+
const limitWidth = rect.width / 4;
|
|
60
|
+
const limitHeight = rect.height / 4;
|
|
61
|
+
const hiddenLeft = Math.max(0, 0 - rect.left);
|
|
62
|
+
const hiddenRight = Math.max(0, rect.right - viewportWidth);
|
|
63
|
+
const hiddenTop = Math.max(0, 0 - rect.top);
|
|
64
|
+
const hiddenBottom = Math.max(0, rect.bottom - viewportHeight);
|
|
65
|
+
const isPartiallyOutX = hiddenLeft > limitWidth || hiddenRight > limitWidth;
|
|
66
|
+
const isPartiallyOutY = hiddenTop > limitHeight || hiddenBottom > limitHeight;
|
|
67
|
+
if (isPartiallyOutX || isPartiallyOutY) {
|
|
68
|
+
setPosition({ x: 0, y: 0 });
|
|
69
|
+
}
|
|
70
|
+
setIsDragging(false);
|
|
71
|
+
};
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!isDragging)
|
|
74
|
+
return;
|
|
75
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
76
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
77
|
+
document.addEventListener('touchmove', handleTouchMove, { passive: false });
|
|
78
|
+
document.addEventListener('touchend', handleTouchEnd);
|
|
79
|
+
return () => {
|
|
80
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
81
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
82
|
+
document.removeEventListener('touchmove', handleTouchMove);
|
|
83
|
+
document.removeEventListener('touchend', handleTouchEnd);
|
|
84
|
+
};
|
|
85
|
+
}, [isDragging, dragStart]);
|
|
86
|
+
return (_jsx("div", { ref: draggableRef, className: className, style: {
|
|
87
|
+
...style,
|
|
88
|
+
transform: `translate(${position.x}px, ${position.y}px)`,
|
|
89
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
90
|
+
}, onMouseDown: handleMouseDown, onTouchStart: handleTouchStart, children: children }));
|
|
91
|
+
};
|
|
92
|
+
export default Draggable;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import './EntityItem.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type EntityItemAdditionalInfo = {
|
|
4
|
+
type: 'location';
|
|
5
|
+
locationName?: string;
|
|
6
|
+
hall?: string;
|
|
7
|
+
level?: string;
|
|
8
|
+
showLevelLabel?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'text';
|
|
11
|
+
text: string;
|
|
12
|
+
};
|
|
13
|
+
export interface EntityItemProps {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
typeColor?: string;
|
|
20
|
+
iconClassName?: string;
|
|
21
|
+
variant?: 'default' | 'person';
|
|
22
|
+
titleBadge?: string | number;
|
|
23
|
+
datetime?: {
|
|
24
|
+
date?: string;
|
|
25
|
+
time?: string;
|
|
26
|
+
};
|
|
27
|
+
subtitleLabel?: string;
|
|
28
|
+
additionalInfo?: EntityItemAdditionalInfo[];
|
|
29
|
+
bookmarked?: boolean;
|
|
30
|
+
featured?: boolean;
|
|
31
|
+
visited?: boolean;
|
|
32
|
+
current?: boolean;
|
|
33
|
+
heatmapColor?: string;
|
|
34
|
+
accentBorderColor?: string;
|
|
35
|
+
hideUserState?: boolean;
|
|
36
|
+
compactDetails?: boolean;
|
|
37
|
+
secondaryText?: string;
|
|
38
|
+
highlight?: string;
|
|
39
|
+
featuredLabel: string;
|
|
40
|
+
hallLabel: string;
|
|
41
|
+
levelLabel: string;
|
|
42
|
+
onClick?: (id: string) => void;
|
|
43
|
+
}
|
|
44
|
+
declare const EntityItem: ({ id, title, subtitle, image, icon, typeColor, iconClassName, variant, titleBadge, datetime, subtitleLabel, additionalInfo, bookmarked, featured, visited, current, heatmapColor, accentBorderColor, hideUserState, compactDetails, secondaryText, highlight, featuredLabel, hallLabel, levelLabel, onClick, }: EntityItemProps) => React.JSX.Element;
|
|
45
|
+
export default EntityItem;
|
|
46
|
+
//# sourceMappingURL=EntityItem.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './EntityItem.scss';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import HighlightText from '../HighlightText';
|
|
5
|
+
const EntityItem = ({ id, title, subtitle, image, icon, typeColor, iconClassName, variant = 'default', titleBadge, datetime, subtitleLabel, additionalInfo = [], bookmarked = false, featured = false, visited, current = false, heatmapColor, accentBorderColor, hideUserState = false, compactDetails, secondaryText, highlight, featuredLabel, hallLabel, levelLabel, onClick, }) => {
|
|
6
|
+
const hasDatetime = !!(datetime?.date || datetime?.time);
|
|
7
|
+
const hasSubtitleRow = hasDatetime || !!subtitleLabel || !!subtitle;
|
|
8
|
+
return (_jsx("div", { role: "button", className: cn('efp-entity-item', {
|
|
9
|
+
'is-featured': featured,
|
|
10
|
+
'is-visited': visited,
|
|
11
|
+
'is-current': current,
|
|
12
|
+
'has-heatmap': !!heatmapColor,
|
|
13
|
+
'has-accent': !!accentBorderColor,
|
|
14
|
+
'is-person': variant === 'person',
|
|
15
|
+
}), "aria-label": title, tabIndex: 0, "aria-current": current ? 'true' : undefined, onClick: () => onClick?.(id), onKeyDown: (e) => {
|
|
16
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
onClick?.(id);
|
|
19
|
+
}
|
|
20
|
+
}, style: {
|
|
21
|
+
...(typeColor ? { '--item-type-color': typeColor } : {}),
|
|
22
|
+
...(heatmapColor && { '--heatmap-color': heatmapColor }),
|
|
23
|
+
...(accentBorderColor &&
|
|
24
|
+
{ '--accent-border-color': accentBorderColor }),
|
|
25
|
+
}, children: _jsxs("div", { className: "efp-entity-item__body", children: [_jsxs("div", { className: "efp-entity-item__left", children: [_jsx("div", { className: "efp-entity-item__icon", children: icon ? (_jsx("img", { src: icon, alt: title })) : iconClassName ? (_jsx("i", { className: iconClassName, "aria-hidden": "true" })) : null }), !hideUserState && (_jsxs(_Fragment, { children: [visited && (_jsx("div", { className: "efp-entity-item__visited", children: _jsx("i", { className: "icon-checkmark" }) })), bookmarked && (_jsx("i", { className: cn('efp-entity-item__bookmarked', 'icon-bookmark-solid') }))] }))] }), _jsxs("div", { className: "efp-entity-item__right", children: [_jsxs("div", { className: cn('efp-entity-item__content', { 'with-image': image }), children: [_jsxs("div", { className: "efp-entity-item__header", children: [_jsxs("div", { className: "efp-entity-item__title", children: [_jsx(HighlightText, { text: title, highlight: highlight }), secondaryText && (_jsx("div", { className: "efp-entity-item__description", children: _jsx(HighlightText, { text: secondaryText, highlight: highlight }) })), titleBadge !== undefined && _jsx("span", { children: titleBadge })] }), featured && _jsx("div", { className: "efp-entity-item__featured", children: featuredLabel })] }), hasSubtitleRow && (_jsxs("div", { className: "efp-entity-item__subtitle", children: [hasDatetime && (_jsxs("div", { className: "efp-entity-item__datetime", children: [datetime?.date && _jsx("strong", { children: datetime.date }), datetime?.time && _jsx("span", { children: datetime.time })] })), subtitleLabel && _jsx("span", { children: subtitleLabel }), subtitle && _jsx("div", { children: subtitle })] })), !!additionalInfo.length && (_jsx("ul", { className: cn('efp-entity-item__details', {
|
|
26
|
+
'compact-details': compactDetails,
|
|
27
|
+
}), children: additionalInfo.map((info, idx) => (_jsxs("li", { className: "efp-entity-item__details-item", children: [info.type === 'location' && (_jsxs(_Fragment, { children: [info.locationName && (_jsx("div", { className: "efp-entity-item__details-item-booth", children: _jsx(HighlightText, { text: info.locationName, highlight: highlight }) })), info.hall && (_jsxs("div", { children: [hallLabel, "\u00A0", _jsx("span", { children: info.hall })] })), info.level && (_jsxs("div", { children: [info.showLevelLabel && _jsxs("span", { children: [levelLabel, "\u00A0"] }), _jsx("span", { children: info.level })] }))] })), info.type === 'text' && _jsx("span", { children: info.text })] }, idx))) }))] }), image && (_jsx("div", { className: "efp-entity-item__image", children: _jsx("img", { src: image, alt: title }) }))] })] }) }));
|
|
28
|
+
};
|
|
29
|
+
export default EntityItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EntityItem';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './EventBadge.scss';
|
|
2
|
+
export type EventBadgeStatus = 'live' | 'upcoming' | 'starting-soon' | 'past' | 'none';
|
|
3
|
+
export interface EventBadgeProps {
|
|
4
|
+
status: EventBadgeStatus;
|
|
5
|
+
statusLabel?: string;
|
|
6
|
+
showFullBadge?: boolean;
|
|
7
|
+
fullLabel: string;
|
|
8
|
+
isUrgent?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const EventBadge: ({ status, statusLabel, showFullBadge, fullLabel, isUrgent, className, }: EventBadgeProps) => import("react").JSX.Element | null;
|
|
12
|
+
export default EventBadge;
|
|
13
|
+
//# sourceMappingURL=EventBadge.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './EventBadge.scss';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
const EventBadge = ({ status, statusLabel, showFullBadge = false, fullLabel, isUrgent = false, className = '', }) => {
|
|
5
|
+
const mainBadge = status !== 'none' ? (_jsx("div", { className: classNames('efp-event-badge', `efp-event-badge--${status}`, { 'is-urgent': isUrgent }, className), children: statusLabel })) : null;
|
|
6
|
+
if (!mainBadge && !showFullBadge)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsxs(_Fragment, { children: [mainBadge, showFullBadge && (_jsx("div", { className: classNames('efp-event-badge', 'efp-event-badge--full', className), children: fullLabel }))] }));
|
|
9
|
+
};
|
|
10
|
+
export default EventBadge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EventBadge';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './Gallery.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { GalleryImage } from './types';
|
|
4
|
+
export interface GalleryProps {
|
|
5
|
+
images: GalleryImage[];
|
|
6
|
+
leading?: boolean;
|
|
7
|
+
closeLabel: string;
|
|
8
|
+
zoomInLabel: string;
|
|
9
|
+
zoomOutLabel: string;
|
|
10
|
+
nextSlideLabel: string;
|
|
11
|
+
prevSlideLabel: string;
|
|
12
|
+
fullscreenLabel: string;
|
|
13
|
+
itemLabel: (index: number) => string;
|
|
14
|
+
renderTarget?: HTMLElement | null;
|
|
15
|
+
onImageLoadHeightUpdate?: () => void;
|
|
16
|
+
/** Fired with the index of the slide shown fullscreen, on open and on slide change. */
|
|
17
|
+
onSlideActivate?: (index: number) => void;
|
|
18
|
+
onOpenGallery?: () => void;
|
|
19
|
+
onCloseGallery?: () => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const Gallery: (props: GalleryProps) => React.JSX.Element;
|
|
23
|
+
export default Gallery;
|
|
24
|
+
//# sourceMappingURL=Gallery.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Gallery.scss';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import GalleryBadges from './GalleryBadges/GalleryBadges';
|
|
6
|
+
import GalleryItem from './GalleryItem/GalleryItem';
|
|
7
|
+
import GalleryModal from './GalleryModal/GalleryModal';
|
|
8
|
+
const Gallery = (props) => {
|
|
9
|
+
const { images, leading = false, closeLabel, zoomInLabel, zoomOutLabel, nextSlideLabel, prevSlideLabel, fullscreenLabel, itemLabel, renderTarget, onImageLoadHeightUpdate, onSlideActivate, onOpenGallery, onCloseGallery, className, } = props;
|
|
10
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
11
|
+
const [currentSlideIndex, setCurrentSlideIndex] = useState(0);
|
|
12
|
+
const openModal = (initialSlideIndex) => {
|
|
13
|
+
// No portal target, no modal — and no opening to report either.
|
|
14
|
+
if (!renderTarget)
|
|
15
|
+
return;
|
|
16
|
+
setCurrentSlideIndex(initialSlideIndex);
|
|
17
|
+
setIsModalOpen(true);
|
|
18
|
+
onOpenGallery?.();
|
|
19
|
+
};
|
|
20
|
+
const closeModal = () => {
|
|
21
|
+
setIsModalOpen(false);
|
|
22
|
+
onCloseGallery?.();
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: classNames('efp-gallery', {
|
|
25
|
+
'efp-gallery--leading': leading,
|
|
26
|
+
}, className), children: [_jsx("div", { className: "efp-gallery__wrapper", children: leading ? (_jsx(GalleryItem, { url: images[0].thumbnailUrl, index: 0, itemLabel: itemLabel, leading: leading, autoHeight: true, fillMode: "contain", onClick: () => openModal(0), onImageLoadHeightUpdate: onImageLoadHeightUpdate })) : (images.map((image, i) => (_jsx(GalleryItem, { url: image.thumbnailUrl, index: i, itemLabel: itemLabel, position: "top", fillMode: "cover", onClick: () => openModal(i), onImageLoadHeightUpdate: onImageLoadHeightUpdate }, image.thumbnailUrl + i)))) }), !leading && (_jsx(GalleryBadges, { fullscreenLabel: fullscreenLabel, onFullscreen: () => openModal(0), count: images.length }))] }), isModalOpen && renderTarget && (_jsx(GalleryModal, { className: className, images: images, leading: leading, initialSlideIndex: currentSlideIndex, closeLabel: closeLabel, zoomInLabel: zoomInLabel, zoomOutLabel: zoomOutLabel, nextSlideLabel: nextSlideLabel, prevSlideLabel: prevSlideLabel, itemLabel: itemLabel, renderTarget: renderTarget, onSlideActivate: onSlideActivate, onClose: closeModal }))] }));
|
|
27
|
+
};
|
|
28
|
+
export default Gallery;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface GalleryBadgesProps {
|
|
2
|
+
count: number;
|
|
3
|
+
fullscreenLabel: string;
|
|
4
|
+
onFullscreen: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const GalleryBadges: ({ count, fullscreenLabel, onFullscreen }: GalleryBadgesProps) => import("react").JSX.Element;
|
|
7
|
+
export default GalleryBadges;
|
|
8
|
+
//# sourceMappingURL=GalleryBadges.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const GalleryBadges = ({ count, fullscreenLabel, onFullscreen }) => {
|
|
3
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "efp-gallery__badge efp-gallery__badge-count", children: [_jsx("i", { className: "icon-image", "aria-hidden": "true" }), _jsx("span", { children: count })] }), _jsx("button", { type: "button", className: "efp-gallery__badge efp-gallery__badge-fullscreen", "aria-label": fullscreenLabel, title: fullscreenLabel, onClick: onFullscreen, children: _jsx("i", { className: "icon-maximize", "aria-hidden": "true" }) })] }));
|
|
4
|
+
};
|
|
5
|
+
export default GalleryBadges;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface GalleryControlsProps {
|
|
2
|
+
closeLabel: string;
|
|
3
|
+
zoomInLabel: string;
|
|
4
|
+
zoomOutLabel: string;
|
|
5
|
+
zoomIn: () => void;
|
|
6
|
+
zoomOut: () => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const GalleryControls: ({ closeLabel, zoomInLabel, zoomOutLabel, zoomIn, zoomOut, onClose, }: GalleryControlsProps) => import("react").JSX.Element;
|
|
10
|
+
export default GalleryControls;
|
|
11
|
+
//# sourceMappingURL=GalleryControls.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const GalleryControls = ({ closeLabel, zoomInLabel, zoomOutLabel, zoomIn, zoomOut, onClose, }) => {
|
|
3
|
+
return (_jsxs("div", { className: "efp-gallery-slider__controls", children: [_jsx("button", { type: "button", className: "efp-gallery-slider__btn efp-gallery-slider__btn--close", title: closeLabel, "aria-label": closeLabel, onClick: onClose, children: _jsx("i", { className: "icon-close", "aria-hidden": "true" }) }), _jsx("button", { type: "button", className: "efp-gallery-slider__btn efp-gallery-slider__btn--zoom-in", title: zoomInLabel, "aria-label": zoomInLabel, onClick: () => zoomIn(), children: _jsx("i", { className: "icon-zoom-in", "aria-hidden": "true" }) }), _jsx("button", { type: "button", className: "efp-gallery-slider__btn efp-gallery-slider__btn--zoom-out", title: zoomOutLabel, "aria-label": zoomOutLabel, onClick: () => zoomOut(), children: _jsx("i", { className: "icon-zoom-out", "aria-hidden": "true" }) })] }));
|
|
4
|
+
};
|
|
5
|
+
export default GalleryControls;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type FillMode = 'cover' | 'contain';
|
|
2
|
+
export interface GalleryImgProps {
|
|
3
|
+
url: string;
|
|
4
|
+
fillMode?: FillMode;
|
|
5
|
+
leading?: boolean;
|
|
6
|
+
autoHeight?: boolean;
|
|
7
|
+
fullscreen?: boolean;
|
|
8
|
+
position?: 'center' | 'top';
|
|
9
|
+
onImageLoadHeightUpdate?: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const GalleryImg: ({ url, autoHeight, position, fullscreen, leading, fillMode, onImageLoadHeightUpdate, }: GalleryImgProps) => import("react").JSX.Element;
|
|
12
|
+
export default GalleryImg;
|
|
13
|
+
//# sourceMappingURL=GalleryImg.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import GalleryPreLoader from '../GalleryPreLoader';
|
|
4
|
+
const GalleryImg = ({ url, autoHeight = false, position = 'center', fullscreen = false, leading = false, fillMode = 'contain', onImageLoadHeightUpdate, }) => {
|
|
5
|
+
const imgRef = useRef(null);
|
|
6
|
+
const containerRef = useRef(null);
|
|
7
|
+
const loadImage = useCallback(async (imageUrl) => {
|
|
8
|
+
if (!autoHeight || !containerRef.current)
|
|
9
|
+
return;
|
|
10
|
+
const container = containerRef.current;
|
|
11
|
+
try {
|
|
12
|
+
const loadedImage = await GalleryPreLoader.load(imageUrl);
|
|
13
|
+
if (!loadedImage)
|
|
14
|
+
return;
|
|
15
|
+
container.style.height =
|
|
16
|
+
(loadedImage.height * container.clientWidth) / loadedImage.width + 'px';
|
|
17
|
+
onImageLoadHeightUpdate?.();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// image failed to load — keep default height
|
|
21
|
+
}
|
|
22
|
+
}, [autoHeight, onImageLoadHeightUpdate]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!imgRef.current || !containerRef.current || !leading)
|
|
25
|
+
return;
|
|
26
|
+
void loadImage(url);
|
|
27
|
+
}, [url, leading, loadImage]);
|
|
28
|
+
const style = {
|
|
29
|
+
backgroundImage: `url("${url}")`,
|
|
30
|
+
backgroundSize: fillMode,
|
|
31
|
+
backgroundRepeat: 'no-repeat',
|
|
32
|
+
transition: leading ? 'all 0.5s ease 0s' : 'none',
|
|
33
|
+
backgroundPosition: position,
|
|
34
|
+
};
|
|
35
|
+
return (_jsx("div", { ref: containerRef, style: { width: '100%', height: leading && !fullscreen ? '250px' : '100%' }, children: _jsx("div", { ref: imgRef, className: "efp-gallery__img", style: style }) }));
|
|
36
|
+
};
|
|
37
|
+
export default GalleryImg;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface GalleryItemProps {
|
|
2
|
+
url: string;
|
|
3
|
+
index: number;
|
|
4
|
+
itemLabel: (index: number) => string;
|
|
5
|
+
leading?: boolean;
|
|
6
|
+
autoHeight?: boolean;
|
|
7
|
+
fillMode?: 'cover' | 'contain';
|
|
8
|
+
position?: 'center' | 'top';
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
onImageLoadHeightUpdate?: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const GalleryItem: ({ url, index, itemLabel, position, leading, autoHeight, fillMode, onClick, onImageLoadHeightUpdate, }: GalleryItemProps) => import("react").JSX.Element;
|
|
13
|
+
export default GalleryItem;
|
|
14
|
+
//# sourceMappingURL=GalleryItem.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import GalleryImg from '../GalleryImg/GalleryImg';
|
|
3
|
+
const GalleryItem = ({ url, index, itemLabel, position = 'center', leading = false, autoHeight = false, fillMode, onClick, onImageLoadHeightUpdate, }) => {
|
|
4
|
+
return (_jsx("button", { type: "button", className: "efp-gallery__item", "aria-label": itemLabel(index), onClick: onClick, children: _jsx(GalleryImg, { position: position, fillMode: fillMode, url: url, leading: leading, autoHeight: autoHeight, onImageLoadHeightUpdate: onImageLoadHeightUpdate }) }));
|
|
5
|
+
};
|
|
6
|
+
export default GalleryItem;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './GalleryModal.scss';
|
|
2
|
+
import type { GalleryImage } from '../types';
|
|
3
|
+
export interface GalleryModalProps {
|
|
4
|
+
images: GalleryImage[];
|
|
5
|
+
leading: boolean;
|
|
6
|
+
initialSlideIndex: number;
|
|
7
|
+
closeLabel: string;
|
|
8
|
+
zoomInLabel: string;
|
|
9
|
+
zoomOutLabel: string;
|
|
10
|
+
nextSlideLabel: string;
|
|
11
|
+
prevSlideLabel: string;
|
|
12
|
+
itemLabel: (index: number) => string;
|
|
13
|
+
renderTarget: HTMLElement;
|
|
14
|
+
onSlideActivate?: (index: number) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const GalleryModal: (props: GalleryModalProps) => import("react").ReactPortal;
|
|
19
|
+
export default GalleryModal;
|
|
20
|
+
//# sourceMappingURL=GalleryModal.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './GalleryModal.scss';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { TransformWrapper } from 'react-zoom-pan-pinch-sr';
|
|
7
|
+
import { Navigation } from 'swiper';
|
|
8
|
+
import { Swiper as SwiperComponent, SwiperSlide } from 'swiper/react';
|
|
9
|
+
import { getActiveElement } from '../../../shared/activeElement';
|
|
10
|
+
import useOnEscape from '../../../shared/hooks/useOnEscape';
|
|
11
|
+
import GalleryControls from '../GalleryControls/GalleryControls';
|
|
12
|
+
import TransformImg from '../TransformImg/TransformImg';
|
|
13
|
+
const isElementVisible = (el) => el.getClientRects().length > 0 && getComputedStyle(el).visibility !== 'hidden';
|
|
14
|
+
const GalleryModal = (props) => {
|
|
15
|
+
const { images, leading, initialSlideIndex, closeLabel, zoomInLabel, zoomOutLabel, nextSlideLabel, prevSlideLabel, itemLabel, renderTarget, onSlideActivate, onClose, className, } = props;
|
|
16
|
+
const [currentSlideIndex, setCurrentSlideIndex] = useState(initialSlideIndex);
|
|
17
|
+
const [zoomUtils, setZoomUtils] = useState([]);
|
|
18
|
+
const swiperRef = useRef(null);
|
|
19
|
+
const prevRef = useRef(null);
|
|
20
|
+
const nextRef = useRef(null);
|
|
21
|
+
const modalRef = useRef(null);
|
|
22
|
+
useOnEscape(onClose);
|
|
23
|
+
// Scroll lock + focus trap/restore. Runs once for the modal's whole mounted
|
|
24
|
+
// lifetime — the parent only mounts this component while the modal is open.
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const previousFocus = getActiveElement(modalRef.current);
|
|
27
|
+
const previousBodyOverflow = document.body.style.overflow;
|
|
28
|
+
document.body.style.overflow = 'hidden';
|
|
29
|
+
let inner = 0;
|
|
30
|
+
const outer = requestAnimationFrame(() => {
|
|
31
|
+
inner = requestAnimationFrame(() => modalRef.current?.focus());
|
|
32
|
+
});
|
|
33
|
+
const handleKeyDown = (e) => {
|
|
34
|
+
if (e.key !== 'Tab')
|
|
35
|
+
return;
|
|
36
|
+
const container = modalRef.current;
|
|
37
|
+
if (!container)
|
|
38
|
+
return;
|
|
39
|
+
const focusable = Array.from(container.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(isElementVisible);
|
|
40
|
+
if (focusable.length === 0) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const first = focusable[0];
|
|
45
|
+
const last = focusable[focusable.length - 1];
|
|
46
|
+
const active = getActiveElement(container);
|
|
47
|
+
if (e.shiftKey) {
|
|
48
|
+
if (active === first || active === container) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
last.focus();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (active === last) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
first.focus();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
59
|
+
return () => {
|
|
60
|
+
cancelAnimationFrame(outer);
|
|
61
|
+
cancelAnimationFrame(inner);
|
|
62
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
63
|
+
document.body.style.overflow = previousBodyOverflow;
|
|
64
|
+
previousFocus?.focus();
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
onSlideActivate?.(currentSlideIndex);
|
|
69
|
+
}, [currentSlideIndex, onSlideActivate]);
|
|
70
|
+
const mainSliderOptions = {
|
|
71
|
+
initialSlide: initialSlideIndex,
|
|
72
|
+
draggable: false,
|
|
73
|
+
modules: [Navigation],
|
|
74
|
+
spaceBetween: 50,
|
|
75
|
+
slidesPerView: 1,
|
|
76
|
+
navigation: {
|
|
77
|
+
prevEl: prevRef.current,
|
|
78
|
+
nextEl: nextRef.current,
|
|
79
|
+
},
|
|
80
|
+
grabCursor: true,
|
|
81
|
+
};
|
|
82
|
+
const modalContent = (_jsx("div", { className: classNames('efp-gallery-modal', className), role: "dialog", "aria-modal": "true", "aria-label": itemLabel(currentSlideIndex), ref: modalRef, tabIndex: -1, children: _jsxs(SwiperComponent, { onSwiper: (swiper) => (swiperRef.current = swiper), className: "efp-gallery-slider", onSlideChange: (swiper) => {
|
|
83
|
+
setCurrentSlideIndex(swiper.activeIndex);
|
|
84
|
+
zoomUtils[swiper.previousIndex]?.resetTransform();
|
|
85
|
+
}, ...mainSliderOptions, children: [zoomUtils[currentSlideIndex] ? (_jsx(GalleryControls, { closeLabel: closeLabel, zoomInLabel: zoomInLabel, zoomOutLabel: zoomOutLabel, onClose: onClose, zoomIn: zoomUtils[currentSlideIndex].zoomIn, zoomOut: zoomUtils[currentSlideIndex].zoomOut })) : null, images.length > 1 && (_jsx("button", { type: "button", ref: nextRef, title: nextSlideLabel, "aria-label": nextSlideLabel, className: "efp-gallery-slider__btn efp-gallery-slider__btn--next", children: _jsx("i", { className: "icon-chevron-right", "aria-hidden": "true" }) })), images.length > 1 && (_jsx("button", { type: "button", ref: prevRef, title: prevSlideLabel, "aria-label": prevSlideLabel, className: "efp-gallery-slider__btn efp-gallery-slider__btn--prev", children: _jsx("i", { className: "icon-chevron-left", "aria-hidden": "true" }) })), images.map((image, i) => (_jsx(SwiperSlide, { children: _jsx(TransformWrapper, { initialScale: 1, alignmentAnimation: { sizeX: 0, sizeY: 0 }, onInit: (controls) => {
|
|
86
|
+
setZoomUtils((state) => [...state, controls]);
|
|
87
|
+
}, children: _jsx(TransformImg, { leading: leading, swiperRef: swiperRef, url: image.fullUrl }) }) }, image.thumbnailUrl + i)))] }) }));
|
|
88
|
+
return createPortal(modalContent, renderTarget);
|
|
89
|
+
};
|
|
90
|
+
export default GalleryModal;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class GalleryPreLoader {
|
|
2
|
+
cache = [];
|
|
3
|
+
load = (url) => {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
if (!url) {
|
|
6
|
+
resolve(null);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const cached = this.cache.find((i) => i.src === url);
|
|
10
|
+
if (cached) {
|
|
11
|
+
resolve(cached);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const image = new Image();
|
|
15
|
+
image.crossOrigin = 'anonymous';
|
|
16
|
+
image.src = url;
|
|
17
|
+
image.onload = () => {
|
|
18
|
+
if (this.cache.length > 10)
|
|
19
|
+
this.cache.shift();
|
|
20
|
+
this.cache.push(image);
|
|
21
|
+
resolve(image);
|
|
22
|
+
};
|
|
23
|
+
image.onerror = () => {
|
|
24
|
+
reject(new Error(`Failed to load image: ${url}`));
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default new GalleryPreLoader();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Swiper as SwiperInstance } from 'swiper';
|
|
3
|
+
export interface TransformImgProps {
|
|
4
|
+
swiperRef: React.RefObject<SwiperInstance | null>;
|
|
5
|
+
url: string;
|
|
6
|
+
leading: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const TransformImg: ({ swiperRef, leading, url }: TransformImgProps) => React.JSX.Element;
|
|
9
|
+
export default TransformImg;
|
|
10
|
+
//# sourceMappingURL=TransformImg.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TransformComponent, useTransformEffect } from 'react-zoom-pan-pinch-sr';
|
|
3
|
+
import GalleryImg from '../GalleryImg/GalleryImg';
|
|
4
|
+
const TransformImg = ({ swiperRef, leading, url }) => {
|
|
5
|
+
useTransformEffect(({ state, instance }) => {
|
|
6
|
+
if (!swiperRef.current)
|
|
7
|
+
return;
|
|
8
|
+
swiperRef.current.allowTouchMove = state.scale === 1;
|
|
9
|
+
if (state.scale === 1 && state.positionX !== 0 && state.positionY !== 0) {
|
|
10
|
+
instance.setCenter();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return (_jsx(TransformComponent, { wrapperClass: "efp-gallery-slider__zoom", contentClass: "efp-gallery-slider__zoom-content", children: _jsx(GalleryImg, { fullscreen: true, leading: leading, url: url }) }));
|
|
14
|
+
};
|
|
15
|
+
export default TransformImg;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Gallery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|