@istmx/ui 0.1.11 → 0.1.13

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 (55) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +533 -463
  3. package/bin/istmx.mjs +481 -314
  4. package/package.json +27 -27
  5. package/registry/accordion.tsx +186 -0
  6. package/registry/ai-chat-block/ai-chat-block.tsx +456 -460
  7. package/registry/ai-chat-block/ai-chat-input.tsx +694 -694
  8. package/registry/ai-chat-block/attachment.tsx +466 -466
  9. package/registry/ai-chat-block/chat-code-block.tsx +50 -50
  10. package/registry/ai-chat-block/chat-composer.tsx +51 -51
  11. package/registry/ai-chat-block/chat-logo.tsx +18 -18
  12. package/registry/ai-chat-block/chat-message.tsx +161 -161
  13. package/registry/ai-chat-block/chat-sidebar.tsx +273 -273
  14. package/registry/ai-chat-block/chat-user-avatar.tsx +9 -9
  15. package/registry/ai-chat-block/code-highlighter.tsx +342 -357
  16. package/registry/ai-chat-block/default-attachments.tsx +42 -42
  17. package/registry/ai-chat-block/index.ts +30 -30
  18. package/registry/ai-chat-block/message-content.tsx +287 -287
  19. package/registry/ai-chat-block/message-list.tsx +93 -93
  20. package/registry/ai-chat-block/send-button.tsx +102 -102
  21. package/registry/ai-chat-block/types.ts +70 -71
  22. package/registry/ai-chat-block/utils.ts +6 -6
  23. package/registry/ai-chat-block/voice-button.tsx +66 -66
  24. package/registry/alert-dialog.tsx +229 -0
  25. package/registry/alert.tsx +188 -0
  26. package/registry/animated-text.tsx +228 -225
  27. package/registry/aspect-ratio.tsx +32 -0
  28. package/registry/avatar-group.tsx +66 -0
  29. package/registry/avatar.tsx +121 -0
  30. package/registry/badge.tsx +52 -0
  31. package/registry/bento-grid.tsx +438 -433
  32. package/registry/button.tsx +156 -237
  33. package/registry/carousel.tsx +184 -0
  34. package/registry/dock-navigation.tsx +200 -198
  35. package/registry/drift-canvas.tsx +383 -0
  36. package/registry/drift-wall.tsx +361 -0
  37. package/registry/flex-carousel.tsx +1430 -0
  38. package/registry/guided-gallery.tsx +1506 -0
  39. package/registry/image-accordion.tsx +306 -302
  40. package/registry/image-trail.tsx +126 -121
  41. package/registry/infinite-image-canvas.tsx +268 -263
  42. package/registry/input-otp.tsx +332 -0
  43. package/registry/list-card.tsx +130 -0
  44. package/registry/mobile-menu-dock.tsx +216 -211
  45. package/registry/morph-slider.tsx +756 -0
  46. package/registry/pixel-cat.tsx +972 -1020
  47. package/registry/scroll-canvas-cards.tsx +643 -0
  48. package/registry/scroll-parallax-hero.tsx +566 -565
  49. package/registry/scroll-story-cards.tsx +443 -438
  50. package/registry/slider.tsx +163 -0
  51. package/registry/spotlight-grid.tsx +226 -0
  52. package/registry/streaming-text.tsx +269 -278
  53. package/registry/text-reveal.tsx +311 -307
  54. package/registry/user-avatar.tsx +99 -0
  55. package/registry/utils.ts +6 -6
@@ -1,302 +1,306 @@
1
- 'use client'
2
-
3
- import { useId, useState } from 'react'
4
- import type { CSSProperties } from 'react'
5
- import {
6
- AnimatePresence,
7
- LayoutGroup,
8
- motion,
9
- useReducedMotion,
10
- } from 'motion/react'
11
- import { cn } from '@/lib/utils'
12
-
13
- export type ImageAccordionItem = {
14
- id?: string
15
- src: string
16
- alt: string
17
- title: string
18
- description?: string
19
- className?: string
20
- imageClassName?: string
21
- }
22
-
23
- export type ImageAccordionGlow = {
24
- color?: string
25
- position?: string
26
- size?: string
27
- opacity?: number
28
- blur?: number
29
- }
30
-
31
- export type ImageAccordionProps = {
32
- images: ImageAccordionItem[]
33
- className?: string
34
- stackClassName?: string
35
- cardClassName?: string
36
- imageClassName?: string
37
- previewClassName?: string
38
- visibleCount?: number
39
- glow?: false | ImageAccordionGlow
40
- transition?: {
41
- stiffness?: number
42
- damping?: number
43
- mass?: number
44
- }
45
- }
46
-
47
- export function ImageAccordion({
48
- images,
49
- className,
50
- stackClassName,
51
- cardClassName,
52
- imageClassName,
53
- previewClassName,
54
- visibleCount = 5,
55
- glow = {},
56
- transition,
57
- }: ImageAccordionProps) {
58
- const [stackImages, setStackImages] = useState(images)
59
- const [activeImage, setActiveImage] = useState<ImageAccordionItem | null>(
60
- null,
61
- )
62
- const reduceMotion = useReducedMotion()
63
- const layoutId = useId()
64
- const visibleLimit = Number.isFinite(visibleCount)
65
- ? Math.max(1, Math.floor(visibleCount))
66
- : 5
67
- const visibleImages = stackImages.slice(0, visibleLimit)
68
- const glowOptions = typeof glow === 'object' ? glow : {}
69
- const spring = {
70
- type: 'spring' as const,
71
- stiffness: transition?.stiffness ?? 190,
72
- damping: transition?.damping ?? 24,
73
- mass: transition?.mass ?? 0.8,
74
- }
75
- const glowStyle = {
76
- '--image-accordion-glow-color': glowOptions.color ?? 'var(--foreground)',
77
- '--image-accordion-glow-position': glowOptions.position ?? 'center',
78
- '--image-accordion-glow-size': glowOptions.size ?? '72%',
79
- '--image-accordion-glow-opacity': Math.min(
80
- 1,
81
- Math.max(0, glowOptions.opacity ?? 0.24),
82
- ),
83
- '--image-accordion-glow-blur': `${Math.max(0, glowOptions.blur ?? 18)}px`,
84
- } as CSSProperties
85
- const getImageKey = (image: ImageAccordionItem) => image.id ?? image.src
86
- const activePosition = activeImage
87
- ? stackImages.findIndex(
88
- (image) => getImageKey(image) === getImageKey(activeImage),
89
- ) + 1
90
- : 0
91
-
92
- function selectImage(image: ImageAccordionItem) {
93
- const imageKey = getImageKey(image)
94
-
95
- if (activeImage && getImageKey(activeImage) === imageKey) {
96
- setActiveImage(null)
97
- return
98
- }
99
-
100
- setActiveImage(image)
101
- setStackImages((current) => [
102
- ...current.filter((item) => getImageKey(item) !== imageKey),
103
- image,
104
- ])
105
- }
106
-
107
- return (
108
- <LayoutGroup id={layoutId}>
109
- <section
110
- aria-label="Image accordion"
111
- className={cn(
112
- 'grid gap-5 md:grid-cols-[minmax(240px,0.8fr)_minmax(0,1.5fr)] md:items-center md:gap-6',
113
- className,
114
- )}
115
- >
116
- <div className={stackClassName}>
117
- <div
118
- role="group"
119
- aria-label="Choose an image"
120
- className="relative mx-auto h-[19rem] w-full max-w-[22rem] sm:h-[22rem]"
121
- >
122
- {visibleImages.map((image, index) => {
123
- const imageKey = getImageKey(image)
124
- const isActive =
125
- activeImage !== null && getImageKey(activeImage) === imageKey
126
- const originalIndex = images.findIndex(
127
- (item) => getImageKey(item) === imageKey,
128
- )
129
- const offset = visibleImages.length - index - 1
130
-
131
- return (
132
- <motion.button
133
- key={imageKey}
134
- type="button"
135
- aria-label={
136
- isActive
137
- ? `Hide preview for ${image.title}`
138
- : `Show image ${index + 1}: ${image.title}`
139
- }
140
- aria-pressed={isActive}
141
- onClick={() => selectImage(image)}
142
- initial={false}
143
- animate={{
144
- x: index * 13,
145
- y: index * 14,
146
- rotate: (index - offset / 2) * 1.4,
147
- scale: 1 - offset * 0.018,
148
- }}
149
- whileHover={
150
- reduceMotion
151
- ? undefined
152
- : { x: index * 13 - 5, y: index * 14 - 7, scale: 1.035 }
153
- }
154
- whileTap={reduceMotion ? undefined : { scale: 0.98 }}
155
- transition={{
156
- type: 'spring',
157
- stiffness: 280,
158
- damping: 25,
159
- mass: 0.8,
160
- }}
161
- style={
162
- {
163
- ...glowStyle,
164
- left: `${index * 7}%`,
165
- top: `${index * 7}%`,
166
- zIndex: visibleImages.length - index,
167
- } as CSSProperties
168
- }
169
- className={cn(
170
- 'group focus-visible:ring-foreground focus-visible:ring-offset-background absolute isolate aspect-[4/3] w-[70%] cursor-pointer overflow-visible rounded-xl text-left focus-visible:ring-2 focus-visible:ring-offset-4 focus-visible:outline-none',
171
- !reduceMotion && 'transition-transform duration-300',
172
- cardClassName,
173
- image.className,
174
- )}
175
- >
176
- {glow !== false ? (
177
- <span
178
- aria-hidden="true"
179
- className={cn(
180
- 'pointer-events-none absolute -inset-3 -z-10 rounded-[inherit] bg-[radial-gradient(ellipse_at_var(--image-accordion-glow-position),var(--image-accordion-glow-color)_0%,transparent_var(--image-accordion-glow-size))] blur-[var(--image-accordion-glow-blur)] transition-opacity duration-300',
181
- isActive
182
- ? 'opacity-[var(--image-accordion-glow-opacity)]'
183
- : 'opacity-0 group-hover:opacity-[var(--image-accordion-glow-opacity)] group-focus-visible:opacity-[var(--image-accordion-glow-opacity)]',
184
- )}
185
- />
186
- ) : null}
187
-
188
- <span
189
- className={cn(
190
- 'border-border/70 bg-surface group-hover:border-foreground/55 relative block size-full overflow-hidden rounded-xl border shadow-[0_12px_32px_-18px_rgba(0,0,0,0.7)] transition-colors duration-300',
191
- isActive && 'border-foreground/60',
192
- )}
193
- >
194
- <motion.img
195
- layoutId={
196
- isActive
197
- ? undefined
198
- : `${layoutId}-image-${originalIndex}`
199
- }
200
- src={image.src}
201
- alt={image.alt}
202
- loading="lazy"
203
- decoding="async"
204
- referrerPolicy="no-referrer"
205
- draggable={false}
206
- transition={spring}
207
- className={cn(
208
- 'size-full object-cover',
209
- !reduceMotion &&
210
- 'transition-transform duration-500 ease-out group-hover:scale-105',
211
- imageClassName,
212
- image.imageClassName,
213
- )}
214
- />
215
- <span className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 via-black/20 to-transparent px-3 pt-8 pb-2 text-xs font-medium text-white opacity-0 transition-opacity duration-300 group-hover:opacity-100 group-focus-visible:opacity-100">
216
- {String(index + 1).padStart(2, '0')} / {image.title}
217
- </span>
218
- </span>
219
- </motion.button>
220
- )
221
- })}
222
- </div>
223
-
224
- <div className="text-muted mt-3 flex items-center justify-between font-mono text-[10px] tracking-[0.14em] uppercase">
225
- <span>Image stack</span>
226
- <span>
227
- {String(visibleImages.length).padStart(2, '0')} /{' '}
228
- {String(stackImages.length).padStart(2, '0')} images
229
- </span>
230
- </div>
231
- </div>
232
-
233
- <div
234
- className={cn(
235
- 'border-border/70 bg-surface/30 relative flex aspect-[4/3] min-h-64 items-center justify-center overflow-hidden rounded-xl border md:min-h-0',
236
- previewClassName,
237
- )}
238
- >
239
- <AnimatePresence mode="wait" initial={false}>
240
- {activeImage ? (
241
- <motion.figure
242
- key={getImageKey(activeImage)}
243
- initial={reduceMotion ? { opacity: 0 } : { opacity: 0.8 }}
244
- animate={{ opacity: 1 }}
245
- exit={{ opacity: 0 }}
246
- transition={{ duration: reduceMotion ? 0 : 0.22 }}
247
- className="absolute inset-0 m-0"
248
- >
249
- <motion.img
250
- layoutId={`${layoutId}-image-${images.findIndex((image) => getImageKey(image) === getImageKey(activeImage))}`}
251
- src={activeImage.src}
252
- alt={activeImage.alt}
253
- decoding="async"
254
- referrerPolicy="no-referrer"
255
- draggable={false}
256
- transition={spring}
257
- className={cn(
258
- 'size-full object-cover',
259
- imageClassName,
260
- activeImage.imageClassName,
261
- )}
262
- />
263
- <figcaption className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/40 to-transparent px-5 pt-16 pb-5 text-white sm:px-7 sm:pb-7">
264
- <p className="font-mono text-[10px] tracking-[0.18em] text-white/65 uppercase">
265
- Image {String(activePosition).padStart(2, '0')} /{' '}
266
- {String(stackImages.length).padStart(2, '0')}
267
- </p>
268
- <h2 className="mt-2 text-xl font-medium tracking-tight sm:text-2xl">
269
- {activeImage.title}
270
- </h2>
271
- {activeImage.description ? (
272
- <p className="mt-1 max-w-lg text-sm leading-6 text-white/75">
273
- {activeImage.description}
274
- </p>
275
- ) : null}
276
- </figcaption>
277
- </motion.figure>
278
- ) : (
279
- <motion.div
280
- key="empty-preview"
281
- initial={reduceMotion ? false : { opacity: 0 }}
282
- animate={{ opacity: 1 }}
283
- exit={{ opacity: 0 }}
284
- transition={{ duration: reduceMotion ? 0 : 0.2 }}
285
- className="px-6 text-center"
286
- >
287
- <p className="text-muted font-mono text-[10px] tracking-[0.18em] uppercase">
288
- Preview
289
- </p>
290
- <p className="text-muted mt-2 text-sm">
291
- Select a corner to reveal an image.
292
- </p>
293
- </motion.div>
294
- )}
295
- </AnimatePresence>
296
- </div>
297
- </section>
298
- </LayoutGroup>
299
- )
300
- }
301
-
302
- export default ImageAccordion
1
+ 'use client'
2
+
3
+ import { forwardRef, useId, useState } from 'react'
4
+ import type { CSSProperties } from 'react'
5
+ import {
6
+ AnimatePresence,
7
+ LayoutGroup,
8
+ motion,
9
+ useReducedMotion,
10
+ } from 'motion/react'
11
+ import { cn } from '@/lib/utils'
12
+
13
+ export type ImageAccordionItem = {
14
+ id?: string
15
+ src: string
16
+ alt: string
17
+ title: string
18
+ description?: string
19
+ className?: string
20
+ imageClassName?: string
21
+ }
22
+
23
+ export type ImageAccordionGlow = {
24
+ color?: string
25
+ position?: string
26
+ size?: string
27
+ opacity?: number
28
+ blur?: number
29
+ }
30
+
31
+ export type ImageAccordionProps = {
32
+ images: ImageAccordionItem[]
33
+ className?: string
34
+ stackClassName?: string
35
+ cardClassName?: string
36
+ imageClassName?: string
37
+ previewClassName?: string
38
+ visibleCount?: number
39
+ glow?: false | ImageAccordionGlow
40
+ transition?: {
41
+ stiffness?: number
42
+ damping?: number
43
+ mass?: number
44
+ }
45
+ }
46
+
47
+ export const ImageAccordion = forwardRef<HTMLElement, ImageAccordionProps>(function ImageAccordion({
48
+ images,
49
+ className,
50
+ stackClassName,
51
+ cardClassName,
52
+ imageClassName,
53
+ previewClassName,
54
+ visibleCount = 5,
55
+ glow = {},
56
+ transition,
57
+ }, ref) {
58
+ const [stackImages, setStackImages] = useState(images)
59
+ const [activeImage, setActiveImage] = useState<ImageAccordionItem | null>(
60
+ null,
61
+ )
62
+ const reduceMotion = useReducedMotion()
63
+ const layoutId = useId()
64
+ const visibleLimit = Number.isFinite(visibleCount)
65
+ ? Math.max(1, Math.floor(visibleCount))
66
+ : 5
67
+ const visibleImages = stackImages.slice(0, visibleLimit)
68
+ const glowOptions = typeof glow === 'object' ? glow : {}
69
+ const spring = {
70
+ type: 'spring' as const,
71
+ stiffness: transition?.stiffness ?? 190,
72
+ damping: transition?.damping ?? 24,
73
+ mass: transition?.mass ?? 0.8,
74
+ }
75
+ const glowStyle = {
76
+ '--image-accordion-glow-color': glowOptions.color ?? 'var(--foreground)',
77
+ '--image-accordion-glow-position': glowOptions.position ?? 'center',
78
+ '--image-accordion-glow-size': glowOptions.size ?? '72%',
79
+ '--image-accordion-glow-opacity': Math.min(
80
+ 1,
81
+ Math.max(0, glowOptions.opacity ?? 0.24),
82
+ ),
83
+ '--image-accordion-glow-blur': `${Math.max(0, glowOptions.blur ?? 18)}px`,
84
+ } as CSSProperties
85
+ const getImageKey = (image: ImageAccordionItem) => image.id ?? image.src
86
+ const activePosition = activeImage
87
+ ? stackImages.findIndex(
88
+ (image) => getImageKey(image) === getImageKey(activeImage),
89
+ ) + 1
90
+ : 0
91
+
92
+ function selectImage(image: ImageAccordionItem) {
93
+ const imageKey = getImageKey(image)
94
+
95
+ if (activeImage && getImageKey(activeImage) === imageKey) {
96
+ setActiveImage(null)
97
+ return
98
+ }
99
+
100
+ setActiveImage(image)
101
+ setStackImages((current) => [
102
+ ...current.filter((item) => getImageKey(item) !== imageKey),
103
+ image,
104
+ ])
105
+ }
106
+
107
+ return (
108
+ <LayoutGroup id={layoutId}>
109
+ <section
110
+ ref={ref}
111
+ aria-label="Image accordion"
112
+ className={cn(
113
+ 'grid gap-5 md:grid-cols-[minmax(240px,0.8fr)_minmax(0,1.5fr)] md:items-center md:gap-6',
114
+ className,
115
+ )}
116
+ >
117
+ <div className={stackClassName}>
118
+ <div
119
+ role="group"
120
+ aria-label="Choose an image"
121
+ className="relative mx-auto h-[19rem] w-full max-w-[22rem] sm:h-[22rem]"
122
+ >
123
+ {visibleImages.map((image, index) => {
124
+ const imageKey = getImageKey(image)
125
+ const isActive =
126
+ activeImage !== null &&
127
+ getImageKey(activeImage) === imageKey
128
+ const originalIndex = images.findIndex(
129
+ (item) => getImageKey(item) === imageKey,
130
+ )
131
+ const offset = visibleImages.length - index - 1
132
+
133
+ return (
134
+ <motion.button
135
+ key={imageKey}
136
+ type="button"
137
+ aria-label={
138
+ isActive
139
+ ? `Hide preview for ${image.title}`
140
+ : `Show image ${index + 1}: ${image.title}`
141
+ }
142
+ aria-pressed={isActive}
143
+ onClick={() => selectImage(image)}
144
+ initial={false}
145
+ animate={{
146
+ x: index * 13,
147
+ y: index * 14,
148
+ rotate: (index - offset / 2) * 1.4,
149
+ scale: 1 - offset * 0.018,
150
+ }}
151
+ whileHover={
152
+ reduceMotion
153
+ ? undefined
154
+ : { x: index * 13 - 5, y: index * 14 - 7, scale: 1.035 }
155
+ }
156
+ whileTap={reduceMotion ? undefined : { scale: 0.98 }}
157
+ transition={{
158
+ type: 'spring',
159
+ stiffness: 280,
160
+ damping: 25,
161
+ mass: 0.8,
162
+ }}
163
+ style={
164
+ {
165
+ ...glowStyle,
166
+ left: `${index * 7}%`,
167
+ top: `${index * 7}%`,
168
+ zIndex: visibleImages.length - index,
169
+ } as CSSProperties
170
+ }
171
+ className={cn(
172
+ 'group isolate absolute aspect-[4/3] w-[70%] cursor-pointer overflow-visible rounded-xl text-left focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-4 focus-visible:ring-offset-background focus-visible:outline-none',
173
+ !reduceMotion && 'transition-transform duration-300',
174
+ cardClassName,
175
+ image.className,
176
+ )}
177
+ >
178
+ {glow !== false ? (
179
+ <span
180
+ aria-hidden="true"
181
+ className={cn(
182
+ 'pointer-events-none absolute -inset-3 -z-10 rounded-[inherit] bg-[radial-gradient(ellipse_at_var(--image-accordion-glow-position),var(--image-accordion-glow-color)_0%,transparent_var(--image-accordion-glow-size))] blur-[var(--image-accordion-glow-blur)] transition-opacity duration-300',
183
+ isActive
184
+ ? 'opacity-[var(--image-accordion-glow-opacity)]'
185
+ : 'opacity-0 group-hover:opacity-[var(--image-accordion-glow-opacity)] group-focus-visible:opacity-[var(--image-accordion-glow-opacity)]',
186
+ )}
187
+ />
188
+ ) : null}
189
+
190
+ <span
191
+ className={cn(
192
+ 'border-border/70 bg-surface group-hover:border-foreground/55 relative block size-full overflow-hidden rounded-xl border shadow-[0_12px_32px_-18px_rgba(0,0,0,0.7)] transition-colors duration-300',
193
+ isActive && 'border-foreground/60',
194
+ )}
195
+ >
196
+ <motion.img
197
+ layoutId={
198
+ isActive
199
+ ? undefined
200
+ : `${layoutId}-image-${originalIndex}`
201
+ }
202
+ src={image.src}
203
+ alt={image.alt}
204
+ loading="lazy"
205
+ decoding="async"
206
+ referrerPolicy="no-referrer"
207
+ draggable={false}
208
+ transition={spring}
209
+ className={cn(
210
+ 'size-full object-cover',
211
+ !reduceMotion &&
212
+ 'transition-transform duration-500 ease-out group-hover:scale-105',
213
+ imageClassName,
214
+ image.imageClassName,
215
+ )}
216
+ />
217
+ <span className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 via-black/20 to-transparent px-3 pt-8 pb-2 text-xs font-medium text-white opacity-0 transition-opacity duration-300 group-hover:opacity-100 group-focus-visible:opacity-100">
218
+ {String(index + 1).padStart(2, '0')} / {image.title}
219
+ </span>
220
+ </span>
221
+ </motion.button>
222
+ )
223
+ })}
224
+ </div>
225
+
226
+ <div className="text-muted mt-3 flex items-center justify-between font-mono text-[10px] tracking-[0.14em] uppercase">
227
+ <span>Image stack</span>
228
+ <span>
229
+ {String(visibleImages.length).padStart(2, '0')} /{' '}
230
+ {String(stackImages.length).padStart(2, '0')} images
231
+ </span>
232
+ </div>
233
+ </div>
234
+
235
+ <div
236
+ className={cn(
237
+ 'border-border/70 bg-surface/30 relative flex aspect-[4/3] min-h-64 items-center justify-center overflow-hidden rounded-xl border md:min-h-0',
238
+ previewClassName,
239
+ )}
240
+ >
241
+ <AnimatePresence mode="wait" initial={false}>
242
+ {activeImage ? (
243
+ <motion.figure
244
+ key={getImageKey(activeImage)}
245
+ initial={reduceMotion ? { opacity: 0 } : { opacity: 0.8 }}
246
+ animate={{ opacity: 1 }}
247
+ exit={{ opacity: 0 }}
248
+ transition={{ duration: reduceMotion ? 0 : 0.22 }}
249
+ className="absolute inset-0 m-0"
250
+ >
251
+ <motion.img
252
+ layoutId={`${layoutId}-image-${images.findIndex((image) => getImageKey(image) === getImageKey(activeImage))}`}
253
+ src={activeImage.src}
254
+ alt={activeImage.alt}
255
+ decoding="async"
256
+ referrerPolicy="no-referrer"
257
+ draggable={false}
258
+ transition={spring}
259
+ className={cn(
260
+ 'size-full object-cover',
261
+ imageClassName,
262
+ activeImage.imageClassName,
263
+ )}
264
+ />
265
+ <figcaption className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/40 to-transparent px-5 pt-16 pb-5 text-white sm:px-7 sm:pb-7">
266
+ <p className="font-mono text-[10px] tracking-[0.18em] text-white/65 uppercase">
267
+ Image {String(activePosition).padStart(2, '0')} /{' '}
268
+ {String(stackImages.length).padStart(2, '0')}
269
+ </p>
270
+ <h2 className="mt-2 text-xl font-medium tracking-tight sm:text-2xl">
271
+ {activeImage.title}
272
+ </h2>
273
+ {activeImage.description ? (
274
+ <p className="mt-1 max-w-lg text-sm leading-6 text-white/75">
275
+ {activeImage.description}
276
+ </p>
277
+ ) : null}
278
+ </figcaption>
279
+ </motion.figure>
280
+ ) : (
281
+ <motion.div
282
+ key="empty-preview"
283
+ initial={reduceMotion ? false : { opacity: 0 }}
284
+ animate={{ opacity: 1 }}
285
+ exit={{ opacity: 0 }}
286
+ transition={{ duration: reduceMotion ? 0 : 0.2 }}
287
+ className="px-6 text-center"
288
+ >
289
+ <p className="text-muted font-mono text-[10px] tracking-[0.18em] uppercase">
290
+ Preview
291
+ </p>
292
+ <p className="text-muted mt-2 text-sm">
293
+ Select a corner to reveal an image.
294
+ </p>
295
+ </motion.div>
296
+ )}
297
+ </AnimatePresence>
298
+ </div>
299
+ </section>
300
+ </LayoutGroup>
301
+ )
302
+ })
303
+
304
+ ImageAccordion.displayName = 'ImageAccordion'
305
+
306
+ export default ImageAccordion