11'use client' ;
22
33import * as React from 'react' ;
4- import { motion , type Transition , type HTMLMotionProps } from 'motion/react' ;
4+ import { motion , type Transition , type HTMLMotionProps } from 'motion/react' ;
55
6- import { cn } from '@/lib/utils' ;
6+ import { cn } from '@/lib/utils' ;
77import {
88 MotionHighlight ,
99 MotionHighlightItem ,
10- } from '@repo /motion-highlight' ;
10+ } from '@/components/ui/shadcn-io /motion-highlight' ;
1111
1212// Tabs Component
1313type TabsContextType < T extends string > = {
@@ -50,13 +50,13 @@ type TabsProps<T extends string = string> =
5050 | ControlledTabsProps < T > ;
5151
5252function Tabs < T extends string = string > ( {
53- defaultValue,
54- value,
55- onValueChange,
56- children,
57- className,
58- ...props
59- } : TabsProps < T > ) {
53+ defaultValue,
54+ value,
55+ onValueChange,
56+ children,
57+ className,
58+ ...props
59+ } : TabsProps < T > ) {
6060 const [ activeValue , setActiveValue ] = React . useState < T | undefined > (
6161 defaultValue ?? undefined ,
6262 ) ;
@@ -120,17 +120,17 @@ type TabsListProps = React.ComponentProps<'div'> & {
120120} ;
121121
122122function TabsList ( {
123- children,
124- className,
125- activeClassName,
126- transition = {
127- type : 'spring' ,
128- stiffness : 200 ,
129- damping : 25 ,
130- } ,
131- ...props
132- } : TabsListProps ) {
133- const { activeValue } = useTabs ( ) ;
123+ children,
124+ className,
125+ activeClassName,
126+ transition = {
127+ type : 'spring' ,
128+ stiffness : 200 ,
129+ damping : 25 ,
130+ } ,
131+ ...props
132+ } : TabsListProps ) {
133+ const { activeValue} = useTabs ( ) ;
134134
135135 return (
136136 < MotionHighlight
@@ -160,13 +160,13 @@ type TabsTriggerProps = HTMLMotionProps<'button'> & {
160160} ;
161161
162162function TabsTrigger ( {
163- ref,
164- value,
165- children,
166- className,
167- ...props
168- } : TabsTriggerProps ) {
169- const { activeValue, handleValueChange, registerTrigger } = useTabs ( ) ;
163+ ref,
164+ value,
165+ children,
166+ className,
167+ ...props
168+ } : TabsTriggerProps ) {
169+ const { activeValue, handleValueChange, registerTrigger} = useTabs ( ) ;
170170
171171 const localRef = React . useRef < HTMLButtonElement | null > ( null ) ;
172172 React . useImperativeHandle ( ref , ( ) => localRef . current as HTMLButtonElement ) ;
@@ -182,7 +182,7 @@ function TabsTrigger({
182182 ref = { localRef }
183183 data-slot = "tabs-trigger"
184184 role = "tab"
185- whileTap = { { scale : 0.95 } }
185+ whileTap = { { scale : 0.95 } }
186186 onClick = { ( ) => handleValueChange ( value ) }
187187 data-state = { activeValue === value ? 'active' : 'inactive' }
188188 className = { cn (
@@ -203,18 +203,18 @@ type TabsContentsProps = React.ComponentProps<'div'> & {
203203} ;
204204
205205function TabsContents ( {
206- children,
207- className,
208- transition = {
209- type : 'spring' ,
210- stiffness : 300 ,
211- damping : 30 ,
212- bounce : 0 ,
213- restDelta : 0.01 ,
214- } ,
215- ...props
216- } : TabsContentsProps ) {
217- const { activeValue } = useTabs ( ) ;
206+ children,
207+ className,
208+ transition = {
209+ type : 'spring' ,
210+ stiffness : 300 ,
211+ damping : 30 ,
212+ bounce : 0 ,
213+ restDelta : 0.01 ,
214+ } ,
215+ ...props
216+ } : TabsContentsProps ) {
217+ const { activeValue} = useTabs ( ) ;
218218 const childrenArray = React . Children . toArray ( children ) ;
219219 const activeIndex = childrenArray . findIndex (
220220 ( child ) : child is React . ReactElement < { value : string } > =>
@@ -233,7 +233,7 @@ function TabsContents({
233233 >
234234 < motion . div
235235 className = "flex -mx-2"
236- animate = { { x : activeIndex * - 100 + '%' } }
236+ animate = { { x : activeIndex * - 100 + '%' } }
237237 transition = { transition }
238238 >
239239 { childrenArray . map ( ( child , index ) => (
@@ -252,22 +252,22 @@ type TabsContentProps = HTMLMotionProps<'div'> & {
252252} ;
253253
254254function TabsContent ( {
255- children,
256- value,
257- className,
258- ...props
259- } : TabsContentProps ) {
260- const { activeValue } = useTabs ( ) ;
255+ children,
256+ value,
257+ className,
258+ ...props
259+ } : TabsContentProps ) {
260+ const { activeValue} = useTabs ( ) ;
261261 const isActive = activeValue === value ;
262262 return (
263263 < motion . div
264264 role = "tabpanel"
265265 data-slot = "tabs-content"
266266 className = { cn ( 'overflow-hidden' , className ) }
267- initial = { { filter : 'blur(0px)' } }
268- animate = { { filter : isActive ? 'blur(0px)' : 'blur(4px)' } }
269- exit = { { filter : 'blur(0px)' } }
270- transition = { { type : 'spring' , stiffness : 200 , damping : 25 } }
267+ initial = { { filter : 'blur(0px)' } }
268+ animate = { { filter : isActive ? 'blur(0px)' : 'blur(4px)' } }
269+ exit = { { filter : 'blur(0px)' } }
270+ transition = { { type : 'spring' , stiffness : 200 , damping : 25 } }
271271 { ...props }
272272 >
273273 { children }
0 commit comments