@yamatozhen/design_system 1.0.1 → 1.1.0

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 (184) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +101 -101
  3. package/package.json +50 -50
  4. package/scripts/postinstall.js +91 -91
  5. package/template/app/ClientNav.tsx +258 -310
  6. package/template/app/globals.css +2 -167
  7. package/template/app/layout.tsx +94 -82
  8. package/template/app/themes/dark-mc 2.css +51 -0
  9. package/template/app/themes/dark-mc.css +51 -51
  10. package/template/app/themes/dark.css +51 -51
  11. package/template/app/themes/light 2.css +51 -0
  12. package/template/app/themes/light-mc 2.css +51 -0
  13. package/template/app/themes/light-mc.css +51 -51
  14. package/template/app/themes/light.css +51 -51
  15. package/template/app/themes/theme 2.css +272 -0
  16. package/template/app/themes/theme.css +272 -82
  17. package/template/components/{layout/button → (buttons)}/Button.module.css +351 -305
  18. package/template/components/{layout/button → (buttons)}/ButtonGroup.tsx +414 -503
  19. package/template/components/{layout/button → (buttons)}/FAB.tsx +119 -118
  20. package/template/components/(buttons)/button.tsx +164 -0
  21. package/template/components/(controls)/slider/Slider.module.css +250 -0
  22. package/template/components/(controls)/slider/Slider.tsx +386 -0
  23. package/template/components/(controls)/switch/Switch.module.css +108 -0
  24. package/template/components/(controls)/switch/Switch.tsx +69 -0
  25. package/template/components/(date & time)/calendar/Calendar.module.css +125 -0
  26. package/template/components/(date & time)/calendar/Calendar.tsx +206 -0
  27. package/template/components/(date & time)/dateField/DateField.module.css +25 -0
  28. package/template/components/(date & time)/dateField/DateField.tsx +193 -0
  29. package/template/components/(date & time)/datePicker/DatePicker.tsx +118 -0
  30. package/template/components/(date & time)/dateRangePicker/DateRangePicker.tsx +144 -0
  31. package/template/components/(date & time)/rangeCalendar/RangeCalendar.module.css +203 -0
  32. package/template/components/(date & time)/rangeCalendar/RangeCalendar.tsx +263 -0
  33. package/template/components/(date & time)/shared/dateUtils.ts +107 -0
  34. package/template/components/(date & time)/timeField/TimeField.module.css +39 -0
  35. package/template/components/(date & time)/timeField/TimeField.tsx +158 -0
  36. package/template/components/(feedback)/circularProgress/CircularProgress.tsx +646 -0
  37. package/template/components/(feedback)/linearProgress/LinearProgress.tsx +337 -0
  38. package/template/components/(feedback)/meter/Meter.tsx +111 -0
  39. package/template/components/(feedback)/skeleton/Skeleton.module.css +49 -0
  40. package/template/components/(feedback)/skeleton/Skeleton.tsx +32 -0
  41. package/template/components/(feedback)/spinner/Spinner.module.css +27 -0
  42. package/template/components/(feedback)/spinner/Spinner.tsx +60 -0
  43. package/template/components/(forms)/checkbox/Checkbox.tsx +121 -0
  44. package/template/components/(forms)/checkboxGroup/CheckboxGroup.tsx +83 -0
  45. package/template/components/(forms)/description/Description.tsx +34 -0
  46. package/template/components/(forms)/errorMessage/ErrorMessage.tsx +31 -0
  47. package/template/components/(forms)/fieldError/FieldError.tsx +39 -0
  48. package/template/components/(forms)/fieldset/Fieldset.tsx +51 -0
  49. package/template/components/(forms)/form/Form.tsx +54 -0
  50. package/template/components/(forms)/input/Input.tsx +50 -0
  51. package/template/components/(forms)/inputGroup/InputGroup.tsx +65 -0
  52. package/template/components/(forms)/inputOtp/InputOtp.tsx +139 -0
  53. package/template/components/(forms)/label/Label.tsx +46 -0
  54. package/template/components/(forms)/numberField/NumberField.tsx +292 -0
  55. package/template/components/(forms)/radioGroup/RadioGroup.tsx +175 -0
  56. package/template/components/(forms)/searchField/SearchField.tsx +139 -0
  57. package/template/components/(forms)/shared/field.module.css +75 -0
  58. package/template/components/(forms)/shared/fieldContext.ts +28 -0
  59. package/template/components/(forms)/textArea/TextArea.tsx +55 -0
  60. package/template/components/(forms)/textField/TextField.tsx +91 -0
  61. package/template/components/{layout → (layout)}/Lightbox/LightboxCard.tsx +100 -100
  62. package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.module.css +249 -249
  63. package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.tsx +72 -72
  64. package/template/components/{layout → (layout)}/Lightbox/LightboxGrid.tsx +185 -186
  65. package/template/components/{layout → (layout)}/Lightbox/LightboxModal.module.css +395 -395
  66. package/template/components/{layout → (layout)}/Lightbox/LightboxModal.tsx +498 -500
  67. package/template/components/{layout → (layout)}/Lightbox/demo.tsx +396 -412
  68. package/template/components/{layout → (layout)}/Lightbox/index.ts +30 -30
  69. package/template/components/{layout → (layout)}/Lightbox/types.ts +101 -113
  70. package/template/components/{layout → (layout)}/Lightbox/useLightboxFilters.ts +140 -140
  71. package/template/components/(layout)/accordion/Accordion.module.css +108 -0
  72. package/template/components/(layout)/accordion/Accordion.tsx +251 -0
  73. package/template/components/(layout)/card/Card.module.css +136 -0
  74. package/template/components/(layout)/card/Card.tsx +371 -0
  75. package/template/components/(layout)/list/List.module.css +83 -0
  76. package/template/components/(layout)/list/List.tsx +332 -0
  77. package/template/components/{layout → (layout)}/navigation/Wrap.tsx +41 -41
  78. package/template/components/(layout)/navigation/breadcrumbs/Breadcrumbs.tsx +145 -0
  79. package/template/components/{layout/navigation/nav/Nav.module.css → (layout)/navigation/nav/Nav.module.css.old} +474 -508
  80. package/template/components/{layout → (layout)}/navigation/nav/Nav.tsx +186 -167
  81. package/template/components/{layout → (layout)}/navigation/nav/NavBar.tsx +396 -419
  82. package/template/components/{layout → (layout)}/navigation/nav/NavContext.tsx +259 -259
  83. package/template/components/{layout → (layout)}/navigation/nav/NavItem.tsx +195 -173
  84. package/template/components/{layout → (layout)}/navigation/nav/NavNew.module.css +406 -373
  85. package/template/components/{layout → (layout)}/navigation/nav/NavRail.tsx +317 -315
  86. package/template/components/{layout → (layout)}/navigation/nav/NavSection.tsx +101 -102
  87. package/template/components/{layout → (layout)}/navigation/nav/NavTab.tsx +25 -25
  88. package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.module.css +253 -252
  89. package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.tsx +448 -399
  90. package/template/components/{layout → (layout)}/navigation/nav/navftb/useTabIndicator.ts +498 -484
  91. package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.module.css +59 -59
  92. package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.tsx +465 -473
  93. package/template/components/(layout)/navigation/pagination/Pagination.tsx +261 -0
  94. package/template/components/{layout → (layout)}/pages/loadingScreen.tsx +117 -102
  95. package/template/components/{layout → (layout)}/pages/maintenance/Maintenance.tsx +52 -52
  96. package/template/components/{layout → (layout)}/pages/maintenance/maintenance.module.css +162 -162
  97. package/template/components/(layout)/scrollShadow/ScrollShadow.module.css +81 -0
  98. package/template/components/(layout)/scrollShadow/ScrollShadow.tsx +161 -0
  99. package/template/components/(layout)/scrollShadow/useScrollShadow.ts +130 -0
  100. package/template/components/(layout)/separator/Separator.tsx +112 -0
  101. package/template/components/(overlays)/accessibilityModal/AccessibilityModal.tsx +307 -0
  102. package/template/components/(overlays)/drawer/Drawer.tsx +953 -0
  103. package/template/components/(overlays)/modal/Modal.tsx +654 -0
  104. package/template/components/(overlays)/popover/Popover.tsx +420 -0
  105. package/template/components/(overlays)/toast/Toast.tsx +692 -0
  106. package/template/components/(pickers)/autocomplete/Autocomplete.tsx +24 -0
  107. package/template/components/(pickers)/comboBox/ComboBox.tsx +21 -0
  108. package/template/components/(pickers)/select/Select.tsx +188 -0
  109. package/template/components/(pickers)/shared/FilterableField.tsx +223 -0
  110. package/template/components/(pickers)/shared/PickerItem.ts +13 -0
  111. package/template/components/tools/CustomScrollbar 2.tsx +107 -0
  112. package/template/components/tools/CustomScrollbar.tsx +107 -0
  113. package/template/components/tools/Divider 2.tsx +11 -0
  114. package/template/components/tools/Divider.tsx +11 -11
  115. package/template/components/tools/ReduceMotionContext 2.tsx +5 -0
  116. package/template/components/tools/ReduceMotionContext.tsx +5 -5
  117. package/template/components/tools/Sinewave 2.tsx +206 -0
  118. package/template/components/tools/Sinewave.tsx +396 -199
  119. package/template/components/tools/SinewaveProgress 2.tsx +140 -0
  120. package/template/components/tools/SinewaveProgress.tsx +140 -135
  121. package/template/components/tools/badge/Badge 2.tsx +28 -0
  122. package/template/components/tools/badge/Badge.tsx +28 -28
  123. package/template/components/tools/dropdown/drop.module.css +196 -0
  124. package/template/components/tools/dropdown/drop.tsx +568 -0
  125. package/template/components/tools/easing.ts +118 -0
  126. package/template/components/tools/flubber.d 2.ts +7 -0
  127. package/template/components/tools/flubber.d.ts +6 -6
  128. package/template/components/tools/footer/Footer.tsx +20 -0
  129. package/template/components/tools/input/Input 2.tsx +99 -0
  130. package/template/components/tools/input/Input.module 2.css +45 -0
  131. package/template/components/tools/input/Input.module.css +45 -0
  132. package/template/components/tools/input/Input.tsx +99 -0
  133. package/template/components/tools/label/Icon 2.tsx +39 -0
  134. package/template/components/tools/label/Icon.tsx +39 -0
  135. package/template/components/tools/label/Label 2.tsx +150 -0
  136. package/template/components/tools/label/Label.tsx +156 -0
  137. package/template/components/tools/mobileViewProvider 2.tsx +53 -0
  138. package/template/components/tools/mobileViewProvider.tsx +53 -58
  139. package/template/components/tools/ripple/ripple 2.css +38 -0
  140. package/template/components/tools/ripple/ripple 2.tsx +78 -0
  141. package/template/components/tools/ripple/ripple.css +38 -41
  142. package/template/components/tools/ripple/ripple.tsx +78 -53
  143. package/template/components/tools/shape/{ShapeMorph.tsx → Shape 2.tsx } +313 -190
  144. package/template/components/tools/shape/Shape.module 2.css +21 -0
  145. package/template/components/tools/shape/Shape.module.css +25 -0
  146. package/template/components/tools/shape/Shape.tsx +316 -0
  147. package/template/components/tools/shape/ShapeLoader 2.tsx +104 -0
  148. package/template/components/tools/shape/ShapeLoader.tsx +104 -101
  149. package/template/components/tools/shape/ShapePaths 2.ts +116 -0
  150. package/template/components/tools/shape/ShapePaths.ts +116 -116
  151. package/template/components/{layout/switch/Switch.tsx → tools/switch/Switch 2.tsx } +48 -48
  152. package/template/components/{layout/switch/Switch.module.css → tools/switch/Switch.module 2.css } +102 -102
  153. package/template/components/tools/switch/Switch.module.css +102 -102
  154. package/template/components/tools/switch/Switch.tsx +48 -48
  155. package/template/components/tools/useBodyScrollLock 2.tsx +27 -0
  156. package/template/components/tools/useBodyScrollLock.tsx +27 -27
  157. package/template/components/tools/useImageColor 2.ts +47 -0
  158. package/template/components/tools/useImageColor.ts +47 -47
  159. package/template/components/tools/useNavSheetDrag 2.tsx +196 -0
  160. package/template/components/tools/useNavSheetDrag.tsx +196 -196
  161. package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght 2.woff2 +0 -0
  162. package/template/components/layout/accordion/Accordion.module.css +0 -149
  163. package/template/components/layout/accordion/Accordion.tsx +0 -114
  164. package/template/components/layout/button/button.tsx +0 -128
  165. package/template/components/layout/button/drop.module.css +0 -229
  166. package/template/components/layout/button/drop.tsx +0 -516
  167. package/template/components/layout/hero/v1/heroSlideshow.module.css +0 -107
  168. package/template/components/layout/hero/v1/heroSlideshow.tsx +0 -233
  169. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +0 -126
  170. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +0 -290
  171. package/template/components/layout/modals/alert/Alert.tsx +0 -188
  172. package/template/components/layout/navigation/MioCard.module.css +0 -88
  173. package/template/components/layout/navigation/MioCard.tsx +0 -266
  174. package/template/components/tools/ProgressiveBlur.tsx +0 -73
  175. package/template/components/tools/icon/icon.module.css +0 -0
  176. package/template/components/tools/icon/icon.tsx +0 -125
  177. package/template/components/tools/react-bits/ClickSpark.tsx +0 -177
  178. package/template/components/tools/react-bits/FadeContent.tsx +0 -90
  179. package/template/components/tools/react-bits/GlareHover.tsx +0 -73
  180. package/template/components/tools/react-bits/GradientText/GradientText.css +0 -70
  181. package/template/components/tools/react-bits/GradientText/GradientText.tsx +0 -44
  182. package/template/components/tools/react-bits/Magnet.tsx +0 -118
  183. package/template/components/tools/react-bits/Stepper/Stepper.css +0 -134
  184. package/template/components/tools/react-bits/Stepper/Stepper.tsx +0 -412
@@ -1,500 +1,498 @@
1
- "use client";
2
-
3
- import {
4
- useCallback,
5
- useEffect,
6
- useRef,
7
- useState,
8
- type AnimationEvent as ReactAnimationEvent,
9
- type MouseEvent as ReactMouseEvent,
10
- } from "react";
11
- import { createPortal } from "react-dom";
12
- import Image from "next/image";
13
- import type { LightboxItem } from "./types";
14
- import styles from "./LightboxModal.module.css";
15
- import Button from "../button/button";
16
- import Icon from "@/components/tools/icon/icon";
17
- import {
18
- BREAKPOINTS,
19
- useBreakpoints,
20
- useMediaQuery,
21
- } from "@/components/tools/mobileViewProvider";
22
- import Sinewave from "@/components/tools/Sinewave";
23
-
24
- export interface LightboxModalProps {
25
- /** The item to display. Pass `null` to close. */
26
- item: LightboxItem | null;
27
- /** Called when the user requests close (X, backdrop click, Esc). */
28
- onClose: () => void;
29
- /** Called when the user toggles favorite on the open item. */
30
- onToggleFavorite?: (item: LightboxItem) => void;
31
- /** Called when the user clicks Share. Defaults to a console.log stub. */
32
- onShare?: (item: LightboxItem, slideIndex: number) => void;
33
- /**
34
- * Builds the URL written to clipboard by the Copy button.
35
- * Defaults to `${origin}${pathname}?id=${id}&slide=${i}`.
36
- */
37
- buildShareUrl?: (item: LightboxItem, slideIndex: number) => string;
38
- }
39
-
40
- /**
41
- * Modal that renders an artwork item as a vertical scroll of slides plus a
42
- * sticky side panel. Mounts via a portal to `document.body`. Plays an open
43
- * animation when `item` becomes non-null, a close animation when it returns
44
- * to `null`, and unmounts after the close animation completes.
45
- *
46
- * Keyboard:
47
- * Esc → close
48
- * ArrowDown / ArrowRight → scroll to next slide
49
- * ArrowUp / ArrowLeft → scroll to previous slide
50
- *
51
- * Theming exposed via CSS variables on the backdrop element — see the
52
- * accompanying `.module.css` for the full list.
53
- */
54
- export function LightboxModal({
55
- item,
56
- onClose,
57
- onToggleFavorite,
58
- onShare,
59
- buildShareUrl,
60
- }: LightboxModalProps) {
61
- const [internalItem, setInternalItem] = useState<LightboxItem | null>(null);
62
- const [isClosing, setIsClosing] = useState(false);
63
- const [activeIdx, setActiveIdx] = useState(0);
64
- const [, setCopied] = useState(false);
65
-
66
- const backdropRef = useRef<HTMLDivElement>(null);
67
- const modalRef = useRef<HTMLDivElement>(null);
68
- const slideRefs = useRef<Array<HTMLDivElement | null>>([]);
69
-
70
- // Sync prop → internal mount state, triggering close animation on prop null
71
- useEffect(() => {
72
- if (item) {
73
- setInternalItem(item);
74
- setIsClosing(false);
75
- setActiveIdx(0);
76
- } else if (internalItem && !isClosing) {
77
- setIsClosing(true);
78
- }
79
- }, [item, internalItem, isClosing]);
80
-
81
- // Reset scroll position when a new item opens
82
- useEffect(() => {
83
- if (internalItem && !isClosing && backdropRef.current) {
84
- backdropRef.current.scrollTop = 0;
85
- }
86
- }, [internalItem, isClosing]);
87
-
88
- // Lock body scroll while modal is mounted
89
- useEffect(() => {
90
- if (!internalItem) return;
91
- const prev = document.body.style.overflow;
92
- document.body.style.overflow = "hidden";
93
- return () => {
94
- document.body.style.overflow = prev;
95
- };
96
- }, [internalItem]);
97
-
98
- const { isMobile, isTablet } = useBreakpoints();
99
- // Matches the bottom-sheet layout's own breakpoint (900px in the module
100
- // CSS) rather than the 767px `isMobile` flag, so the gesture handlers only
101
- // arm exactly when the sheet layout is actually in effect.
102
- const isBottomSheet = useMediaQuery("(max-width: 900px)");
103
-
104
- // Guaranteed unmount after close animation. animationend is the fast path;
105
- // this timeout fires if it never arrives (e.g. reduced-motion 1ms race).
106
- useEffect(() => {
107
- if (!isClosing) return;
108
- const backdrop = backdropRef.current;
109
- let ms = 400;
110
- if (backdrop) {
111
- const raw = getComputedStyle(backdrop)
112
- .getPropertyValue("--lb-modal-duration")
113
- .trim();
114
- const parsed = parseFloat(raw);
115
- if (!isNaN(parsed) && parsed > 0)
116
- ms = (raw.endsWith("ms") ? parsed : parsed * 1000) + 50;
117
- }
118
- const id = window.setTimeout(() => {
119
- setInternalItem(null);
120
- setIsClosing(false);
121
- }, ms);
122
- return () => window.clearTimeout(id);
123
- }, [isClosing]);
124
-
125
- const scrollToSlide = useCallback((idx: number) => {
126
- const ref = slideRefs.current[idx];
127
- if (ref) ref.scrollIntoView({ behavior: "smooth", block: "center" });
128
- }, []);
129
-
130
- // Keyboard handling
131
- useEffect(() => {
132
- if (!internalItem || isClosing) return;
133
- const slidesLen = internalItem.slides?.length ?? 0;
134
-
135
- const handleKey = (e: KeyboardEvent) => {
136
- if (e.key === "Escape") {
137
- e.preventDefault();
138
- onClose();
139
- } else if (e.key === "ArrowDown" || e.key === "ArrowRight") {
140
- e.preventDefault();
141
- scrollToSlide(Math.min(activeIdx + 1, slidesLen - 1));
142
- } else if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
143
- e.preventDefault();
144
- scrollToSlide(Math.max(activeIdx - 1, 0));
145
- }
146
- };
147
- window.addEventListener("keydown", handleKey);
148
- return () => window.removeEventListener("keydown", handleKey);
149
- }, [internalItem, isClosing, activeIdx, onClose, scrollToSlide]);
150
-
151
- // Track which slide is most centered in the viewport
152
- useEffect(() => {
153
- const scrollEl = backdropRef.current;
154
- if (!scrollEl || !internalItem) return;
155
-
156
- const update = () => {
157
- const center = scrollEl.scrollTop + scrollEl.clientHeight / 2;
158
- let bestIdx = 0;
159
- let bestDist = Infinity;
160
- slideRefs.current.forEach((ref, idx) => {
161
- if (!ref) return;
162
- const c = ref.offsetTop + ref.offsetHeight / 2;
163
- const d = Math.abs(c - center);
164
- if (d < bestDist) {
165
- bestDist = d;
166
- bestIdx = idx;
167
- }
168
- });
169
- setActiveIdx(bestIdx);
170
- };
171
-
172
- scrollEl.addEventListener("scroll", update, { passive: true });
173
- update();
174
- return () => scrollEl.removeEventListener("scroll", update);
175
- }, [internalItem]);
176
-
177
- // ── Bottom-sheet gestures (mobile only) ───────────────────────────────────
178
- // Pulling down past the top of the scroll closes the sheet; pulling up past
179
- // the bottom stretches a filler panel over the reveal instead of letting
180
- // the native rubber-band bounce show the backdrop underneath.
181
- const stretchFillerRef = useRef<HTMLDivElement>(null);
182
- const dragStateRef = useRef<{
183
- startY: number;
184
- atTop: boolean;
185
- atBottom: boolean;
186
- mode: "close" | "stretch" | null;
187
- lastDeltaY: number;
188
- } | null>(null);
189
-
190
- useEffect(() => {
191
- if (!isBottomSheet || !internalItem || isClosing) return;
192
- const scrollEl = backdropRef.current;
193
- const modalEl = modalRef.current;
194
- const fillerEl = stretchFillerRef.current;
195
- if (!scrollEl || !modalEl) return;
196
-
197
- const CLOSE_THRESHOLD = 90;
198
- const CLOSE_DAMPING = 0.5;
199
- const STRETCH_DAMPING = 0.4;
200
- const STRETCH_MAX = 120;
201
-
202
- const settle = (animate: boolean) => {
203
- modalEl.style.transition = animate
204
- ? `transform var(--lb-modal-duration) var(--lb-modal-easing)`
205
- : "none";
206
- modalEl.style.transform = "";
207
- if (fillerEl) {
208
- fillerEl.style.transition = animate
209
- ? `height var(--lb-modal-duration) var(--lb-modal-easing)`
210
- : "none";
211
- fillerEl.style.height = "0px";
212
- }
213
- };
214
-
215
- const handleTouchStart = (e: TouchEvent) => {
216
- dragStateRef.current = {
217
- startY: e.touches[0].clientY,
218
- atTop: scrollEl.scrollTop <= 0,
219
- atBottom:
220
- scrollEl.scrollTop + scrollEl.clientHeight >=
221
- scrollEl.scrollHeight - 1,
222
- mode: null,
223
- lastDeltaY: 0,
224
- };
225
- };
226
-
227
- const handleTouchMove = (e: TouchEvent) => {
228
- const st = dragStateRef.current;
229
- if (!st) return;
230
- const deltaY = e.touches[0].clientY - st.startY;
231
- st.lastDeltaY = deltaY;
232
-
233
- if (!st.mode) {
234
- if (st.atTop && deltaY > 4) st.mode = "close";
235
- else if (st.atBottom && deltaY < -4) st.mode = "stretch";
236
- else return;
237
- }
238
-
239
- if (st.mode === "close" && deltaY > 0) {
240
- e.preventDefault();
241
- modalEl.style.transition = "none";
242
- modalEl.style.transform = `translateY(${deltaY * CLOSE_DAMPING}px)`;
243
- } else if (st.mode === "stretch" && deltaY < 0 && fillerEl) {
244
- e.preventDefault();
245
- const h = Math.min(-deltaY * STRETCH_DAMPING, STRETCH_MAX);
246
- fillerEl.style.transition = "none";
247
- fillerEl.style.height = `${h}px`;
248
- }
249
- };
250
-
251
- const handleTouchEnd = () => {
252
- const st = dragStateRef.current;
253
- dragStateRef.current = null;
254
- if (!st) return;
255
-
256
- if (st.mode === "close" && st.lastDeltaY * CLOSE_DAMPING > CLOSE_THRESHOLD) {
257
- settle(false);
258
- onClose();
259
- return;
260
- }
261
- settle(true);
262
- };
263
-
264
- scrollEl.addEventListener("touchstart", handleTouchStart, {
265
- passive: true,
266
- });
267
- scrollEl.addEventListener("touchmove", handleTouchMove, {
268
- passive: false,
269
- });
270
- scrollEl.addEventListener("touchend", handleTouchEnd);
271
- scrollEl.addEventListener("touchcancel", handleTouchEnd);
272
- return () => {
273
- scrollEl.removeEventListener("touchstart", handleTouchStart);
274
- scrollEl.removeEventListener("touchmove", handleTouchMove);
275
- scrollEl.removeEventListener("touchend", handleTouchEnd);
276
- scrollEl.removeEventListener("touchcancel", handleTouchEnd);
277
- };
278
- }, [isBottomSheet, internalItem, isClosing, onClose]);
279
-
280
- const handleAnimationEnd = (e: ReactAnimationEvent<HTMLDivElement>) => {
281
- // Only react to the modal's own animation, not anything bubbling up
282
- if (e.target !== e.currentTarget) return;
283
- if (isClosing) {
284
- setInternalItem(null);
285
- setIsClosing(false);
286
- }
287
- };
288
-
289
- const handleBackdropClick = (e: ReactMouseEvent<HTMLDivElement>) => {
290
- if (e.target === e.currentTarget) onClose();
291
- };
292
-
293
- const handleDownload = (src: string | undefined, e: ReactMouseEvent) => {
294
- e.stopPropagation();
295
- if (!src) return;
296
- const a = document.createElement("a");
297
- a.href = src;
298
- a.download = "";
299
- a.target = "_blank";
300
- a.rel = "noopener noreferrer";
301
- document.body.appendChild(a);
302
- a.click();
303
- document.body.removeChild(a);
304
- };
305
-
306
- const handleCopy = () => {
307
- if (!internalItem) return;
308
- const url = buildShareUrl
309
- ? buildShareUrl(internalItem, activeIdx)
310
- : `${window.location.origin}${window.location.pathname}?id=${encodeURIComponent(
311
- internalItem.id,
312
- )}&slide=${activeIdx}`;
313
- navigator.clipboard?.writeText(url).catch(() => {});
314
- setCopied(true);
315
- window.setTimeout(() => setCopied(false), 1500);
316
- };
317
-
318
- const handleShare = () => {
319
- if (!internalItem) return;
320
- if (onShare) onShare(internalItem, activeIdx);
321
- // eslint-disable-next-line no-console
322
- else
323
- console.log(
324
- "[LightboxModal] Share:",
325
- internalItem.id,
326
- "slide",
327
- activeIdx,
328
- );
329
- };
330
-
331
- const handleFavorite = () => {
332
- if (!internalItem || !onToggleFavorite) return;
333
- onToggleFavorite(internalItem);
334
- };
335
-
336
- if (typeof document === "undefined") return null;
337
- if (!internalItem) return null;
338
-
339
- const slides = internalItem.slides ?? [];
340
- const activeSlide = slides[activeIdx];
341
- const stateClass = isClosing ? styles.isClosing : styles.isOpen;
342
-
343
- return createPortal(
344
- <>
345
- <div
346
- ref={backdropRef}
347
- className={`${styles.backdrop} ${stateClass}`}
348
- onClick={handleBackdropClick}
349
- role="dialog"
350
- aria-modal="true"
351
- aria-label={internalItem.title ?? "Artwork"}
352
- >
353
- <div
354
- ref={modalRef}
355
- className={styles.modal}
356
- onAnimationEnd={handleAnimationEnd}
357
- >
358
- {/* Images column */}
359
- <div className={styles.imagesColumn}>
360
- {slides.length === 0 ? (
361
- <div className={styles.empty}>No images for this artwork.</div>
362
- ) : (
363
- slides.map((slide, idx) => (
364
- <div
365
- key={idx}
366
- ref={(el) => {
367
- slideRefs.current[idx] = el;
368
- }}
369
- className={styles.slideEntry}
370
- data-active={idx === activeIdx ? "true" : "false"}
371
- >
372
- <div className={styles.slideImageWrap}>
373
- {slide.src ? (
374
- <Image
375
- className={styles.slideImage}
376
- src={slide.src}
377
- alt={slide.alt ?? slide.title ?? ""}
378
- draggable={false}
379
- fill
380
- />
381
- ) : (
382
- <div
383
- className={styles.slideImagePlaceholder}
384
- aria-hidden
385
- />
386
- )}
387
- <div className={styles.slideDownloadBtn}>
388
- <Button
389
- type="button"
390
- onClick={(e) => handleDownload(slide.src, e)}
391
- aria-label="Download image"
392
- text
393
- >
394
- <Icon systemName="download" />
395
- </Button>
396
- </div>
397
- </div>
398
- {(slide.title || slide.comment) && (
399
- <div className={styles.slideMeta}>
400
- {slide.title && (
401
- <h3 className={styles.slideTitle}>{slide.title}</h3>
402
- )}
403
- {slide.comment && (
404
- <p className={styles.slideComment}>{slide.comment}</p>
405
- )}
406
- </div>
407
- )}
408
- </div>
409
- ))
410
- )}
411
- </div>
412
-
413
- {/* Sticky info panel */}
414
- <aside className={styles.infoPanel}>
415
- <div className={styles.closeBtn}>
416
- <Button
417
- type="button"
418
- onClick={onClose}
419
- aria-label="Close"
420
- text={!isMobile}
421
- secondary={!!isMobile}
422
- >
423
- <Icon systemName="close" />
424
- </Button>
425
- </div>
426
- <div className={styles.infoHeader}>
427
- {internalItem.author && (
428
- <div className={styles.author}>{internalItem.author}</div>
429
- )}
430
- {internalItem.title && (
431
- <h2 className={styles.itemTitle}>{internalItem.title}</h2>
432
- )}
433
- {internalItem.description && (
434
- <p className={styles.itemDescription}>
435
- {internalItem.description}
436
- </p>
437
- )}
438
- </div>
439
- <div className={styles.fl_actions}>
440
- <Button.group
441
- multiSelect
442
- primary
443
- width={"fullWidth"}
444
- cta={{
445
- systemName: "favorite",
446
- onClick: handleFavorite,
447
- toggle: true,
448
- tertiary: true,
449
- circle: true,
450
- }}
451
- >
452
- <Button.group.Tab
453
- systemName="ios_share"
454
- label="Share"
455
- circle
456
- onClick={handleShare}
457
- />
458
- <Button.group.Tab
459
- systemName="link"
460
- circle
461
- label="Copy link"
462
- toggle
463
- onClick={handleCopy}
464
- />
465
- </Button.group>
466
- </div>
467
- {slides.length > 0 && (
468
- <>
469
- <Sinewave width={200} height={10} frequency={8} />
470
- <div className={styles.currentSlide}>
471
- <div className={styles.currentSlideLabel}>
472
- Slide {activeIdx + 1} of {slides.length}
473
- </div>
474
- {activeSlide?.title && (
475
- <h3 className={styles.currentSlideTitle}>
476
- {activeSlide.title}
477
- </h3>
478
- )}
479
- {activeSlide?.comment && (
480
- <p className={styles.currentSlideComment}>
481
- {activeSlide.comment}
482
- </p>
483
- )}
484
- </div>
485
- </>
486
- )}
487
- </aside>
488
- </div>
489
- {isBottomSheet && (
490
- <div
491
- ref={stretchFillerRef}
492
- className={styles.stretchFiller}
493
- aria-hidden
494
- />
495
- )}
496
- </div>
497
- </>,
498
- document.body,
499
- );
500
- }
1
+ "use client";
2
+
3
+ import {
4
+ useCallback,
5
+ useEffect,
6
+ useRef,
7
+ useState,
8
+ type AnimationEvent as ReactAnimationEvent,
9
+ type MouseEvent as ReactMouseEvent,
10
+ } from "react";
11
+ import { createPortal } from "react-dom";
12
+ import Image from "next/image";
13
+ import type { LightboxItem } from "./types";
14
+ import styles from "./LightboxModal.module.css";
15
+ import Button from "../../(buttons)/ButtonGroup";
16
+ import Icon from "@/components/tools/label/Icon";
17
+ import {
18
+ useBreakpoints,
19
+ useMediaQuery,
20
+ } from "@/components/tools/mobileViewProvider";
21
+ import Sinewave from "@/components/tools/Sinewave";
22
+
23
+ export interface LightboxModalProps {
24
+ /** The item to display. Pass `null` to close. */
25
+ item: LightboxItem | null;
26
+ /** Called when the user requests close (X, backdrop click, Esc). */
27
+ onClose: () => void;
28
+ /** Called when the user toggles favorite on the open item. */
29
+ onToggleFavorite?: (item: LightboxItem) => void;
30
+ /** Called when the user clicks Share. Defaults to a console.log stub. */
31
+ onShare?: (item: LightboxItem, slideIndex: number) => void;
32
+ /**
33
+ * Builds the URL written to clipboard by the Copy button.
34
+ * Defaults to `${origin}${pathname}?id=${id}&slide=${i}`.
35
+ */
36
+ buildShareUrl?: (item: LightboxItem, slideIndex: number) => string;
37
+ }
38
+
39
+ /**
40
+ * Modal that renders an artwork item as a vertical scroll of slides plus a
41
+ * sticky side panel. Mounts via a portal to `document.body`. Plays an open
42
+ * animation when `item` becomes non-null, a close animation when it returns
43
+ * to `null`, and unmounts after the close animation completes.
44
+ *
45
+ * Keyboard:
46
+ * Esc → close
47
+ * ArrowDown / ArrowRight → scroll to next slide
48
+ * ArrowUp / ArrowLeft → scroll to previous slide
49
+ *
50
+ * Theming exposed via CSS variables on the backdrop element — see the
51
+ * accompanying `.module.css` for the full list.
52
+ */
53
+ export function LightboxModal({
54
+ item,
55
+ onClose,
56
+ onToggleFavorite,
57
+ onShare,
58
+ buildShareUrl,
59
+ }: LightboxModalProps) {
60
+ const [internalItem, setInternalItem] = useState<LightboxItem | null>(null);
61
+ const [isClosing, setIsClosing] = useState(false);
62
+ const [activeIdx, setActiveIdx] = useState(0);
63
+ const [, setCopied] = useState(false);
64
+
65
+ const backdropRef = useRef<HTMLDivElement>(null);
66
+ const modalRef = useRef<HTMLDivElement>(null);
67
+ const slideRefs = useRef<Array<HTMLDivElement | null>>([]);
68
+
69
+ // Sync prop → internal mount state, triggering close animation on prop null.
70
+ // internalItem intentionally lags one render behind `item` so the modal
71
+ // stays mounted through its exit animation — this can't be computed at
72
+ // render time since it depends on the previous render's own state.
73
+ /* eslint-disable react-hooks/set-state-in-effect */
74
+ useEffect(() => {
75
+ if (item) {
76
+ setInternalItem(item);
77
+ setIsClosing(false);
78
+ setActiveIdx(0);
79
+ } else if (internalItem && !isClosing) {
80
+ setIsClosing(true);
81
+ }
82
+ }, [item, internalItem, isClosing]);
83
+ /* eslint-enable react-hooks/set-state-in-effect */
84
+
85
+ // Reset scroll position when a new item opens
86
+ useEffect(() => {
87
+ if (internalItem && !isClosing && backdropRef.current) {
88
+ backdropRef.current.scrollTop = 0;
89
+ }
90
+ }, [internalItem, isClosing]);
91
+
92
+ // Lock body scroll while modal is mounted
93
+ useEffect(() => {
94
+ if (!internalItem) return;
95
+ const prev = document.body.style.overflow;
96
+ document.body.style.overflow = "hidden";
97
+ return () => {
98
+ document.body.style.overflow = prev;
99
+ };
100
+ }, [internalItem]);
101
+
102
+ const { isMobile } = useBreakpoints();
103
+ // Matches the bottom-sheet layout's own breakpoint (900px in the module
104
+ // CSS) rather than the 767px `isMobile` flag, so the gesture handlers only
105
+ // arm exactly when the sheet layout is actually in effect.
106
+ const isBottomSheet = useMediaQuery("(max-width: 900px)");
107
+
108
+ // Guaranteed unmount after close animation. animationend is the fast path;
109
+ // this timeout fires if it never arrives (e.g. reduced-motion 1ms race).
110
+ useEffect(() => {
111
+ if (!isClosing) return;
112
+ const backdrop = backdropRef.current;
113
+ let ms = 400;
114
+ if (backdrop) {
115
+ const raw = getComputedStyle(backdrop)
116
+ .getPropertyValue("--lb-modal-duration")
117
+ .trim();
118
+ const parsed = parseFloat(raw);
119
+ if (!isNaN(parsed) && parsed > 0)
120
+ ms = (raw.endsWith("ms") ? parsed : parsed * 1000) + 50;
121
+ }
122
+ const id = window.setTimeout(() => {
123
+ setInternalItem(null);
124
+ setIsClosing(false);
125
+ }, ms);
126
+ return () => window.clearTimeout(id);
127
+ }, [isClosing]);
128
+
129
+ const scrollToSlide = useCallback((idx: number) => {
130
+ const ref = slideRefs.current[idx];
131
+ if (ref) ref.scrollIntoView({ behavior: "smooth", block: "center" });
132
+ }, []);
133
+
134
+ // Keyboard handling
135
+ useEffect(() => {
136
+ if (!internalItem || isClosing) return;
137
+ const slidesLen = internalItem.slides?.length ?? 0;
138
+
139
+ const handleKey = (e: KeyboardEvent) => {
140
+ if (e.key === "Escape") {
141
+ e.preventDefault();
142
+ onClose();
143
+ } else if (e.key === "ArrowDown" || e.key === "ArrowRight") {
144
+ e.preventDefault();
145
+ scrollToSlide(Math.min(activeIdx + 1, slidesLen - 1));
146
+ } else if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
147
+ e.preventDefault();
148
+ scrollToSlide(Math.max(activeIdx - 1, 0));
149
+ }
150
+ };
151
+ window.addEventListener("keydown", handleKey);
152
+ return () => window.removeEventListener("keydown", handleKey);
153
+ }, [internalItem, isClosing, activeIdx, onClose, scrollToSlide]);
154
+
155
+ // Track which slide is most centered in the viewport
156
+ useEffect(() => {
157
+ const scrollEl = backdropRef.current;
158
+ if (!scrollEl || !internalItem) return;
159
+
160
+ const update = () => {
161
+ const center = scrollEl.scrollTop + scrollEl.clientHeight / 2;
162
+ let bestIdx = 0;
163
+ let bestDist = Infinity;
164
+ slideRefs.current.forEach((ref, idx) => {
165
+ if (!ref) return;
166
+ const c = ref.offsetTop + ref.offsetHeight / 2;
167
+ const d = Math.abs(c - center);
168
+ if (d < bestDist) {
169
+ bestDist = d;
170
+ bestIdx = idx;
171
+ }
172
+ });
173
+ setActiveIdx(bestIdx);
174
+ };
175
+
176
+ scrollEl.addEventListener("scroll", update, { passive: true });
177
+ update();
178
+ return () => scrollEl.removeEventListener("scroll", update);
179
+ }, [internalItem]);
180
+
181
+ // ── Bottom-sheet gestures (mobile only) ───────────────────────────────────
182
+ // Pulling down past the top of the scroll closes the sheet; pulling up past
183
+ // the bottom stretches a filler panel over the reveal instead of letting
184
+ // the native rubber-band bounce show the backdrop underneath.
185
+ const stretchFillerRef = useRef<HTMLDivElement>(null);
186
+ const dragStateRef = useRef<{
187
+ startY: number;
188
+ atTop: boolean;
189
+ atBottom: boolean;
190
+ mode: "close" | "stretch" | null;
191
+ lastDeltaY: number;
192
+ } | null>(null);
193
+
194
+ useEffect(() => {
195
+ if (!isBottomSheet || !internalItem || isClosing) return;
196
+ const scrollEl = backdropRef.current;
197
+ const modalEl = modalRef.current;
198
+ const fillerEl = stretchFillerRef.current;
199
+ if (!scrollEl || !modalEl) return;
200
+
201
+ const CLOSE_THRESHOLD = 90;
202
+ const CLOSE_DAMPING = 0.5;
203
+ const STRETCH_DAMPING = 0.4;
204
+ const STRETCH_MAX = 120;
205
+
206
+ const settle = (animate: boolean) => {
207
+ modalEl.style.transition = animate
208
+ ? `transform var(--lb-modal-duration) var(--lb-modal-easing)`
209
+ : "none";
210
+ modalEl.style.transform = "";
211
+ if (fillerEl) {
212
+ fillerEl.style.transition = animate
213
+ ? `height var(--lb-modal-duration) var(--lb-modal-easing)`
214
+ : "none";
215
+ fillerEl.style.height = "0px";
216
+ }
217
+ };
218
+
219
+ const handleTouchStart = (e: TouchEvent) => {
220
+ dragStateRef.current = {
221
+ startY: e.touches[0].clientY,
222
+ atTop: scrollEl.scrollTop <= 0,
223
+ atBottom:
224
+ scrollEl.scrollTop + scrollEl.clientHeight >=
225
+ scrollEl.scrollHeight - 1,
226
+ mode: null,
227
+ lastDeltaY: 0,
228
+ };
229
+ };
230
+
231
+ const handleTouchMove = (e: TouchEvent) => {
232
+ const st = dragStateRef.current;
233
+ if (!st) return;
234
+ const deltaY = e.touches[0].clientY - st.startY;
235
+ st.lastDeltaY = deltaY;
236
+
237
+ if (!st.mode) {
238
+ if (st.atTop && deltaY > 4) st.mode = "close";
239
+ else if (st.atBottom && deltaY < -4) st.mode = "stretch";
240
+ else return;
241
+ }
242
+
243
+ if (st.mode === "close" && deltaY > 0) {
244
+ e.preventDefault();
245
+ modalEl.style.transition = "none";
246
+ modalEl.style.transform = `translateY(${deltaY * CLOSE_DAMPING}px)`;
247
+ } else if (st.mode === "stretch" && deltaY < 0 && fillerEl) {
248
+ e.preventDefault();
249
+ const h = Math.min(-deltaY * STRETCH_DAMPING, STRETCH_MAX);
250
+ fillerEl.style.transition = "none";
251
+ fillerEl.style.height = `${h}px`;
252
+ }
253
+ };
254
+
255
+ const handleTouchEnd = () => {
256
+ const st = dragStateRef.current;
257
+ dragStateRef.current = null;
258
+ if (!st) return;
259
+
260
+ if (
261
+ st.mode === "close" &&
262
+ st.lastDeltaY * CLOSE_DAMPING > CLOSE_THRESHOLD
263
+ ) {
264
+ settle(false);
265
+ onClose();
266
+ return;
267
+ }
268
+ settle(true);
269
+ };
270
+
271
+ scrollEl.addEventListener("touchstart", handleTouchStart, {
272
+ passive: true,
273
+ });
274
+ scrollEl.addEventListener("touchmove", handleTouchMove, {
275
+ passive: false,
276
+ });
277
+ scrollEl.addEventListener("touchend", handleTouchEnd);
278
+ scrollEl.addEventListener("touchcancel", handleTouchEnd);
279
+ return () => {
280
+ scrollEl.removeEventListener("touchstart", handleTouchStart);
281
+ scrollEl.removeEventListener("touchmove", handleTouchMove);
282
+ scrollEl.removeEventListener("touchend", handleTouchEnd);
283
+ scrollEl.removeEventListener("touchcancel", handleTouchEnd);
284
+ };
285
+ }, [isBottomSheet, internalItem, isClosing, onClose]);
286
+
287
+ const handleAnimationEnd = (e: ReactAnimationEvent<HTMLDivElement>) => {
288
+ // Only react to the modal's own animation, not anything bubbling up
289
+ if (e.target !== e.currentTarget) return;
290
+ if (isClosing) {
291
+ setInternalItem(null);
292
+ setIsClosing(false);
293
+ }
294
+ };
295
+
296
+ const handleBackdropClick = (e: ReactMouseEvent<HTMLDivElement>) => {
297
+ if (e.target === e.currentTarget) onClose();
298
+ };
299
+
300
+ const handleDownload = (src: string | undefined, e: ReactMouseEvent) => {
301
+ e.stopPropagation();
302
+ if (!src) return;
303
+ const a = document.createElement("a");
304
+ a.href = src;
305
+ a.download = "";
306
+ a.target = "_blank";
307
+ a.rel = "noopener noreferrer";
308
+ document.body.appendChild(a);
309
+ a.click();
310
+ document.body.removeChild(a);
311
+ };
312
+
313
+ const handleCopy = () => {
314
+ if (!internalItem) return;
315
+ const url = buildShareUrl
316
+ ? buildShareUrl(internalItem, activeIdx)
317
+ : `${window.location.origin}${window.location.pathname}?id=${encodeURIComponent(
318
+ internalItem.id,
319
+ )}&slide=${activeIdx}`;
320
+ navigator.clipboard?.writeText(url).catch(() => {});
321
+ setCopied(true);
322
+ window.setTimeout(() => setCopied(false), 1500);
323
+ };
324
+
325
+ const handleShare = () => {
326
+ if (!internalItem) return;
327
+ if (onShare) onShare(internalItem, activeIdx);
328
+ else
329
+ console.log(
330
+ "[LightboxModal] Share:",
331
+ internalItem.id,
332
+ "slide",
333
+ activeIdx,
334
+ );
335
+ };
336
+
337
+ const handleFavorite = () => {
338
+ if (!internalItem || !onToggleFavorite) return;
339
+ onToggleFavorite(internalItem);
340
+ };
341
+
342
+ if (typeof document === "undefined") return null;
343
+ if (!internalItem) return null;
344
+
345
+ const slides = internalItem.slides ?? [];
346
+ const activeSlide = slides[activeIdx];
347
+ const stateClass = isClosing ? styles.isClosing : styles.isOpen;
348
+
349
+ return createPortal(
350
+ <>
351
+ <div
352
+ ref={backdropRef}
353
+ className={`${styles.backdrop} ${stateClass}`}
354
+ onClick={handleBackdropClick}
355
+ role="dialog"
356
+ aria-modal="true"
357
+ aria-label={internalItem.title ?? "Artwork"}
358
+ >
359
+ <div
360
+ ref={modalRef}
361
+ className={styles.modal}
362
+ onAnimationEnd={handleAnimationEnd}
363
+ >
364
+ {/* Images column */}
365
+ <div className={styles.imagesColumn}>
366
+ {slides.length === 0 ? (
367
+ <div className={styles.empty}>No images for this artwork.</div>
368
+ ) : (
369
+ slides.map((slide, idx) => (
370
+ <div
371
+ key={idx}
372
+ ref={(el) => {
373
+ slideRefs.current[idx] = el;
374
+ }}
375
+ className={styles.slideEntry}
376
+ data-active={idx === activeIdx ? "true" : "false"}
377
+ >
378
+ <div className={styles.slideImageWrap}>
379
+ {slide.src ? (
380
+ <Image
381
+ className={styles.slideImage}
382
+ src={slide.src}
383
+ alt={slide.alt ?? slide.title ?? ""}
384
+ draggable={false}
385
+ fill
386
+ />
387
+ ) : (
388
+ <div
389
+ className={styles.slideImagePlaceholder}
390
+ aria-hidden
391
+ />
392
+ )}
393
+ <div className={styles.slideDownloadBtn}>
394
+ <Button
395
+ type="button"
396
+ onClick={(e) => handleDownload(slide.src, e)}
397
+ aria-label="Download image"
398
+ text
399
+ >
400
+ <Icon systemName="download" />
401
+ </Button>
402
+ </div>
403
+ </div>
404
+ {(slide.title || slide.comment) && (
405
+ <div className={styles.slideMeta}>
406
+ {slide.title && (
407
+ <h3 className={styles.slideTitle}>{slide.title}</h3>
408
+ )}
409
+ {slide.comment && (
410
+ <p className={styles.slideComment}>{slide.comment}</p>
411
+ )}
412
+ </div>
413
+ )}
414
+ </div>
415
+ ))
416
+ )}
417
+ </div>
418
+
419
+ {/* Sticky info panel */}
420
+ <aside className={styles.infoPanel}>
421
+ <div className={styles.closeBtn}>
422
+ <Button
423
+ type="button"
424
+ onClick={onClose}
425
+ aria-label="Close"
426
+ text={!isMobile}
427
+ secondary={!!isMobile}
428
+ >
429
+ <Icon systemName="close" />
430
+ </Button>
431
+ </div>
432
+ <div className={styles.infoHeader}>
433
+ {internalItem.author && (
434
+ <div className={styles.author}>{internalItem.author}</div>
435
+ )}
436
+ {internalItem.title && (
437
+ <h2 className={styles.itemTitle}>{internalItem.title}</h2>
438
+ )}
439
+ {internalItem.description && (
440
+ <p className={styles.itemDescription}>
441
+ {internalItem.description}
442
+ </p>
443
+ )}
444
+ </div>
445
+ <div className={styles.fl_actions}>
446
+ <Button.Group multiSelect primary width={"fullWidth"}>
447
+ <Button.Tab
448
+ systemName="ios_share"
449
+ label="Share"
450
+ circle
451
+ onClick={handleShare}
452
+ />
453
+ <Button.Tab
454
+ systemName="link"
455
+ circle
456
+ label="Copy link"
457
+ toggle
458
+ onClick={handleCopy}
459
+ />
460
+ <Button tertiary>
461
+ <Icon systemName="favorite" />
462
+ </Button>
463
+ </Button.Group>
464
+ </div>
465
+ {slides.length > 0 && (
466
+ <>
467
+ <Sinewave width={120} strokeWidth={4} />
468
+ <div className={styles.currentSlide}>
469
+ <div className={styles.currentSlideLabel}>
470
+ Slide {activeIdx + 1} of {slides.length}
471
+ </div>
472
+ {activeSlide?.title && (
473
+ <h3 className={styles.currentSlideTitle}>
474
+ {activeSlide.title}
475
+ </h3>
476
+ )}
477
+ {activeSlide?.comment && (
478
+ <p className={styles.currentSlideComment}>
479
+ {activeSlide.comment}
480
+ </p>
481
+ )}
482
+ </div>
483
+ </>
484
+ )}
485
+ </aside>
486
+ </div>
487
+ {isBottomSheet && (
488
+ <div
489
+ ref={stretchFillerRef}
490
+ className={styles.stretchFiller}
491
+ aria-hidden
492
+ />
493
+ )}
494
+ </div>
495
+ </>,
496
+ document.body,
497
+ );
498
+ }