@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.
Files changed (55) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +533 -469
  3. package/bin/istmx.mjs +481 -318
  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 -640
  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,121 +1,126 @@
1
- 'use client'
2
-
3
- import { useRef, useState } from 'react'
4
- import type { PointerEvent } from 'react'
5
- import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
6
- import { cn } from '@/lib/utils'
7
-
8
- export type ImageTrailItem = {
9
- src: string
10
- alt: string
11
- }
12
-
13
- export type ImageTrailProps = {
14
- images: ImageTrailItem[]
15
- className?: string
16
- imageClassName?: string
17
- throttle?: number
18
- maxTrailItems?: number
19
- }
20
-
21
- type TrailImage = ImageTrailItem & {
22
- id: number
23
- x: number
24
- y: number
25
- rotate: number
26
- driftX: number
27
- driftY: number
28
- }
29
-
30
- export default function ImageTrail({
31
- images,
32
- className,
33
- imageClassName,
34
- throttle = 160,
35
- maxTrailItems = 5,
36
- }: ImageTrailProps) {
37
- const [trail, setTrail] = useState<TrailImage[]>([])
38
- const lastSpawn = useRef(0)
39
- const nextId = useRef(0)
40
- const reduceMotion = useReducedMotion()
41
-
42
- function handlePointerMove(event: PointerEvent<HTMLDivElement>) {
43
- if (reduceMotion || images.length === 0) return
44
-
45
- const now = performance.now()
46
- if (now - lastSpawn.current < Math.max(0, throttle)) return
47
- lastSpawn.current = now
48
-
49
- const bounds = event.currentTarget.getBoundingClientRect()
50
- const id = nextId.current++
51
- const image = images[id % images.length]
52
- const x = event.clientX - bounds.left
53
- const y = event.clientY - bounds.top
54
-
55
- setTrail((current) => [
56
- ...current,
57
- {
58
- ...image,
59
- id,
60
- x,
61
- y,
62
- rotate: (id % 2 === 0 ? -1 : 1) * (4 + (id % 4) * 2),
63
- driftX: (id % 2 === 0 ? -1 : 1) * (12 + (id % 3) * 5),
64
- driftY: -18 - (id % 3) * 7,
65
- },
66
- ].slice(-Math.max(1, maxTrailItems)))
67
- }
68
-
69
- return (
70
- <div
71
- role="group"
72
- aria-label="Move or tap over the canvas to create an image trail"
73
- onPointerMove={handlePointerMove}
74
- onPointerDown={handlePointerMove}
75
- className={cn(
76
- 'border-border bg-surface relative isolate h-[24rem] w-full touch-pan-y overflow-hidden rounded-2xl border bg-[radial-gradient(ellipse_at_50%_40%,color-mix(in_srgb,var(--foreground)_9%,transparent),transparent_55%),linear-gradient(145deg,color-mix(in_srgb,var(--foreground)_3%,var(--background)),var(--background))] sm:h-[32rem]',
77
- className,
78
- )}
79
- >
80
- <div
81
- aria-hidden="true"
82
- className="pointer-events-none absolute inset-0 bg-[linear-gradient(to_right,color-mix(in_srgb,var(--foreground)_3%,transparent)_1px,transparent_1px),linear-gradient(to_bottom,color-mix(in_srgb,var(--foreground)_3%,transparent)_1px,transparent_1px)] bg-size-[48px_48px] opacity-30"
83
- />
84
- <div className="pointer-events-none absolute inset-x-0 top-5 z-10 flex justify-center px-4">
85
- <span className="border-border/70 bg-background/75 text-muted rounded-full border px-4 py-2 text-xs shadow-sm backdrop-blur-md">
86
- Move or tap to explore
87
- </span>
88
- </div>
89
-
90
- <AnimatePresence initial={false}>
91
- {trail.map((item) => (
92
- <motion.img
93
- key={item.id}
94
- src={item.src}
95
- alt=""
96
- aria-hidden="true"
97
- draggable={false}
98
- initial={{ opacity: 0, scale: 0.72, rotate: item.rotate + 8 }}
99
- animate={{
100
- opacity: [0, 1, 0.88, 0],
101
- scale: [0.72, 1, 1, 0.86],
102
- rotate: item.rotate,
103
- x: item.driftX,
104
- y: item.driftY,
105
- }}
106
- exit={{ opacity: 0, scale: 0.8 }}
107
- transition={{ duration: 1.15, times: [0, 0.16, 0.58, 1], ease: 'easeOut' }}
108
- onAnimationComplete={() =>
109
- setTrail((current) => current.filter((image) => image.id !== item.id))
110
- }
111
- style={{ left: item.x, top: item.y }}
112
- className={cn(
113
- 'pointer-events-none absolute -ml-[5.25rem] -mt-[7rem] h-56 w-40 rounded-xl border border-white/70 object-cover shadow-[0_18px_50px_-18px_rgba(0,0,0,0.65)] sm:-ml-[6rem] sm:-mt-[8rem] sm:h-64 sm:w-48',
114
- imageClassName,
115
- )}
116
- />
117
- ))}
118
- </AnimatePresence>
119
- </div>
120
- )
121
- }
1
+ 'use client'
2
+
3
+ import { forwardRef, useRef, useState } from 'react'
4
+ import type { PointerEvent } from 'react'
5
+ import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
6
+ import { cn } from '@/lib/utils'
7
+
8
+ export type ImageTrailItem = {
9
+ src: string
10
+ alt: string
11
+ }
12
+
13
+ export type ImageTrailProps = {
14
+ images: ImageTrailItem[]
15
+ className?: string
16
+ imageClassName?: string
17
+ throttle?: number
18
+ maxTrailItems?: number
19
+ }
20
+
21
+ type TrailImage = ImageTrailItem & {
22
+ id: number
23
+ x: number
24
+ y: number
25
+ rotate: number
26
+ driftX: number
27
+ driftY: number
28
+ }
29
+
30
+ const ImageTrail = forwardRef<HTMLDivElement, ImageTrailProps>(function ImageTrail({
31
+ images,
32
+ className,
33
+ imageClassName,
34
+ throttle = 160,
35
+ maxTrailItems = 5,
36
+ }, ref) {
37
+ const [trail, setTrail] = useState<TrailImage[]>([])
38
+ const lastSpawn = useRef(0)
39
+ const nextId = useRef(0)
40
+ const reduceMotion = useReducedMotion()
41
+
42
+ function handlePointerMove(event: PointerEvent<HTMLDivElement>) {
43
+ if (reduceMotion || images.length === 0) return
44
+
45
+ const now = performance.now()
46
+ if (now - lastSpawn.current < Math.max(0, throttle)) return
47
+ lastSpawn.current = now
48
+
49
+ const bounds = event.currentTarget.getBoundingClientRect()
50
+ const id = nextId.current++
51
+ const image = images[id % images.length]
52
+ const x = event.clientX - bounds.left
53
+ const y = event.clientY - bounds.top
54
+
55
+ setTrail((current) => [
56
+ ...current,
57
+ {
58
+ ...image,
59
+ id,
60
+ x,
61
+ y,
62
+ rotate: (id % 2 === 0 ? -1 : 1) * (4 + (id % 4) * 2),
63
+ driftX: (id % 2 === 0 ? -1 : 1) * (12 + (id % 3) * 5),
64
+ driftY: -18 - (id % 3) * 7,
65
+ },
66
+ ].slice(-Math.max(1, maxTrailItems)))
67
+ }
68
+
69
+ return (
70
+ <div
71
+ ref={ref}
72
+ role="group"
73
+ aria-label="Move or tap over the canvas to create an image trail"
74
+ onPointerMove={handlePointerMove}
75
+ onPointerDown={handlePointerMove}
76
+ className={cn(
77
+ 'border-border bg-surface relative isolate h-[24rem] w-full touch-pan-y overflow-hidden rounded-2xl border bg-[radial-gradient(ellipse_at_50%_40%,color-mix(in_srgb,var(--foreground)_9%,transparent),transparent_55%),linear-gradient(145deg,color-mix(in_srgb,var(--foreground)_3%,var(--background)),var(--background))] sm:h-[32rem]',
78
+ className,
79
+ )}
80
+ >
81
+ <div
82
+ aria-hidden="true"
83
+ className="pointer-events-none absolute inset-0 bg-[linear-gradient(to_right,color-mix(in_srgb,var(--foreground)_3%,transparent)_1px,transparent_1px),linear-gradient(to_bottom,color-mix(in_srgb,var(--foreground)_3%,transparent)_1px,transparent_1px)] bg-size-[48px_48px] opacity-30"
84
+ />
85
+ <div className="pointer-events-none absolute inset-x-0 top-5 z-10 flex justify-center px-4">
86
+ <span className="border-border/70 bg-background/75 text-muted rounded-full border px-4 py-2 text-xs shadow-sm backdrop-blur-md">
87
+ Move or tap to explore
88
+ </span>
89
+ </div>
90
+
91
+ <AnimatePresence initial={false}>
92
+ {trail.map((item) => (
93
+ <motion.img
94
+ key={item.id}
95
+ src={item.src}
96
+ alt=""
97
+ aria-hidden="true"
98
+ draggable={false}
99
+ initial={{ opacity: 0, scale: 0.72, rotate: item.rotate + 8 }}
100
+ animate={{
101
+ opacity: [0, 1, 0.88, 0],
102
+ scale: [0.72, 1, 1, 0.86],
103
+ rotate: item.rotate,
104
+ x: item.driftX,
105
+ y: item.driftY,
106
+ }}
107
+ exit={{ opacity: 0, scale: 0.8 }}
108
+ transition={{ duration: 1.15, times: [0, 0.16, 0.58, 1], ease: 'easeOut' }}
109
+ onAnimationComplete={() =>
110
+ setTrail((current) => current.filter((image) => image.id !== item.id))
111
+ }
112
+ style={{ left: item.x, top: item.y }}
113
+ className={cn(
114
+ 'pointer-events-none absolute -ml-[5.25rem] -mt-[7rem] h-56 w-40 rounded-xl border border-white/70 object-cover shadow-[0_18px_50px_-18px_rgba(0,0,0,0.65)] sm:-ml-[6rem] sm:-mt-[8rem] sm:h-64 sm:w-48',
115
+ imageClassName,
116
+ )}
117
+ />
118
+ ))}
119
+ </AnimatePresence>
120
+ </div>
121
+ )
122
+ })
123
+
124
+ ImageTrail.displayName = 'ImageTrail'
125
+
126
+ export default ImageTrail