@istmx/ui 0.1.2 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,34 +1,331 @@
1
- # ISTMX UI CLI
1
+ # ISTMX UI
2
2
 
3
- The ISTMX CLI adds editable UI component source files to your project and
4
- installs the dependencies they need.
3
+ Editable UI components for your codebase. ISTMX adds the component source to
4
+ your project so you can read it, change it, and make it yours.
5
+
6
+ **Website:** [aryanonai.vercel.app](http://aryanonai.vercel.app/)
5
7
 
6
8
  ## Add a component
7
9
 
8
- Run one of these from your project root:
10
+ Run the command from your project root:
9
11
 
10
12
  ```sh
11
13
  npx @istmx/ui add animated-text
14
+ ```
15
+
16
+ Or use your preferred package manager:
17
+
18
+ ```sh
12
19
  pnpm dlx @istmx/ui add animated-text
13
20
  yarn dlx @istmx/ui add animated-text
14
21
  bunx @istmx/ui add animated-text
15
22
  ```
16
23
 
17
- The CLI displays each step as it runs, writes the component to
24
+ Add the image stack component with:
25
+
26
+ ```sh
27
+ npx @istmx/ui add image-accordion
28
+ ```
29
+
30
+ Add the magnifying dock navigation with:
31
+
32
+ ```sh
33
+ npx @istmx/ui add dock-navigation
34
+ ```
35
+
36
+ Add the scroll-scrubbed image story with:
37
+
38
+ ```sh
39
+ npx @istmx/ui add scroll-story-cards
40
+ ```
41
+
42
+ Add the interactive pixel cat with:
43
+
44
+ ```sh
45
+ npx @istmx/ui add pixel-cat
46
+ ```
47
+
48
+ The CLI detects your package manager, copies the editable component to
18
49
  `components/ui/animated-text.tsx`, adds the shared `cn` helper at
19
- `lib/utils.ts` when it is missing, detects the project's package manager, and
20
- installs any missing `motion`, `clsx`, and `tailwind-merge` dependencies. The
21
- component uses Tailwind utility classes, so your app should already have
22
- Tailwind CSS configured.
50
+ `lib/utils.ts` if it is missing, and installs any missing dependencies:
51
+
52
+ - [Motion](https://motion.dev/) for animation
53
+ - [clsx](https://www.npmjs.com/package/clsx) and [tailwind-merge](https://www.npmjs.com/package/tailwind-merge) for class composition
54
+ - `@tabler/icons-react` for components that include Tabler icons
55
+
56
+ Your project should already use React and have Tailwind CSS configured. After
57
+ installation, the component is yours to edit; your app does not need to import
58
+ runtime code from `@istmx/ui`.
59
+
60
+ ## Animated Text
61
+
62
+ Import the copied source into your app:
63
+
64
+ ```tsx
65
+ import AnimatedText from '@/components/ui/animated-text'
66
+
67
+ export function Intro() {
68
+ return (
69
+ <p>
70
+ I&apos;m{' '}
71
+ <AnimatedText
72
+ items={['an AI engineer', 'a full-stack developer', 'a builder']}
73
+ effects={['blur', 'fade', 'shimmer']}
74
+ interval={2400}
75
+ />
76
+ </p>
77
+ )
78
+ }
79
+ ```
80
+
81
+ Available effects are `blur`, `fade`, `shimmer`, `slide`, and `wave`. Use the
82
+ `effect` prop for one effect, or `effects` to combine several. The component
83
+ respects the user's reduced-motion setting.
84
+
85
+ ### Customize the text and shimmer
86
+
87
+ Use `className` to style the wrapper and `textClassName` to style the changing
88
+ text. For shimmer, set custom CSS colors with `effectOptions`:
89
+
90
+ ```tsx
91
+ <AnimatedText
92
+ items={['an AI engineer', 'a builder']}
93
+ effects={['blur', 'shimmer']}
94
+ textClassName="font-semibold"
95
+ effectOptions={{
96
+ shimmer: {
97
+ color: '#71717a',
98
+ highlight: '#f4f4f5',
99
+ duration: 2.2,
100
+ width: 36,
101
+ },
102
+ }}
103
+ />
104
+ ```
105
+
106
+ Other options include `direction`, `interval`, `speed`, `scale`, and effect
107
+ settings for blur, fade, slide, and wave. The full component implementation is
108
+ in your `components/ui/animated-text.tsx` file.
23
109
 
24
- The Animated Text component exposes `textClassName` for text styling and
25
- `effectOptions.shimmer.color` / `effectOptions.shimmer.highlight` for custom
26
- shimmer colors. Component names can be entered with spaces or hyphens.
110
+ ## CLI options
27
111
 
28
- ## Options
112
+ ```sh
113
+ npx @istmx/ui add animated-text --no-install
114
+ npx @istmx/ui add animated-text --overwrite
115
+ npx @istmx/ui add image-accordion
116
+ npx @istmx/ui add dock-navigation
117
+ ```
118
+
119
+ - `--no-install` copies the source and prints the dependency command instead
120
+ of installing packages.
121
+ - `--overwrite` replaces component and helper files that already exist.
122
+
123
+ Component names accept either hyphens or spaces: `animated-text` or `animated
124
+ text`.
125
+
126
+ ## Scroll Story Cards
127
+
128
+ The CLI copies an editable component to
129
+ `components/ui/scroll-story-cards.tsx`. All cards wait in a separated preview
130
+ dock at the bottom; it clears as soon as the story starts. Scrolling raises
131
+ each narrower, shorter story panel through a shallow curve toward the hero
132
+ center. Its portrait, larger copy, scene color, and Tabler CTA move together.
133
+ The sequence reverses when scrolling backward, then releases directly into
134
+ the following page content after the 400vh story timeline. The Library preview
135
+ can be opened fullscreen to give the scroll scene room on smaller screens.
136
+
137
+ ```tsx
138
+ import ScrollStoryCards, {
139
+ type ScrollStoryCard,
140
+ } from '@/components/ui/scroll-story-cards'
141
+
142
+ const cards: ScrollStoryCard[] = [
143
+ {
144
+ id: 'coast',
145
+ eyebrow: 'South coast',
146
+ title: 'The coast',
147
+ description:
148
+ 'Soft light settles across the frame while an open horizon leaves room for the story to unfold. The colors shift gently as this portrait approaches the center.',
149
+ image: '/images/coast.jpg',
150
+ imageAlt: 'A quiet coastline in late afternoon light',
151
+ color: '#e8e0f4',
152
+ overlayColor: '#cbbce5',
153
+ overlayOpacity: 0.34,
154
+ buttonLabel: 'Explore',
155
+ buttonHref: '/coast',
156
+ },
157
+ {
158
+ id: 'forest',
159
+ title: 'The forest',
160
+ description: 'A new palette carries the story forward.',
161
+ image: '/images/forest.jpg',
162
+ imageAlt: 'Sunlight moving through a green forest',
163
+ color: '#e2eedf',
164
+ overlayColor: '#b9d5ad',
165
+ },
166
+ ]
167
+
168
+ export function Story() {
169
+ return (
170
+ <ScrollStoryCards
171
+ cards={cards}
172
+ eyebrow="Selected stories"
173
+ heading="A collection worth exploring."
174
+ description="Move through the frames by scrolling."
175
+ curveAmount={64}
176
+ cardWidth={156}
177
+ cardHeight={156}
178
+ overlayOpacity={0.38}
179
+ scrollDistance={400}
180
+ />
181
+ )
182
+ }
183
+ ```
184
+
185
+ `ScrollStoryCard` supports `id`, `title`, `description`, `image`, required
186
+ `imageAlt`, and a hex `color` for the scene background. Optional fields are
187
+ `overlayColor` (defaults to `color`), `overlayOpacity`, `buttonLabel`,
188
+ `buttonHref`, and `buttonColor` (defaults to the overlay color). The component
189
+ also accepts `className`, `curveAmount`, `cardWidth`, `cardHeight`,
190
+ `overlayOpacity`, `scrollDistance`, `showCardLabels`, and an optional
191
+ `scrollContainerRef` when the story lives inside a separately scrolling panel.
192
+ Use at least two
193
+ cards to see the continuous color and image transitions. The pinned story
194
+ timeline defaults to 400vh and then releases naturally into the page. The
195
+ moving panels are image-led, narrower, and use light pastel purple,
196
+ green, yellow, blue, and pink scene colors. The CTA uses a Tabler arrow icon and
197
+ subtle hover/press feedback. Reduced-motion preferences remove the lateral arc
198
+ and extra scale and rotation while retaining the vertical scroll sequence.
199
+ `onActiveChange` optionally reports which card is nearest the center; it does
200
+ not control the scroll animation.
201
+
202
+ ## Pixel Cat
203
+
204
+ The CLI copies the interactive cat to `components/ui/pixel-cat.tsx`:
205
+
206
+ ```tsx
207
+ import { PixelCat } from '@/components/ui/pixel-cat'
208
+
209
+ export function CatCard() {
210
+ return (
211
+ <div className="relative h-64 overflow-hidden rounded-xl border p-5">
212
+ <PixelCat breed="orange" position="center" />
213
+ </div>
214
+ )
215
+ }
216
+ ```
217
+
218
+ `PixelCat` supports `size`, `breed`, `palette`, `wandering`, `speed`,
219
+ `boundary`, `position`, `initialPose`, `pose`, `interactive`,
220
+ `cursorInteraction`, `messages`, `showBubble`, `onPet`, `onPoseChange`,
221
+ `padding`, `className`, and `style`. The exported types
222
+ The exports also include `PixelCatProps`, `PixelCatBreed`, `PixelCatPose`,
223
+ `PixelCatPosition`, `CAT_PALETTES`, `CAT_SIZE`, and `CAT_FEET_Y`. It wanders
224
+ within its parent by default; use a relatively positioned parent with a defined
225
+ size. Fixed poses disable automatic pose cycling, and reduced-motion
226
+ preferences pause movement.
227
+
228
+ ## Image Accordion
229
+
230
+ The CLI copies an editable component to `components/ui/image-accordion.tsx`.
231
+ Pass any number of image objects; five are visible in the stack by default.
232
+ Selecting an image animates it into the preview canvas, moves it to the end of
233
+ the collection, and rotates the next image into the visible stack. Set
234
+ `visibleCount` to change how many cards are shown.
235
+
236
+ ```tsx
237
+ import ImageAccordion from '@/components/ui/image-accordion'
238
+
239
+ export function Gallery() {
240
+ return (
241
+ <ImageAccordion
242
+ images={[
243
+ { src: '/images/coast.jpg', alt: 'Coastal cliffs', title: 'The coast' },
244
+ { src: '/images/forest.jpg', alt: 'A forest', title: 'The forest' },
245
+ { src: '/images/city.jpg', alt: 'A city at dusk', title: 'The city' },
246
+ { src: '/images/lake.jpg', alt: 'A mountain lake', title: 'The lake' },
247
+ {
248
+ src: '/images/desert.jpg',
249
+ alt: 'A desert path',
250
+ title: 'The desert',
251
+ },
252
+ { src: '/images/peaks.jpg', alt: 'Snowy peaks', title: 'The peaks' },
253
+ ]}
254
+ visibleCount={5}
255
+ className="mx-auto max-w-5xl"
256
+ cardClassName="rounded-lg"
257
+ imageClassName="object-cover"
258
+ glow={{ color: '#d4d4d8', opacity: 0.2, blur: 16 }}
259
+ transition={{ stiffness: 190, damping: 24, mass: 0.8 }}
260
+ />
261
+ )
262
+ }
263
+ ```
264
+
265
+ `ImageAccordionItem` supports `id`, `src`, `alt`, `title`, optional
266
+ `description`, and per-card `className` and `imageClassName`. The component
267
+ also accepts `stackClassName` and `previewClassName`; `glow={false}` disables
268
+ the radial hover glow. Its spring, glow color/position/size/opacity/blur, and
269
+ visible stack count are configurable. React, Motion, Tailwind CSS, `clsx`, and
270
+ `tailwind-merge` are used; React and Tailwind CSS should already be configured
271
+ in the consuming project.
272
+
273
+ ## Dock Navigation
274
+
275
+ Add the reusable, editable dock with:
276
+
277
+ ```sh
278
+ npx @istmx/ui add dock-navigation
279
+ ```
280
+
281
+ It writes `components/ui/dock-navigation.tsx` and installs any missing Motion,
282
+ `clsx`, `tailwind-merge`, and `@tabler/icons-react` packages. The component
283
+ accepts an array of labeled links and React icons. Nearby icons magnify and lift
284
+ with an elastic spring; labels follow the movement, and an optional radial glow
285
+ can be tuned or disabled.
286
+
287
+ ```tsx
288
+ import DockNavigation from '@/components/ui/dock-navigation'
289
+ import {
290
+ IconHome,
291
+ IconUser,
292
+ IconCode,
293
+ IconComponents,
294
+ IconMail,
295
+ } from '@tabler/icons-react'
296
+
297
+ const items = [
298
+ { label: 'Home', href: '/', icon: <IconHome size={19} /> },
299
+ { label: 'About', href: '/about', icon: <IconUser size={19} /> },
300
+ {
301
+ label: 'Projects',
302
+ href: '/projects',
303
+ icon: <IconCode size={19} />,
304
+ },
305
+ {
306
+ label: 'Components',
307
+ href: '/components',
308
+ icon: <IconComponents size={19} />,
309
+ active: true,
310
+ },
311
+ { label: 'Contact', href: '/contact', icon: <IconMail size={19} /> },
312
+ ]
313
+
314
+ export function SiteDock() {
315
+ return (
316
+ <DockNavigation
317
+ items={items}
318
+ label="Main navigation"
319
+ glow={{ color: 'var(--foreground)', opacity: 0.2, blur: 12 }}
320
+ />
321
+ )
322
+ }
323
+ ```
29
324
 
30
- - `--no-install` writes the source files and prints the dependency command.
31
- - `--overwrite` replaces existing component and helper files.
325
+ Each item takes `label`, `href`, and `icon` (`ReactNode`), with optional
326
+ `active` and `external` flags. Pass custom classes through `className`,
327
+ `itemClassName`, and `iconClassName`; set `glow={false}` to disable the glow.
328
+ The component honors reduced-motion preferences.
32
329
 
33
- The package is dependency free and requires Node.js 18 or later. Its executable
34
- name is `istmx` after the `@istmx/ui` package is installed.
330
+ The CLI requires Node.js 18 or later. The npm package is `@istmx/ui`; the
331
+ installed executable is named `istmx`.
package/bin/istmx.mjs CHANGED
@@ -6,7 +6,20 @@ import { access, mkdir, readFile, writeFile } from 'node:fs/promises'
6
6
  import path from 'node:path'
7
7
  import { fileURLToPath } from 'node:url'
8
8
 
9
- const VERSION = '0.1.2'
9
+ const VERSION = '0.1.6'
10
+ const COMPONENTS = {
11
+ 'animated-text': { fileName: 'animated-text.tsx' },
12
+ 'image-accordion': { fileName: 'image-accordion.tsx' },
13
+ 'dock-navigation': {
14
+ fileName: 'dock-navigation.tsx',
15
+ dependencies: ['@tabler/icons-react'],
16
+ },
17
+ 'scroll-story-cards': {
18
+ fileName: 'scroll-story-cards.tsx',
19
+ dependencies: ['@tabler/icons-react'],
20
+ },
21
+ 'pixel-cat': { fileName: 'pixel-cat.tsx' },
22
+ }
10
23
  const DEPENDENCIES = ['motion', 'clsx', 'tailwind-merge']
11
24
  const COMMANDS = {
12
25
  npm: ['install'],
@@ -56,7 +69,9 @@ Options:
56
69
  --overwrite Replace component files that already exist
57
70
 
58
71
  Components:
59
- animated-text`)
72
+ ${Object.keys(COMPONENTS)
73
+ .map((name) => ` ${name}`)
74
+ .join('\n')}`)
60
75
  }
61
76
 
62
77
  function detectPackageManager(projectPackage) {
@@ -160,11 +175,15 @@ function installDependencies(manager, dependencies) {
160
175
  }
161
176
 
162
177
  async function addComponent(component, options) {
163
- if (component !== 'animated-text') {
178
+ const definition = COMPONENTS[component]
179
+ if (!definition) {
164
180
  throw new Error(
165
- `Unknown component "${component}". Available component: animated-text. Use \`istmx add animated-text\`.`,
181
+ `Unknown component "${component}". Available components: ${Object.keys(COMPONENTS).join(', ')}. Run istmx --help to see available components.`,
166
182
  )
167
183
  }
184
+ const componentDependencies = [
185
+ ...new Set([...DEPENDENCIES, ...(definition.dependencies ?? [])]),
186
+ ]
168
187
 
169
188
  const projectPackage = await readProjectPackage()
170
189
  const manager = detectPackageManager(projectPackage)
@@ -177,15 +196,15 @@ async function addComponent(component, options) {
177
196
  CURRENT_DIRECTORY,
178
197
  'components',
179
198
  'ui',
180
- 'animated-text.tsx',
199
+ definition.fileName,
181
200
  )
182
201
  const utilityPath = path.join(CURRENT_DIRECTORY, 'lib', 'utils.ts')
183
202
 
184
203
  await writeRegistryFile('utils.ts', utilityPath, options.overwrite)
185
- await writeRegistryFile('animated-text.tsx', componentPath, options.overwrite)
204
+ await writeRegistryFile(definition.fileName, componentPath, options.overwrite)
186
205
 
187
206
  if (options.noInstall) {
188
- const missing = DEPENDENCIES.filter(
207
+ const missing = componentDependencies.filter(
189
208
  (dependency) => !installedDependencies(projectPackage)[dependency],
190
209
  )
191
210
  if (missing.length > 0) {
@@ -197,7 +216,7 @@ async function addComponent(component, options) {
197
216
  }
198
217
 
199
218
  const installed = installedDependencies(projectPackage)
200
- const missingDependencies = DEPENDENCIES.filter(
219
+ const missingDependencies = componentDependencies.filter(
201
220
  (dependency) => !installed[dependency],
202
221
  )
203
222
 
@@ -209,9 +228,11 @@ async function addComponent(component, options) {
209
228
 
210
229
  console.log(`\n${green('Done!')} ${component} is ready to edit.`)
211
230
  console.log(
212
- ` ${muted('Import from')} ${cyan('@/components/ui/animated-text')}`,
231
+ ` ${muted('Import from')} ${cyan(`@/components/ui/${component}`)}`,
232
+ )
233
+ console.log(
234
+ ` ${muted('Dependencies')} ${cyan(componentDependencies.join(', '))}\n`,
213
235
  )
214
- console.log(` ${muted('Dependencies')} ${cyan(DEPENDENCIES.join(', '))}\n`)
215
236
  }
216
237
 
217
238
  const [command, ...argumentsList] = process.argv.slice(2)
@@ -230,7 +251,7 @@ if (command === '--help' || command === '-h' || !command) {
230
251
  console.log(VERSION)
231
252
  } else if (command === 'add') {
232
253
  if (!component || component.startsWith('--')) {
233
- console.error('Choose a component: `istmx add animated-text`.')
254
+ console.error('Choose a component name. Run `istmx --help` to see options.')
234
255
  process.exitCode = 1
235
256
  } else {
236
257
  addComponent(component, options).catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@istmx/ui",
3
- "version": "0.1.2",
3
+ "version": "0.1.6",
4
4
  "description": "Add editable ISTMX UI components to your project.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,198 @@
1
+ 'use client'
2
+
3
+ import {
4
+ motion,
5
+ useMotionValue,
6
+ useReducedMotion,
7
+ useSpring,
8
+ useTransform,
9
+ } from 'motion/react'
10
+ import type { MotionValue } from 'motion/react'
11
+ import type { CSSProperties, PointerEvent, ReactNode } from 'react'
12
+ import { cn } from '@/lib/utils'
13
+
14
+ export type DockNavigationItem = {
15
+ label: string
16
+ href: string
17
+ icon: ReactNode
18
+ active?: boolean
19
+ external?: boolean
20
+ }
21
+
22
+ export type DockNavigationProps = {
23
+ items: DockNavigationItem[]
24
+ label?: string
25
+ className?: string
26
+ itemClassName?: string
27
+ iconClassName?: string
28
+ glow?: false | DockNavigationGlow
29
+ }
30
+
31
+ export type DockNavigationGlow = {
32
+ color?: string
33
+ opacity?: number
34
+ blur?: number
35
+ }
36
+
37
+ function DockItem({
38
+ item,
39
+ index,
40
+ pointerX,
41
+ iconClassName,
42
+ itemClassName,
43
+ glowEnabled,
44
+ }: {
45
+ item: DockNavigationItem
46
+ index: number
47
+ pointerX: MotionValue<number>
48
+ iconClassName?: string
49
+ itemClassName?: string
50
+ glowEnabled: boolean
51
+ }) {
52
+ const reduceMotion = useReducedMotion()
53
+ const center = 30 + index * 52
54
+ const scale = useTransform(
55
+ pointerX,
56
+ [center - 84, center - 42, center, center + 42, center + 84],
57
+ [1, 1.08, 1.36, 1.08, 1],
58
+ )
59
+ const smoothScale = useSpring(scale, {
60
+ stiffness: 360,
61
+ damping: 15,
62
+ mass: 0.38,
63
+ })
64
+ const lift = useTransform(
65
+ pointerX,
66
+ [center - 84, center - 42, center, center + 42, center + 84],
67
+ [0, -4, -13, -4, 0],
68
+ )
69
+ const smoothLift = useSpring(lift, {
70
+ stiffness: 340,
71
+ damping: 15,
72
+ mass: 0.38,
73
+ })
74
+ const tooltipY = useTransform(
75
+ () => smoothLift.get() - (smoothScale.get() - 1) * 24,
76
+ )
77
+ const isExternal = item.external ?? /^https?:\/\//.test(item.href)
78
+ const content = (
79
+ <>
80
+ {glowEnabled ? (
81
+ <span
82
+ aria-hidden="true"
83
+ className={cn(
84
+ 'pointer-events-none absolute z-0 size-14 rounded-full bg-[radial-gradient(ellipse_at_center,var(--dock-glow-color)_0%,transparent_72%)] opacity-0 blur-[var(--dock-glow-blur)] transition-opacity duration-300 group-hover/dock:opacity-[var(--dock-glow-opacity)] group-focus-visible/dock:opacity-[var(--dock-glow-opacity)]',
85
+ item.active && 'opacity-[var(--dock-glow-opacity)]',
86
+ )}
87
+ />
88
+ ) : null}
89
+ <motion.span
90
+ style={{
91
+ scale: reduceMotion ? 1 : smoothScale,
92
+ y: reduceMotion ? 0 : smoothLift,
93
+ }}
94
+ whileTap={reduceMotion ? undefined : { rotate: -3 }}
95
+ className={cn(
96
+ 'border-border/70 bg-background text-muted group-hover/dock:border-foreground/55 group-hover/dock:bg-surface/70 group-hover/dock:text-foreground group-focus-visible/dock:border-foreground/55 group-focus-visible/dock:text-foreground relative isolate flex size-11 origin-bottom items-center justify-center overflow-hidden rounded-lg border transition-[border-color,background-color,color]',
97
+ item.active && 'border-foreground/60 bg-surface/70 text-foreground',
98
+ iconClassName,
99
+ )}
100
+ >
101
+ <span
102
+ aria-hidden="true"
103
+ className="pointer-events-none absolute inset-0 z-0 rounded-[inherit] bg-[linear-gradient(145deg,rgba(255,255,255,0.13)_0%,transparent_48%,rgba(0,0,0,0.06)_100%)] opacity-0 transition-opacity duration-200 group-hover/dock:opacity-100 group-focus-visible/dock:opacity-100"
104
+ />
105
+ <span className="relative z-10">{item.icon}</span>
106
+ {item.active ? (
107
+ <motion.span
108
+ layoutId="dock-navigation-active-dot"
109
+ className="bg-foreground absolute -bottom-1.5 size-1 rounded-full"
110
+ transition={
111
+ reduceMotion
112
+ ? { duration: 0 }
113
+ : { type: 'spring', stiffness: 460, damping: 34 }
114
+ }
115
+ />
116
+ ) : null}
117
+ </motion.span>
118
+ <motion.span
119
+ style={{ y: reduceMotion ? 0 : tooltipY }}
120
+ className="border-border/70 bg-background text-foreground pointer-events-none absolute -top-10 left-1/2 -translate-x-1/2 translate-y-1 rounded-md border px-2 py-1 font-mono text-[9px] whitespace-nowrap opacity-0 transition-opacity duration-150 group-hover/dock:translate-y-0 group-hover/dock:opacity-100 group-focus-visible/dock:translate-y-0 group-focus-visible/dock:opacity-100"
121
+ >
122
+ {item.label}
123
+ </motion.span>
124
+ </>
125
+ )
126
+
127
+ const linkClassName = cn(
128
+ 'group/dock relative flex size-11 cursor-pointer items-center justify-center rounded-lg outline-none',
129
+ itemClassName,
130
+ )
131
+
132
+ return (
133
+ <li className="relative flex size-11 items-center justify-center">
134
+ <a
135
+ href={item.href}
136
+ target={isExternal ? '_blank' : undefined}
137
+ rel={isExternal ? 'noreferrer' : undefined}
138
+ aria-label={item.label}
139
+ aria-current={item.active ? 'page' : undefined}
140
+ className={linkClassName}
141
+ >
142
+ {content}
143
+ </a>
144
+ </li>
145
+ )
146
+ }
147
+
148
+ export default function DockNavigation({
149
+ items,
150
+ label = 'Primary navigation',
151
+ className,
152
+ itemClassName,
153
+ iconClassName,
154
+ glow = {},
155
+ }: DockNavigationProps) {
156
+ const pointerX = useMotionValue(-1000)
157
+ const reduceMotion = useReducedMotion()
158
+ const glowOptions = typeof glow === 'object' ? glow : {}
159
+ const glowStyle = {
160
+ '--dock-glow-color': glowOptions.color ?? 'var(--foreground)',
161
+ '--dock-glow-opacity': Math.min(1, Math.max(0, glowOptions.opacity ?? 0.2)),
162
+ '--dock-glow-blur': `${Math.max(0, glowOptions.blur ?? 10)}px`,
163
+ } as CSSProperties
164
+
165
+ function updatePointer(event: PointerEvent<HTMLDivElement>) {
166
+ if (event.pointerType === 'touch' || reduceMotion) return
167
+ const bounds = event.currentTarget.getBoundingClientRect()
168
+ pointerX.set(event.clientX - bounds.left)
169
+ }
170
+
171
+ return (
172
+ <nav aria-label={label}>
173
+ <div
174
+ onPointerMove={updatePointer}
175
+ onPointerLeave={() => pointerX.set(-1000)}
176
+ style={glowStyle}
177
+ className={cn(
178
+ 'border-border/70 bg-background/95 inline-flex rounded-xl border p-2',
179
+ className,
180
+ )}
181
+ >
182
+ <ul className="flex items-end gap-2">
183
+ {items.map((item, index) => (
184
+ <DockItem
185
+ key={`${item.href}-${item.label}`}
186
+ item={item}
187
+ index={index}
188
+ pointerX={pointerX}
189
+ iconClassName={iconClassName}
190
+ itemClassName={itemClassName}
191
+ glowEnabled={glow !== false}
192
+ />
193
+ ))}
194
+ </ul>
195
+ </div>
196
+ </nav>
197
+ )
198
+ }