@istmx/ui 0.1.12 → 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.
- package/LICENSE +21 -21
- package/README.md +533 -469
- package/bin/istmx.mjs +481 -318
- package/package.json +27 -27
- package/registry/accordion.tsx +186 -0
- package/registry/ai-chat-block/ai-chat-block.tsx +456 -460
- package/registry/ai-chat-block/ai-chat-input.tsx +694 -694
- package/registry/ai-chat-block/attachment.tsx +466 -466
- package/registry/ai-chat-block/chat-code-block.tsx +50 -50
- package/registry/ai-chat-block/chat-composer.tsx +51 -51
- package/registry/ai-chat-block/chat-logo.tsx +18 -18
- package/registry/ai-chat-block/chat-message.tsx +161 -161
- package/registry/ai-chat-block/chat-sidebar.tsx +273 -273
- package/registry/ai-chat-block/chat-user-avatar.tsx +9 -9
- package/registry/ai-chat-block/code-highlighter.tsx +342 -357
- package/registry/ai-chat-block/default-attachments.tsx +42 -42
- package/registry/ai-chat-block/index.ts +30 -30
- package/registry/ai-chat-block/message-content.tsx +287 -287
- package/registry/ai-chat-block/message-list.tsx +93 -93
- package/registry/ai-chat-block/send-button.tsx +102 -102
- package/registry/ai-chat-block/types.ts +70 -71
- package/registry/ai-chat-block/utils.ts +6 -6
- package/registry/ai-chat-block/voice-button.tsx +66 -66
- package/registry/alert-dialog.tsx +229 -0
- package/registry/alert.tsx +188 -0
- package/registry/animated-text.tsx +228 -225
- package/registry/aspect-ratio.tsx +32 -0
- package/registry/avatar-group.tsx +66 -0
- package/registry/avatar.tsx +121 -0
- package/registry/badge.tsx +52 -0
- package/registry/bento-grid.tsx +438 -433
- package/registry/button.tsx +156 -237
- package/registry/carousel.tsx +184 -0
- package/registry/dock-navigation.tsx +200 -198
- package/registry/drift-canvas.tsx +383 -0
- package/registry/drift-wall.tsx +361 -0
- package/registry/flex-carousel.tsx +1430 -0
- package/registry/guided-gallery.tsx +1506 -0
- package/registry/image-accordion.tsx +306 -302
- package/registry/image-trail.tsx +126 -121
- package/registry/infinite-image-canvas.tsx +268 -263
- package/registry/input-otp.tsx +332 -0
- package/registry/list-card.tsx +130 -0
- package/registry/mobile-menu-dock.tsx +216 -211
- package/registry/morph-slider.tsx +756 -0
- package/registry/pixel-cat.tsx +972 -1020
- package/registry/scroll-canvas-cards.tsx +643 -640
- package/registry/scroll-parallax-hero.tsx +566 -565
- package/registry/scroll-story-cards.tsx +443 -438
- package/registry/slider.tsx +163 -0
- package/registry/spotlight-grid.tsx +226 -0
- package/registry/streaming-text.tsx +269 -278
- package/registry/text-reveal.tsx +311 -307
- package/registry/user-avatar.tsx +99 -0
- package/registry/utils.ts +6 -6
|
@@ -1,211 +1,216 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import { useEffect, useState } from 'react'
|
|
5
|
-
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
|
|
6
|
-
import {
|
|
7
|
-
IconArrowRight,
|
|
8
|
-
IconArrowUpRight,
|
|
9
|
-
IconGridDots,
|
|
10
|
-
IconSearch,
|
|
11
|
-
IconX,
|
|
12
|
-
} from '@tabler/icons-react'
|
|
13
|
-
import { cn } from '@/lib/utils'
|
|
14
|
-
|
|
15
|
-
export type MobileMenuDockItem = {
|
|
16
|
-
label: string
|
|
17
|
-
href: string
|
|
18
|
-
active?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type MobileMenuDockSearchItem = {
|
|
22
|
-
name: string
|
|
23
|
-
slug: string
|
|
24
|
-
href: string
|
|
25
|
-
category: string
|
|
26
|
-
description: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type MobileMenuDockProps = {
|
|
30
|
-
items: MobileMenuDockItem[]
|
|
31
|
-
searchItems: readonly MobileMenuDockSearchItem[]
|
|
32
|
-
label?: string
|
|
33
|
-
placement?: 'fixed' | 'inline'
|
|
34
|
-
className?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
items,
|
|
39
|
-
searchItems,
|
|
40
|
-
label = 'Mobile navigation',
|
|
41
|
-
placement = 'fixed',
|
|
42
|
-
className,
|
|
43
|
-
}
|
|
44
|
-
const [open, setOpen] = useState(false)
|
|
45
|
-
const [query, setQuery] = useState('')
|
|
46
|
-
const reduceMotion = useReducedMotion()
|
|
47
|
-
const filteredComponents = searchItems.filter((item) =>
|
|
48
|
-
`${item.name} ${item.category} ${item.description}`
|
|
49
|
-
.toLowerCase()
|
|
50
|
-
.includes(query.trim().toLowerCase()),
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (!open) return
|
|
55
|
-
|
|
56
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
57
|
-
if (event.key === 'Escape') {
|
|
58
|
-
setOpen(false)
|
|
59
|
-
setQuery('')
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
window.addEventListener('keydown', onKeyDown)
|
|
64
|
-
return () => window.removeEventListener('keydown', onKeyDown)
|
|
65
|
-
}, [open])
|
|
66
|
-
|
|
67
|
-
function toggleMenu() {
|
|
68
|
-
setOpen((current) => !current)
|
|
69
|
-
setQuery('')
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<div
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
aria-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
aria-
|
|
199
|
-
aria-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import Link from 'next/link'
|
|
4
|
+
import { forwardRef, useEffect, useState } from 'react'
|
|
5
|
+
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
|
|
6
|
+
import {
|
|
7
|
+
IconArrowRight,
|
|
8
|
+
IconArrowUpRight,
|
|
9
|
+
IconGridDots,
|
|
10
|
+
IconSearch,
|
|
11
|
+
IconX,
|
|
12
|
+
} from '@tabler/icons-react'
|
|
13
|
+
import { cn } from '@/lib/utils'
|
|
14
|
+
|
|
15
|
+
export type MobileMenuDockItem = {
|
|
16
|
+
label: string
|
|
17
|
+
href: string
|
|
18
|
+
active?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type MobileMenuDockSearchItem = {
|
|
22
|
+
name: string
|
|
23
|
+
slug: string
|
|
24
|
+
href: string
|
|
25
|
+
category: string
|
|
26
|
+
description: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type MobileMenuDockProps = {
|
|
30
|
+
items: MobileMenuDockItem[]
|
|
31
|
+
searchItems: readonly MobileMenuDockSearchItem[]
|
|
32
|
+
label?: string
|
|
33
|
+
placement?: 'fixed' | 'inline'
|
|
34
|
+
className?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const MobileMenuDock = forwardRef<HTMLDivElement, MobileMenuDockProps>(function MobileMenuDock({
|
|
38
|
+
items,
|
|
39
|
+
searchItems,
|
|
40
|
+
label = 'Mobile navigation',
|
|
41
|
+
placement = 'fixed',
|
|
42
|
+
className,
|
|
43
|
+
}, ref) {
|
|
44
|
+
const [open, setOpen] = useState(false)
|
|
45
|
+
const [query, setQuery] = useState('')
|
|
46
|
+
const reduceMotion = useReducedMotion()
|
|
47
|
+
const filteredComponents = searchItems.filter((item) =>
|
|
48
|
+
`${item.name} ${item.category} ${item.description}`
|
|
49
|
+
.toLowerCase()
|
|
50
|
+
.includes(query.trim().toLowerCase()),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!open) return
|
|
55
|
+
|
|
56
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
57
|
+
if (event.key === 'Escape') {
|
|
58
|
+
setOpen(false)
|
|
59
|
+
setQuery('')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
window.addEventListener('keydown', onKeyDown)
|
|
64
|
+
return () => window.removeEventListener('keydown', onKeyDown)
|
|
65
|
+
}, [open])
|
|
66
|
+
|
|
67
|
+
function toggleMenu() {
|
|
68
|
+
setOpen((current) => !current)
|
|
69
|
+
setQuery('')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
placement === 'fixed'
|
|
77
|
+
? 'fixed inset-x-0 bottom-[calc(env(safe-area-inset-bottom)+0.75rem)] z-50 mx-auto w-[min(21rem,calc(100vw-2rem))] sm:hidden'
|
|
78
|
+
: 'relative z-10 mx-auto w-full',
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
<AnimatePresence initial={false}>
|
|
83
|
+
{open ? (
|
|
84
|
+
<motion.nav
|
|
85
|
+
id="mobile-menu-dock-panel"
|
|
86
|
+
aria-label={label}
|
|
87
|
+
className="border-border/80 bg-background/95 mb-2 overflow-hidden rounded-xl border p-1.5 shadow-[0_12px_40px_rgba(0,0,0,0.2)] backdrop-blur-xl"
|
|
88
|
+
initial={
|
|
89
|
+
reduceMotion ? { opacity: 0 } : { opacity: 0, y: 8, scale: 0.985 }
|
|
90
|
+
}
|
|
91
|
+
animate={{ opacity: 1, y: 0, scale: 1 }}
|
|
92
|
+
exit={
|
|
93
|
+
reduceMotion ? { opacity: 0 } : { opacity: 0, y: 5, scale: 0.99 }
|
|
94
|
+
}
|
|
95
|
+
transition={{
|
|
96
|
+
duration: reduceMotion ? 0.12 : 0.2,
|
|
97
|
+
ease: 'easeOut',
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<div className="border-border/60 text-muted border-b px-3.5 py-2 font-mono text-[9px] tracking-[0.12em] uppercase">
|
|
101
|
+
{query.trim() ? 'Components' : 'Navigate'}
|
|
102
|
+
</div>
|
|
103
|
+
<ul className="max-h-[min(55vh,24rem)] overflow-y-auto">
|
|
104
|
+
{query.trim() ? (
|
|
105
|
+
filteredComponents.length ? (
|
|
106
|
+
filteredComponents.map((item) => (
|
|
107
|
+
<li key={item.slug}>
|
|
108
|
+
<Link
|
|
109
|
+
href={item.href}
|
|
110
|
+
onClick={() => {
|
|
111
|
+
setOpen(false)
|
|
112
|
+
setQuery('')
|
|
113
|
+
}}
|
|
114
|
+
className="text-muted hover:bg-surface/70 hover:text-foreground flex min-h-12 items-center gap-3 rounded-lg px-3.5 transition-colors"
|
|
115
|
+
>
|
|
116
|
+
<span className="min-w-0 flex-1">
|
|
117
|
+
<span className="flex items-center justify-between gap-3">
|
|
118
|
+
<span className="font-display text-foreground text-sm font-medium">
|
|
119
|
+
{item.name}
|
|
120
|
+
</span>
|
|
121
|
+
<span className="font-mono text-[9px] tracking-wide uppercase">
|
|
122
|
+
{item.category}
|
|
123
|
+
</span>
|
|
124
|
+
</span>
|
|
125
|
+
<span className="mt-0.5 block truncate text-xs">
|
|
126
|
+
{item.description}
|
|
127
|
+
</span>
|
|
128
|
+
</span>
|
|
129
|
+
<IconArrowRight
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
className="shrink-0"
|
|
132
|
+
size={15}
|
|
133
|
+
stroke={1.6}
|
|
134
|
+
/>
|
|
135
|
+
</Link>
|
|
136
|
+
</li>
|
|
137
|
+
))
|
|
138
|
+
) : (
|
|
139
|
+
<li className="text-muted px-3.5 py-4 text-center text-sm">
|
|
140
|
+
No items match “{query}”.
|
|
141
|
+
</li>
|
|
142
|
+
)
|
|
143
|
+
) : (
|
|
144
|
+
items.map((item) => (
|
|
145
|
+
<li key={item.href}>
|
|
146
|
+
<Link
|
|
147
|
+
href={item.href}
|
|
148
|
+
aria-current={item.active ? 'page' : undefined}
|
|
149
|
+
onClick={() => {
|
|
150
|
+
setOpen(false)
|
|
151
|
+
setQuery('')
|
|
152
|
+
}}
|
|
153
|
+
className={cn(
|
|
154
|
+
'flex min-h-11 items-center justify-between rounded-lg px-3.5 text-sm transition-colors',
|
|
155
|
+
item.active
|
|
156
|
+
? 'bg-surface text-foreground'
|
|
157
|
+
: 'text-muted hover:bg-surface/70 hover:text-foreground',
|
|
158
|
+
)}
|
|
159
|
+
>
|
|
160
|
+
{item.label}
|
|
161
|
+
<IconArrowUpRight
|
|
162
|
+
aria-hidden="true"
|
|
163
|
+
className="text-muted/60"
|
|
164
|
+
size={15}
|
|
165
|
+
stroke={1.6}
|
|
166
|
+
/>
|
|
167
|
+
</Link>
|
|
168
|
+
</li>
|
|
169
|
+
))
|
|
170
|
+
)}
|
|
171
|
+
</ul>
|
|
172
|
+
</motion.nav>
|
|
173
|
+
) : null}
|
|
174
|
+
</AnimatePresence>
|
|
175
|
+
|
|
176
|
+
<div className="border-border/80 bg-background/95 flex h-12 items-center gap-2 rounded-xl border px-2.5 shadow-[0_8px_28px_rgba(0,0,0,0.16)] backdrop-blur-xl">
|
|
177
|
+
<IconSearch
|
|
178
|
+
aria-hidden="true"
|
|
179
|
+
className="text-muted shrink-0"
|
|
180
|
+
size={17}
|
|
181
|
+
stroke={1.7}
|
|
182
|
+
/>
|
|
183
|
+
<input
|
|
184
|
+
value={query}
|
|
185
|
+
onChange={(event) => {
|
|
186
|
+
setQuery(event.target.value)
|
|
187
|
+
setOpen(true)
|
|
188
|
+
}}
|
|
189
|
+
onFocus={() => setOpen(true)}
|
|
190
|
+
placeholder="Search..."
|
|
191
|
+
aria-label="Search by name, category, or description"
|
|
192
|
+
aria-controls="mobile-menu-dock-panel"
|
|
193
|
+
className="text-foreground placeholder:text-muted/70 min-w-0 flex-1 bg-transparent text-sm outline-none"
|
|
194
|
+
/>
|
|
195
|
+
<button
|
|
196
|
+
type="button"
|
|
197
|
+
onClick={toggleMenu}
|
|
198
|
+
aria-label={open ? 'Close navigation menu' : 'Open navigation menu'}
|
|
199
|
+
aria-expanded={open}
|
|
200
|
+
aria-controls="mobile-menu-dock-panel"
|
|
201
|
+
className="border-border/70 bg-surface/45 text-muted hover:border-foreground/40 hover:text-foreground focus-visible:outline-foreground inline-flex size-8 shrink-0 items-center justify-center rounded-lg border transition-colors focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
202
|
+
>
|
|
203
|
+
{open ? (
|
|
204
|
+
<IconX aria-hidden="true" size={16} stroke={1.8} />
|
|
205
|
+
) : (
|
|
206
|
+
<IconGridDots aria-hidden="true" size={16} stroke={1.8} />
|
|
207
|
+
)}
|
|
208
|
+
</button>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
MobileMenuDock.displayName = 'MobileMenuDock'
|
|
215
|
+
|
|
216
|
+
export default MobileMenuDock
|