UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix(ShimmerButton): correct class name from 'insert-0' to 'inset-0' in ShimmerButton component (#771)
Nassim Afretef5c039dd3d09
diff --git a/public/llms-full.txt b/public/llms-full.txtindex 3277e7b4..1f6309ec 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -8607,6 +8607,7 @@ import { useEffect, useRef } from "react";import { useInView } from "motion/react";import { annotate } from "rough-notation";import type React from "react";+import { type RoughAnnotation } from "rough-notation/lib/model";type AnnotationAction =| "highlight"@@ -8641,6 +8642,8 @@ export function Highlighter({isView = false,}: HighlighterProps) {const elementRef = useRef<HTMLSpanElement>(null);+ const annotationRef = useRef<RoughAnnotation | null>(null);+const isInView = useInView(elementRef, {once: true,margin: "-10%",@@ -8655,7 +8658,7 @@ export function Highlighter({const element = elementRef.current;if (!element) return;- const annotation = annotate(element, {+ const annotationConfig = {type: action,color,strokeWidth,@@ -8663,13 +8666,25 @@ export function Highlighter({iterations,padding,multiline,+ };++ const annotation = annotate(element, annotationConfig);++ annotationRef.current = annotation;+ annotationRef.current.show();++ const resizeObserver = new ResizeObserver(() => {+ annotation.hide();+ annotation.show();});- annotation.show();+ resizeObserver.observe(element);+ resizeObserver.observe(document.body);return () => {if (element) {annotate(element, { type: action }).remove();+ resizeObserver.disconnect();}};}, [@@ -8722,6 +8737,7 @@ import { useEffect, useRef } from "react";import { useInView } from "motion/react";import { annotate } from "rough-notation";import type React from "react";+import { type RoughAnnotation } from "rough-notation/lib/model";type AnnotationAction =| "highlight"@@ -8756,6 +8772,8 @@ export function Highlighter({isView = false,}: HighlighterProps) {const elementRef = useRef<HTMLSpanElement>(null);+ const annotationRef = useRef<RoughAnnotation | null>(null);+const isInView = useInView(elementRef, {once: true,margin: "-10%",@@ -8770,7 +8788,7 @@ export function Highlighter({const element = elementRef.current;if (!element) return;- const annotation = annotate(element, {+ const annotationConfig = {type: action,color,strokeWidth,@@ -8778,13 +8796,25 @@ export function Highlighter({iterations,padding,multiline,+ };++ const annotation = annotate(element, annotationConfig);++ annotationRef.current = annotation;+ annotationRef.current.show();++ const resizeObserver = new ResizeObserver(() => {+ annotation.hide();+ annotation.show();});- annotation.show();+ resizeObserver.observe(element);+ resizeObserver.observe(document.body);return () => {if (element) {annotate(element, { type: action }).remove();+ resizeObserver.disconnect();}};}, [@@ -10276,7 +10306,7 @@ Description: A spotlight effect that follows your mouse cursor and highlights bo"use client";import { motion, useMotionTemplate, useMotionValue } from "motion/react";-import React, { useCallback, useEffect, useRef } from "react";+import React, { useCallback, useEffect } from "react";import { cn } from "@/lib/utils";@@ -10299,61 +10329,56 @@ export function MagicCard({gradientFrom = "#9E7AFF",gradientTo = "#FE8BBB",}: MagicCardProps) {- const cardRef = useRef<HTMLDivElement>(null);const mouseX = useMotionValue(-gradientSize);const mouseY = useMotionValue(-gradientSize);+ const reset = useCallback(() => {+ mouseX.set(-gradientSize);+ mouseY.set(-gradientSize);+ }, [gradientSize, mouseX, mouseY]);- const handleMouseMove = useCallback(- (e: MouseEvent) => {- if (cardRef.current) {- const { left, top } = cardRef.current.getBoundingClientRect();- const clientX = e.clientX;- const clientY = e.clientY;- mouseX.set(clientX - left);- mouseY.set(clientY - top);- }+ const handlePointerMove = useCallback(+ (e: React.PointerEvent<HTMLDivElement>) => {+ const rect = e.currentTarget.getBoundingClientRect();+ mouseX.set(e.clientX - rect.left);+ mouseY.set(e.clientY - rect.top);},[mouseX, mouseY],);- const handleMouseOut = useCallback(- (e: MouseEvent) => {+ useEffect(() => {+ reset();+ }, [reset]);++ useEffect(() => {+ const handleGlobalPointerOut = (e: PointerEvent) => {if (!e.relatedTarget) {- document.removeEventListener("mousemove", handleMouseMove);- mouseX.set(-gradientSize);- mouseY.set(-gradientSize);+ reset();}- },- [handleMouseMove, mouseX, gradientSize, mouseY],- );+ };- const handleMouseEnter = useCallback(() => {- document.addEventListener("mousemove", handleMouseMove);- mouseX.set(-gradientSize);- mouseY.set(-gradientSize);- }, [handleMouseMove, mouseX, gradientSize, mouseY]);+ const handleVisibility = () => {+ if (document.visibilityState !== "visible") {+ reset();+ }+ };- useEffect(() => {- document.addEventListener("mousemove", handleMouseMove);- document.addEventListener("mouseout", handleMouseOut);- document.addEventListener("mouseenter", handleMouseEnter);+ window.addEventListener("pointerout", handleGlobalPointerOut);+ window.addEventListener("blur", reset);+ document.addEventListener("visibilitychange", handleVisibility);return () => {- document.removeEventListener("mousemove", handleMouseMove);- document.removeEventListener("mouseout", handleMouseOut);- document.removeEventListener("mouseenter", handleMouseEnter);+ window.removeEventListener("pointerout", handleGlobalPointerOut);+ window.removeEventListener("blur", reset);+ document.removeEventListener("visibilitychange", handleVisibility);};- }, [handleMouseEnter, handleMouseMove, handleMouseOut]);-- useEffect(() => {- mouseX.set(-gradientSize);- mouseY.set(-gradientSize);- }, [gradientSize, mouseX, mouseY]);+ }, [reset]);return (<div- ref={cardRef}className={cn("group relative rounded-[inherit]", className)}+ onPointerMove={handlePointerMove}+ onPointerLeave={reset}+ onPointerEnter={reset}><motion.divclassName="pointer-events-none absolute inset-0 rounded-[inherit] bg-border duration-300 group-hover:opacity-100"@@ -11416,6 +11441,7 @@ export const NeonGradientCard: React.FC<NeonGradientCardProps> = ({"after:bg-[linear-gradient(0deg,var(--neon-first-color),var(--neon-second-color))] after:bg-[length:100%_200%] after:opacity-80","after:animate-background-position-spin","dark:bg-neutral-900",+ "break-words",)}>{children}@@ -11434,7 +11460,7 @@ import { NeonGradientCard } from "@/registry/magicui/neon-gradient-card";export default function NeonGradientCardDemo() {return (<NeonGradientCard className="max-w-sm items-center justify-center text-center">- <span className="pointer-events-none z-10 h-full whitespace-pre-wrap bg-gradient-to-br from-[#ff2975] from-35% to-[#00FFF1] bg-clip-text text-center text-6xl font-bold leading-none tracking-tighter text-transparent dark:drop-shadow-[0_5px_5px_rgba(0,0,0,0.8)]">+ <span className="pointer-events-none z-10 h-full whitespace-pre-wrap bg-gradient-to-br from-[#ff2975] from-35% to-[#00FFF1] bg-clip-text text-center text-3xl md:text-5xl xl:text-6xl font-bold leading-none tracking-tighter text-balance text-transparent dark:drop-shadow-[0_5px_5px_rgba(0,0,0,0.8)]">Neon Gradient Card</span></NeonGradientCard>@@ -14238,7 +14264,7 @@ export const ShimmerButton = React.forwardRef<{/* Highlight */}<divclassName={cn(- "insert-0 absolute size-full",+ "inset-0 absolute size-full","rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]",diff --git a/public/r/highlighter-demo.json b/public/r/highlighter-demo.jsonindex e13eb98c..5bbe895a 100644--- a/public/r/highlighter-demo.json+++ b/public/r/highlighter-demo.json@@ -19,7 +19,7 @@},{"path": "registry/magicui/highlighter.tsx",- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n",+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\nimport { type RoughAnnotation } from \"rough-notation/lib/model\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const annotationRef = useRef<RoughAnnotation | null>(null);\n\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotationConfig = {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n };\n\n const annotation = annotate(element, annotationConfig);\n\n annotationRef.current = annotation;\n annotationRef.current.show();\n\n const resizeObserver = new ResizeObserver(() => {\n annotation.hide();\n annotation.show();\n });\n\n resizeObserver.observe(element);\n resizeObserver.observe(document.body);\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n resizeObserver.disconnect();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n","type": "registry:ui","target": "components/magicui/highlighter.tsx"}diff --git a/public/r/highlighter.json b/public/r/highlighter.jsonindex e7d17be5..93e5f6a8 100644--- a/public/r/highlighter.json+++ b/public/r/highlighter.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/highlighter.tsx",- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n",+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\nimport { type RoughAnnotation } from \"rough-notation/lib/model\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const annotationRef = useRef<RoughAnnotation | null>(null);\n\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotationConfig = {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n };\n\n const annotation = annotate(element, annotationConfig);\n\n annotationRef.current = annotation;\n annotationRef.current.show();\n\n const resizeObserver = new ResizeObserver(() => {\n annotation.hide();\n annotation.show();\n });\n\n resizeObserver.observe(element);\n resizeObserver.observe(document.body);\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n resizeObserver.disconnect();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n","type": "registry:ui","target": "components/magicui/highlighter.tsx"}diff --git a/public/r/magic-card.json b/public/r/magic-card.jsonindex 16a503ad..92b72652 100644--- a/public/r/magic-card.json+++ b/public/r/magic-card.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/magic-card.tsx",- "content": "\"use client\";\n\nimport { motion, useMotionTemplate, useMotionValue } from \"motion/react\";\nimport React, { useCallback, useEffect, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface MagicCardProps {\n children?: React.ReactNode;\n className?: string;\n gradientSize?: number;\n gradientColor?: string;\n gradientOpacity?: number;\n gradientFrom?: string;\n gradientTo?: string;\n}\n\nexport function MagicCard({\n children,\n className,\n gradientSize = 200,\n gradientColor = \"#262626\",\n gradientOpacity = 0.8,\n gradientFrom = \"#9E7AFF\",\n gradientTo = \"#FE8BBB\",\n}: MagicCardProps) {\n const cardRef = useRef<HTMLDivElement>(null);\n const mouseX = useMotionValue(-gradientSize);\n const mouseY = useMotionValue(-gradientSize);\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (cardRef.current) {\n const { left, top } = cardRef.current.getBoundingClientRect();\n const clientX = e.clientX;\n const clientY = e.clientY;\n mouseX.set(clientX - left);\n mouseY.set(clientY - top);\n }\n },\n [mouseX, mouseY],\n );\n\n const handleMouseOut = useCallback(\n (e: MouseEvent) => {\n if (!e.relatedTarget) {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }\n },\n [handleMouseMove, mouseX, gradientSize, mouseY],\n );\n\n const handleMouseEnter = useCallback(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [handleMouseMove, mouseX, gradientSize, mouseY]);\n\n useEffect(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n document.addEventListener(\"mouseout\", handleMouseOut);\n document.addEventListener(\"mouseenter\", handleMouseEnter);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n document.removeEventListener(\"mouseout\", handleMouseOut);\n document.removeEventListener(\"mouseenter\", handleMouseEnter);\n };\n }, [handleMouseEnter, handleMouseMove, handleMouseOut]);\n\n useEffect(() => {\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [gradientSize, mouseX, mouseY]);\n\n return (\n <div\n ref={cardRef}\n className={cn(\"group relative rounded-[inherit]\", className)}\n >\n <motion.div\n className=\"pointer-events-none absolute inset-0 rounded-[inherit] bg-border duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px,\n ${gradientFrom}, \n ${gradientTo}, \n var(--border) 100%\n )\n `,\n }}\n />\n <div className=\"absolute inset-px rounded-[inherit] bg-background\" />\n <motion.div\n className=\"pointer-events-none absolute inset-px rounded-[inherit] opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px, ${gradientColor}, transparent 100%)\n `,\n opacity: gradientOpacity,\n }}\n />\n <div className=\"relative\">{children}</div>\n </div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { motion, useMotionTemplate, useMotionValue } from \"motion/react\";\nimport React, { useCallback, useEffect } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface MagicCardProps {\n children?: React.ReactNode;\n className?: string;\n gradientSize?: number;\n gradientColor?: string;\n gradientOpacity?: number;\n gradientFrom?: string;\n gradientTo?: string;\n}\n\nexport function MagicCard({\n children,\n className,\n gradientSize = 200,\n gradientColor = \"#262626\",\n gradientOpacity = 0.8,\n gradientFrom = \"#9E7AFF\",\n gradientTo = \"#FE8BBB\",\n}: MagicCardProps) {\n const mouseX = useMotionValue(-gradientSize);\n const mouseY = useMotionValue(-gradientSize);\n const reset = useCallback(() => {\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [gradientSize, mouseX, mouseY]);\n\n const handlePointerMove = useCallback(\n (e: React.PointerEvent<HTMLDivElement>) => {\n const rect = e.currentTarget.getBoundingClientRect();\n mouseX.set(e.clientX - rect.left);\n mouseY.set(e.clientY - rect.top);\n },\n [mouseX, mouseY],\n );\n\n useEffect(() => {\n reset();\n }, [reset]);\n\n useEffect(() => {\n const handleGlobalPointerOut = (e: PointerEvent) => {\n if (!e.relatedTarget) {\n reset();\n }\n };\n\n const handleVisibility = () => {\n if (document.visibilityState !== \"visible\") {\n reset();\n }\n };\n\n window.addEventListener(\"pointerout\", handleGlobalPointerOut);\n window.addEventListener(\"blur\", reset);\n document.addEventListener(\"visibilitychange\", handleVisibility);\n\n return () => {\n window.removeEventListener(\"pointerout\", handleGlobalPointerOut);\n window.removeEventListener(\"blur\", reset);\n document.removeEventListener(\"visibilitychange\", handleVisibility);\n };\n }, [reset]);\n\n return (\n <div\n className={cn(\"group relative rounded-[inherit]\", className)}\n onPointerMove={handlePointerMove}\n onPointerLeave={reset}\n onPointerEnter={reset}\n >\n <motion.div\n className=\"pointer-events-none absolute inset-0 rounded-[inherit] bg-border duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px,\n ${gradientFrom}, \n ${gradientTo}, \n var(--border) 100%\n )\n `,\n }}\n />\n <div className=\"absolute inset-px rounded-[inherit] bg-background\" />\n <motion.div\n className=\"pointer-events-none absolute inset-px rounded-[inherit] opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px, ${gradientColor}, transparent 100%)\n `,\n opacity: gradientOpacity,\n }}\n />\n <div className=\"relative\">{children}</div>\n </div>\n );\n}\n","type": "registry:ui","target": "components/magicui/magic-card.tsx"}diff --git a/public/r/neon-gradient-card-demo.json b/public/r/neon-gradient-card-demo.jsonindex b8863cfe..1c09f881 100644--- a/public/r/neon-gradient-card-demo.json+++ b/public/r/neon-gradient-card-demo.json@@ -10,7 +10,7 @@"files": [{"path": "registry/example/neon-gradient-card-demo.tsx",- "content": "import { NeonGradientCard } from \"@/registry/magicui/neon-gradient-card\";\n\nexport default function NeonGradientCardDemo() {\n return (\n <NeonGradientCard className=\"max-w-sm items-center justify-center text-center\">\n <span className=\"pointer-events-none z-10 h-full whitespace-pre-wrap bg-gradient-to-br from-[#ff2975] from-35% to-[#00FFF1] bg-clip-text text-center text-6xl font-bold leading-none tracking-tighter text-transparent dark:drop-shadow-[0_5px_5px_rgba(0,0,0,0.8)]\">\n Neon Gradient Card\n </span>\n </NeonGradientCard>\n );\n}\n",+ "content": "import { NeonGradientCard } from \"@/registry/magicui/neon-gradient-card\";\n\nexport default function NeonGradientCardDemo() {\n return (\n <NeonGradientCard className=\"max-w-sm items-center justify-center text-center\">\n <span className=\"pointer-events-none z-10 h-full whitespace-pre-wrap bg-gradient-to-br from-[#ff2975] from-35% to-[#00FFF1] bg-clip-text text-center text-3xl md:text-5xl xl:text-6xl font-bold leading-none tracking-tighter text-balance text-transparent dark:drop-shadow-[0_5px_5px_rgba(0,0,0,0.8)]\">\n Neon Gradient Card\n </span>\n </NeonGradientCard>\n );\n}\n","type": "registry:example","target": "components/neon-gradient-card-demo.tsx"}diff --git a/public/r/neon-gradient-card.json b/public/r/neon-gradient-card.jsonindex 5414cba7..2986a0e8 100644--- a/public/r/neon-gradient-card.json+++ b/public/r/neon-gradient-card.json@@ -7,7 +7,7 @@"files": [{"path": "registry/magicui/neon-gradient-card.tsx",- "content": "\"use client\";\n\nimport {\n CSSProperties,\n ReactElement,\n ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface NeonColorsProps {\n firstColor: string;\n secondColor: string;\n}\n\ninterface NeonGradientCardProps {\n /**\n * @default <div />\n * @type ReactElement\n * @description\n * The component to be rendered as the card\n * */\n as?: ReactElement;\n /**\n * @default \"\"\n * @type string\n * @description\n * The className of the card\n */\n className?: string;\n\n /**\n * @default \"\"\n * @type ReactNode\n * @description\n * The children of the card\n * */\n children?: ReactNode;\n\n /**\n * @default 5\n * @type number\n * @description\n * The size of the border in pixels\n * */\n borderSize?: number;\n\n /**\n * @default 20\n * @type number\n * @description\n * The size of the radius in pixels\n * */\n borderRadius?: number;\n\n /**\n * @default \"{ firstColor: '#ff00aa', secondColor: '#00FFF1' }\"\n * @type string\n * @description\n * The colors of the neon gradient\n * */\n neonColors?: NeonColorsProps;\n\n [key: string]: any;\n}\n\nexport const NeonGradientCard: React.FC<NeonGradientCardProps> = ({\n className,\n children,\n borderSize = 2,\n borderRadius = 20,\n neonColors = {\n firstColor: \"#ff00aa\",\n secondColor: \"#00FFF1\",\n },\n ...props\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 });\n\n useEffect(() => {\n const updateDimensions = () => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current;\n setDimensions({ width: offsetWidth, height: offsetHeight });\n }\n };\n\n updateDimensions();\n window.addEventListener(\"resize\", updateDimensions);\n\n return () => {\n window.removeEventListener(\"resize\", updateDimensions);\n };\n }, []);\n\n useEffect(() => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current;\n setDimensions({ width: offsetWidth, height: offsetHeight });\n }\n }, [children]);\n\n return (\n <div\n ref={containerRef}\n style={\n {\n \"--border-size\": `${borderSize}px`,\n \"--border-radius\": `${borderRadius}px`,\n \"--neon-first-color\": neonColors.firstColor,\n \"--neon-second-color\": neonColors.secondColor,\n \"--card-width\": `${dimensions.width}px`,\n \"--card-height\": `${dimensions.height}px`,\n \"--card-content-radius\": `${borderRadius - borderSize}px`,\n \"--pseudo-element-background-image\": `linear-gradient(0deg, ${neonColors.firstColor}, ${neonColors.secondColor})`,\n \"--pseudo-element-width\": `${dimensions.width + borderSize * 2}px`,\n \"--pseudo-element-height\": `${dimensions.height + borderSize * 2}px`,\n \"--after-blur\": `${dimensions.width / 3}px`,\n } as CSSProperties\n }\n className={cn(\n \"relative z-10 size-full rounded-[var(--border-radius)]\",\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"relative size-full min-h-[inherit] rounded-[var(--card-content-radius)] bg-gray-100 p-6\",\n \"before:absolute before:-left-[var(--border-size)] before:-top-[var(--border-size)] before:-z-10 before:block\",\n \"before:h-[var(--pseudo-element-height)] before:w-[var(--pseudo-element-width)] before:rounded-[var(--border-radius)] before:content-['']\",\n \"before:bg-[linear-gradient(0deg,var(--neon-first-color),var(--neon-second-color))] before:bg-[length:100%_200%]\",\n \"before:animate-background-position-spin\",\n \"after:absolute after:-left-[var(--border-size)] after:-top-[var(--border-size)] after:-z-10 after:block\",\n \"after:h-[var(--pseudo-element-height)] after:w-[var(--pseudo-element-width)] after:rounded-[var(--border-radius)] after:blur-[var(--after-blur)] after:content-['']\",\n \"after:bg-[linear-gradient(0deg,var(--neon-first-color),var(--neon-second-color))] after:bg-[length:100%_200%] after:opacity-80\",\n \"after:animate-background-position-spin\",\n \"dark:bg-neutral-900\",\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n",+ "content": "\"use client\";\n\nimport {\n CSSProperties,\n ReactElement,\n ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface NeonColorsProps {\n firstColor: string;\n secondColor: string;\n}\n\ninterface NeonGradientCardProps {\n /**\n * @default <div />\n * @type ReactElement\n * @description\n * The component to be rendered as the card\n * */\n as?: ReactElement;\n /**\n * @default \"\"\n * @type string\n * @description\n * The className of the card\n */\n className?: string;\n\n /**\n * @default \"\"\n * @type ReactNode\n * @description\n * The children of the card\n * */\n children?: ReactNode;\n\n /**\n * @default 5\n * @type number\n * @description\n * The size of the border in pixels\n * */\n borderSize?: number;\n\n /**\n * @default 20\n * @type number\n * @description\n * The size of the radius in pixels\n * */\n borderRadius?: number;\n\n /**\n * @default \"{ firstColor: '#ff00aa', secondColor: '#00FFF1' }\"\n * @type string\n * @description\n * The colors of the neon gradient\n * */\n neonColors?: NeonColorsProps;\n\n [key: string]: any;\n}\n\nexport const NeonGradientCard: React.FC<NeonGradientCardProps> = ({\n className,\n children,\n borderSize = 2,\n borderRadius = 20,\n neonColors = {\n firstColor: \"#ff00aa\",\n secondColor: \"#00FFF1\",\n },\n ...props\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 });\n\n useEffect(() => {\n const updateDimensions = () => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current;\n setDimensions({ width: offsetWidth, height: offsetHeight });\n }\n };\n\n updateDimensions();\n window.addEventListener(\"resize\", updateDimensions);\n\n return () => {\n window.removeEventListener(\"resize\", updateDimensions);\n };\n }, []);\n\n useEffect(() => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current;\n setDimensions({ width: offsetWidth, height: offsetHeight });\n }\n }, [children]);\n\n return (\n <div\n ref={containerRef}\n style={\n {\n \"--border-size\": `${borderSize}px`,\n \"--border-radius\": `${borderRadius}px`,\n \"--neon-first-color\": neonColors.firstColor,\n \"--neon-second-color\": neonColors.secondColor,\n \"--card-width\": `${dimensions.width}px`,\n \"--card-height\": `${dimensions.height}px`,\n \"--card-content-radius\": `${borderRadius - borderSize}px`,\n \"--pseudo-element-background-image\": `linear-gradient(0deg, ${neonColors.firstColor}, ${neonColors.secondColor})`,\n \"--pseudo-element-width\": `${dimensions.width + borderSize * 2}px`,\n \"--pseudo-element-height\": `${dimensions.height + borderSize * 2}px`,\n \"--after-blur\": `${dimensions.width / 3}px`,\n } as CSSProperties\n }\n className={cn(\n \"relative z-10 size-full rounded-[var(--border-radius)]\",\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"relative size-full min-h-[inherit] rounded-[var(--card-content-radius)] bg-gray-100 p-6\",\n \"before:absolute before:-left-[var(--border-size)] before:-top-[var(--border-size)] before:-z-10 before:block\",\n \"before:h-[var(--pseudo-element-height)] before:w-[var(--pseudo-element-width)] before:rounded-[var(--border-radius)] before:content-['']\",\n \"before:bg-[linear-gradient(0deg,var(--neon-first-color),var(--neon-second-color))] before:bg-[length:100%_200%]\",\n \"before:animate-background-position-spin\",\n \"after:absolute after:-left-[var(--border-size)] after:-top-[var(--border-size)] after:-z-10 after:block\",\n \"after:h-[var(--pseudo-element-height)] after:w-[var(--pseudo-element-width)] after:rounded-[var(--border-radius)] after:blur-[var(--after-blur)] after:content-['']\",\n \"after:bg-[linear-gradient(0deg,var(--neon-first-color),var(--neon-second-color))] after:bg-[length:100%_200%] after:opacity-80\",\n \"after:animate-background-position-spin\",\n \"dark:bg-neutral-900\",\n \"break-words\",\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n","type": "registry:ui","target": "components/magicui/neon-gradient-card.tsx"}diff --git a/public/r/shimmer-button.json b/public/r/shimmer-button.jsonindex be69b169..556e7a22 100644--- a/public/r/shimmer-button.json+++ b/public/r/shimmer-button.json@@ -7,7 +7,7 @@"files": [{"path": "registry/magicui/shimmer-button.tsx",- "content": "import React, { CSSProperties, ComponentPropsWithoutRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ShimmerButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n shimmerColor?: string;\n shimmerSize?: string;\n borderRadius?: string;\n shimmerDuration?: string;\n background?: string;\n className?: string;\n children?: React.ReactNode;\n}\n\nexport const ShimmerButton = React.forwardRef<\n HTMLButtonElement,\n ShimmerButtonProps\n>(\n (\n {\n shimmerColor = \"#ffffff\",\n shimmerSize = \"0.05em\",\n shimmerDuration = \"3s\",\n borderRadius = \"100px\",\n background = \"rgba(0, 0, 0, 1)\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <button\n style={\n {\n \"--spread\": \"90deg\",\n \"--shimmer-color\": shimmerColor,\n \"--radius\": borderRadius,\n \"--speed\": shimmerDuration,\n \"--cut\": shimmerSize,\n \"--bg\": background,\n } as CSSProperties\n }\n className={cn(\n \"group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden whitespace-nowrap border border-white/10 px-6 py-3 text-white [background:var(--bg)] [border-radius:var(--radius)]\",\n \"transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {/* spark container */}\n <div\n className={cn(\n \"-z-30 blur-[2px]\",\n \"absolute inset-0 overflow-visible [container-type:size]\",\n )}\n >\n {/* spark */}\n <div className=\"absolute inset-0 h-[100cqh] animate-shimmer-slide [aspect-ratio:1] [border-radius:0] [mask:none]\">\n {/* spark before */}\n <div className=\"absolute -inset-full w-auto rotate-0 animate-spin-around [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))] [translate:0_0]\" />\n </div>\n </div>\n {children}\n\n {/* Highlight */}\n <div\n className={cn(\n \"insert-0 absolute size-full\",\n\n \"rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]\",\n\n // transition\n \"transform-gpu transition-all duration-300 ease-in-out\",\n\n // on hover\n \"group-hover:shadow-[inset_0_-6px_10px_#ffffff3f]\",\n\n // on click\n \"group-active:shadow-[inset_0_-10px_10px_#ffffff3f]\",\n )}\n />\n\n {/* backdrop */}\n <div\n className={cn(\n \"absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]\",\n )}\n />\n </button>\n );\n },\n);\n\nShimmerButton.displayName = \"ShimmerButton\";\n",+ "content": "import React, { CSSProperties, ComponentPropsWithoutRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ShimmerButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n shimmerColor?: string;\n shimmerSize?: string;\n borderRadius?: string;\n shimmerDuration?: string;\n background?: string;\n className?: string;\n children?: React.ReactNode;\n}\n\nexport const ShimmerButton = React.forwardRef<\n HTMLButtonElement,\n ShimmerButtonProps\n>(\n (\n {\n shimmerColor = \"#ffffff\",\n shimmerSize = \"0.05em\",\n shimmerDuration = \"3s\",\n borderRadius = \"100px\",\n background = \"rgba(0, 0, 0, 1)\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <button\n style={\n {\n \"--spread\": \"90deg\",\n \"--shimmer-color\": shimmerColor,\n \"--radius\": borderRadius,\n \"--speed\": shimmerDuration,\n \"--cut\": shimmerSize,\n \"--bg\": background,\n } as CSSProperties\n }\n className={cn(\n \"group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden whitespace-nowrap border border-white/10 px-6 py-3 text-white [background:var(--bg)] [border-radius:var(--radius)]\",\n \"transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {/* spark container */}\n <div\n className={cn(\n \"-z-30 blur-[2px]\",\n \"absolute inset-0 overflow-visible [container-type:size]\",\n )}\n >\n {/* spark */}\n <div className=\"absolute inset-0 h-[100cqh] animate-shimmer-slide [aspect-ratio:1] [border-radius:0] [mask:none]\">\n {/* spark before */}\n <div className=\"absolute -inset-full w-auto rotate-0 animate-spin-around [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))] [translate:0_0]\" />\n </div>\n </div>\n {children}\n\n {/* Highlight */}\n <div\n className={cn(\n \"inset-0 absolute size-full\",\n\n \"rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]\",\n\n // transition\n \"transform-gpu transition-all duration-300 ease-in-out\",\n\n // on hover\n \"group-hover:shadow-[inset_0_-6px_10px_#ffffff3f]\",\n\n // on click\n \"group-active:shadow-[inset_0_-10px_10px_#ffffff3f]\",\n )}\n />\n\n {/* backdrop */}\n <div\n className={cn(\n \"absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]\",\n )}\n />\n </button>\n );\n },\n);\n\nShimmerButton.displayName = \"ShimmerButton\";\n","type": "registry:ui","target": "components/magicui/shimmer-button.tsx"}diff --git a/registry/magicui/shimmer-button.tsx b/registry/magicui/shimmer-button.tsxindex 0150aee5..e68e24c3 100644--- a/registry/magicui/shimmer-button.tsx+++ b/registry/magicui/shimmer-button.tsx@@ -67,7 +67,7 @@ export const ShimmerButton = React.forwardRef<{/* Highlight */}<divclassName={cn(- "insert-0 absolute size-full",+ "inset-0 absolute size-full","rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]",