@cntyclub/ui-react 0.10.3 → 0.10.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntyclub/ui-react",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "React component library for the Country Club UI Kit — Base UI primitives styled with the Country Club design system (Tailwind CSS v4)",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -0,0 +1,73 @@
1
+ "use client";
2
+
3
+ import { memo, type CSSProperties, type ReactNode } from "react";
4
+
5
+ import { cn } from "../../lib/utils/css";
6
+
7
+ export interface AuroraTextProps {
8
+ children: ReactNode;
9
+ className?: string;
10
+ /**
11
+ * Gradient stops, cycled left→right and looped back to the first. The default
12
+ * is a vivid RGB set (pink → purple → blue → sky) chosen to stay legible on
13
+ * BOTH light and dark backgrounds — the text is painted with these colors
14
+ * (transparent fill + clipped gradient), so it never depends on the page bg.
15
+ */
16
+ colors?: string[];
17
+ /** Animation speed multiplier. 1 ≈ a 10s loop; 2 is twice as fast. */
18
+ speed?: number;
19
+ /** Add a soft, blurred RGB halo behind the text (a subtle aura). */
20
+ glow?: boolean;
21
+ }
22
+
23
+ const DEFAULT_COLORS = ["#FF0080", "#7928CA", "#0070F3", "#38bdf8"];
24
+
25
+ /**
26
+ * Animated RGB gradient text: the gradient slowly sweeps across the glyphs on a
27
+ * loop (via `background-position`, so it's GPU-composited and cheap — safe on
28
+ * mobile). Purely CSS; no JS ticking. The real text is kept in an `sr-only`
29
+ * span so it stays selectable/announced while the visible layer is decorative.
30
+ *
31
+ * @example
32
+ * <AuroraText>Thinking</AuroraText>
33
+ * <AuroraText glow speed={1.4} colors={["#22d3ee", "#a855f7", "#f43f5e"]}>Live</AuroraText>
34
+ */
35
+ export const AuroraText = memo(function AuroraText({
36
+ children,
37
+ className,
38
+ colors = DEFAULT_COLORS,
39
+ speed = 1,
40
+ glow = false,
41
+ }: AuroraTextProps) {
42
+ const gradientStyle: CSSProperties = {
43
+ backgroundImage: `linear-gradient(135deg, ${colors.join(", ")}, ${colors[0]})`,
44
+ // Oversized so the sweep has room to travel before repeating.
45
+ backgroundSize: "200% auto",
46
+ WebkitBackgroundClip: "text",
47
+ backgroundClip: "text",
48
+ WebkitTextFillColor: "transparent",
49
+ color: "transparent",
50
+ animationDuration: `${10 / speed}s`,
51
+ };
52
+
53
+ return (
54
+ <span className={cn("relative inline-block", className)}>
55
+ {/* Accessible, copyable text; the colored layers below are decorative. */}
56
+ <span className="sr-only">{children}</span>
57
+ {glow ? (
58
+ <span
59
+ aria-hidden="true"
60
+ className="animate-aurora pointer-events-none absolute inset-0 select-none blur-[6px] opacity-60"
61
+ style={gradientStyle}
62
+ >
63
+ {children}
64
+ </span>
65
+ ) : null}
66
+ <span aria-hidden="true" className="animate-aurora relative" style={gradientStyle}>
67
+ {children}
68
+ </span>
69
+ </span>
70
+ );
71
+ });
72
+
73
+ AuroraText.displayName = "AuroraText";
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export * from "./components/ui/alert-dialog";
8
8
  export * from "./components/ui/animated-theme-toggler";
9
9
  export * from "./components/ui/app-store-buttons";
10
10
  export * from "./components/ui/aspect-ratio";
11
+ export * from "./components/ui/aurora-text";
11
12
  export * from "./components/ui/autocomplete";
12
13
  export * from "./components/ui/avatar";
13
14
  export * from "./components/ui/avatar-group";
package/src/styles.css CHANGED
@@ -17,6 +17,7 @@
17
17
  @theme inline {
18
18
  --animate-skeleton: skeleton 2s -1s infinite linear;
19
19
  --animate-qr-scan: qr-scan 2.6s ease-in-out infinite alternate;
20
+ --animate-aurora: aurora 10s ease infinite;
20
21
  --color-warning-foreground: var(--warning-foreground);
21
22
  --color-warning: var(--warning);
22
23
  --color-success-foreground: var(--success-foreground);
@@ -81,6 +82,16 @@
81
82
  transform: translateY(150%);
82
83
  }
83
84
  }
85
+ /* AuroraText: sweep the oversized gradient back and forth across the glyphs. */
86
+ @keyframes aurora {
87
+ 0%,
88
+ 100% {
89
+ background-position: 0% 50%;
90
+ }
91
+ 50% {
92
+ background-position: 100% 50%;
93
+ }
94
+ }
84
95
  --font-sans: "DM Sans", sans-serif;
85
96
  --font-serif: "Fraunces", sans-serif;
86
97
  }