@authdog/react-elements 0.0.12 → 0.0.14

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/.turbo/turbo-build.log +47 -23
  2. package/CHANGELOG.md +12 -0
  3. package/dist/components/ui/alert.js +3 -0
  4. package/dist/components/ui/alert.js.map +1 -0
  5. package/dist/components/ui/alert.mjs +3 -0
  6. package/dist/components/ui/alert.mjs.map +1 -0
  7. package/dist/components/ui/badge.js +3 -0
  8. package/dist/components/ui/badge.js.map +1 -0
  9. package/dist/components/ui/badge.mjs +3 -0
  10. package/dist/components/ui/badge.mjs.map +1 -0
  11. package/dist/components/ui/card.js +3 -0
  12. package/dist/components/ui/card.js.map +1 -0
  13. package/dist/components/ui/card.mjs +3 -0
  14. package/dist/components/ui/card.mjs.map +1 -0
  15. package/dist/components/ui/input.js +3 -0
  16. package/dist/components/ui/input.js.map +1 -0
  17. package/dist/components/ui/input.mjs +3 -0
  18. package/dist/components/ui/input.mjs.map +1 -0
  19. package/dist/components/ui/label.js +3 -0
  20. package/dist/components/ui/label.js.map +1 -0
  21. package/dist/components/ui/label.mjs +3 -0
  22. package/dist/components/ui/label.mjs.map +1 -0
  23. package/dist/components/ui/separator.js +3 -0
  24. package/dist/components/ui/separator.js.map +1 -0
  25. package/dist/components/ui/separator.mjs +3 -0
  26. package/dist/components/ui/separator.mjs.map +1 -0
  27. package/dist/index.d.mts +18 -1
  28. package/dist/index.d.ts +18 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/postcss.config.mjs +2 -0
  34. package/dist/styles.css +406 -6
  35. package/dist/tailwind.config.ts +5 -5
  36. package/ladle.config.mjs +21 -0
  37. package/package.json +16 -4
  38. package/postcss.config.mjs +2 -0
  39. package/src/components/core/navbar.tsx +44 -39
  40. package/src/components/core/user-profile.tsx +245 -0
  41. package/src/components/flow/login.tsx +158 -0
  42. package/src/components/ui/alert.tsx +66 -0
  43. package/src/components/ui/badge.tsx +46 -0
  44. package/src/components/ui/card.tsx +92 -0
  45. package/src/components/ui/input.tsx +21 -0
  46. package/src/components/ui/label.tsx +24 -0
  47. package/src/components/ui/separator.tsx +28 -0
  48. package/src/index.ts +3 -2
  49. package/src/main.tsx +11 -0
  50. package/src/preview.tsx +10 -0
  51. package/src/stories/Button.stories.tsx +24 -0
  52. package/src/stories/LoginForm.stories.tsx +29 -0
  53. package/src/stories/Navbar.stories.tsx +22 -0
  54. package/src/stories/UserProfile.stories.tsx +56 -0
  55. package/tailwind.config.ts +5 -5
@@ -0,0 +1,46 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@authdog/react-elements/lib/utils"
6
+
7
+ const badgeVariants = cva(
8
+ "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
14
+ secondary:
15
+ "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
16
+ destructive:
17
+ "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
18
+ outline:
19
+ "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ },
25
+ }
26
+ )
27
+
28
+ function Badge({
29
+ className,
30
+ variant,
31
+ asChild = false,
32
+ ...props
33
+ }: React.ComponentProps<"span"> &
34
+ VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
35
+ const Comp = asChild ? Slot : "span"
36
+
37
+ return (
38
+ <Comp
39
+ data-slot="badge"
40
+ className={cn(badgeVariants({ variant }), className)}
41
+ {...props}
42
+ />
43
+ )
44
+ }
45
+
46
+ export { Badge, badgeVariants }
@@ -0,0 +1,92 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@authdog/react-elements/lib/utils"
4
+
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
46
+ {...props}
47
+ />
48
+ )
49
+ }
50
+
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
63
+
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export {
85
+ Card,
86
+ CardHeader,
87
+ CardFooter,
88
+ CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
92
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@authdog/react-elements/lib/utils"
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ }
20
+
21
+ export { Input }
@@ -0,0 +1,24 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as LabelPrimitive from "@radix-ui/react-label"
5
+
6
+ import { cn } from "@authdog/react-elements/lib/utils"
7
+
8
+ function Label({
9
+ className,
10
+ ...props
11
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
12
+ return (
13
+ <LabelPrimitive.Root
14
+ data-slot="label"
15
+ className={cn(
16
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ export { Label }
@@ -0,0 +1,28 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SeparatorPrimitive from "@radix-ui/react-separator"
5
+
6
+ import { cn } from "@authdog/react-elements/lib/utils"
7
+
8
+ function Separator({
9
+ className,
10
+ orientation = "horizontal",
11
+ decorative = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
14
+ return (
15
+ <SeparatorPrimitive.Root
16
+ data-slot="separator-root"
17
+ decorative={decorative}
18
+ orientation={orientation}
19
+ className={cn(
20
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Separator }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./components/ui/button";
2
- export {Navbar} from "./components/core/navbar"
1
+ export {Button} from "./components/ui/button";
2
+ export {Navbar} from "./components/core/navbar";
3
+ export {UserProfile} from "./components/core/user-profile";
package/src/main.tsx ADDED
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import '../dist/styles.css';
3
+
4
+ // This is the main entry point for Ladle
5
+ export default function Main({ children }: { children: React.ReactNode }) {
6
+ return (
7
+ <div className="min-h-screen bg-background text-foreground">
8
+ {children}
9
+ </div>
10
+ );
11
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ // This is the preview component for Ladle
4
+ export default function Preview({ children }: { children: React.ReactNode }) {
5
+ return (
6
+ <div className="ladle-main">
7
+ {children}
8
+ </div>
9
+ );
10
+ }
@@ -0,0 +1,24 @@
1
+ import type { Story } from '@ladle/react';
2
+ import { Button } from '../components/ui/button';
3
+ import "../global.css";
4
+
5
+ export const Default: Story = () => <Button>Click me</Button>;
6
+ Default.storyName = 'Default Button';
7
+
8
+ export const Primary: Story = () => <Button variant="default">Primary</Button>;
9
+ Primary.storyName = 'Primary Button';
10
+
11
+ export const Secondary: Story = () => <Button variant="secondary">Secondary</Button>;
12
+ Secondary.storyName = 'Secondary Button';
13
+
14
+ export const Destructive: Story = () => <Button variant="destructive">Delete</Button>;
15
+ Destructive.storyName = 'Destructive Button';
16
+
17
+ export const Outline: Story = () => <Button variant="outline">Outline</Button>;
18
+ Outline.storyName = 'Outline Button';
19
+
20
+ export const Ghost: Story = () => <Button variant="ghost">Ghost</Button>;
21
+ Ghost.storyName = 'Ghost Button';
22
+
23
+ export const Link: Story = () => <Button variant="link">Link</Button>;
24
+ Link.storyName = 'Link Button';
@@ -0,0 +1,29 @@
1
+ // import { useState, useEffect } from "react"
2
+ import type { Story } from "@ladle/react"
3
+ import { LoginForm } from "../components/flow/login"
4
+ import "../global.css"
5
+
6
+ export const Default: Story = () => <LoginForm />
7
+ Default.storyName = "Default Login Form"
8
+
9
+ // export const Loading: Story = () => {
10
+ // const [isLoading, setIsLoading] = useState(true)
11
+ // useEffect(() => {
12
+ // const timer = setTimeout(() => setIsLoading(false), 2000)
13
+ // return () => clearTimeout(timer)
14
+ // }, [])
15
+ // return <LoginForm />
16
+ // }
17
+ // Loading.storyName = "Loading State"
18
+
19
+ // export const WithError: Story = () => {
20
+ // const [error, setError] = useState("Invalid email or password")
21
+ // return <LoginForm />
22
+ // }
23
+ // WithError.storyName = "With Error Message"
24
+
25
+ // export const WithPrefilledEmail: Story = () => {
26
+ // const [email, setEmail] = useState("user@example.com")
27
+ // return <LoginForm />
28
+ // }
29
+ // WithPrefilledEmail.storyName = "With Pre-filled Email"
@@ -0,0 +1,22 @@
1
+ import type { Story } from '@ladle/react';
2
+ import { Navbar } from "../components/core/navbar"
3
+ import { Button } from "../components/ui/button"
4
+ import "../global.css"
5
+
6
+ export const Default: Story = () => <Navbar logoText="Authdog" />;
7
+ Default.storyName = 'Default Navbar';
8
+
9
+ export const CustomNavigation: Story = () => <Navbar logoText="Authdog" items={[{ title: "Home", href: "/" }, { title: "Features", href: "/features" }, { title: "Pricing", href: "/pricing" }, { title: "Contact", href: "/contact" }]} />;
10
+ CustomNavigation.storyName = 'Custom Navigation';
11
+
12
+ export const CustomUser: Story = () => <Navbar logoText="Authdog" user={{ name: "Jane Smith", email: "jane@Authdog.com", image: "https://github.com/shadcn.png" }} />;
13
+ CustomUser.storyName = 'Custom User';
14
+
15
+ export const WithChildren: Story = () => <Navbar logoText="Authdog" children={<Button variant="outline" size="sm">Get Started</Button>} />;
16
+ WithChildren.storyName = 'With Children';
17
+
18
+ export const CustomStyling: Story = () => <Navbar logoText="Authdog" className="bg-gradient-to-r from-blue-500 to-purple-500 text-white" />;
19
+ CustomStyling.storyName = 'Custom Styling';
20
+
21
+ export const WithDisabledItems: Story = () => <Navbar logoText="Authdog" items={[{ title: "Dashboard", href: "/dashboard" }, { title: "Projects", href: "/projects" }, { title: "Team", href: "/team", disabled: true }, { title: "Reports", href: "/reports", disabled: true }]} />;
22
+ WithDisabledItems.storyName = 'With Disabled Items';
@@ -0,0 +1,56 @@
1
+ import type { Story } from '@ladle/react';
2
+ import { UserProfile, UserProfileProps } from '../components/core/user-profile';
3
+ import "../global.css";
4
+
5
+ export const Default: Story = () => (
6
+ <UserProfile
7
+ user={{
8
+ name: "Jaylon Dias",
9
+ email: "example@clerk.dev",
10
+ image: "/placeholder-user.jpg"
11
+ }}
12
+ />
13
+ );
14
+ Default.storyName = 'Default User Profile';
15
+
16
+ export const WithCustomUser: Story = () => (
17
+ <UserProfile
18
+ user={{
19
+ name: "Jane Smith",
20
+ email: "jane@example.com",
21
+ image: "/placeholder-user.jpg"
22
+ }}
23
+ />
24
+ );
25
+ WithCustomUser.storyName = 'User Profile with Custom User';
26
+
27
+ export const WithMultipleEmails: Story = () => (
28
+ <UserProfile
29
+ user={{
30
+ name: "John Doe",
31
+ email: "john@example.com",
32
+ image: "/placeholder-user.jpg"
33
+ }}
34
+ emails={[
35
+ { address: "john@example.com", isPrimary: true },
36
+ { address: "john@personal.com", isPrimary: false },
37
+ { address: "john@work.com", isPrimary: false }
38
+ ]}
39
+ />
40
+ );
41
+ WithMultipleEmails.storyName = 'User Profile with Multiple Emails';
42
+
43
+ export const WithConnectedAccounts: Story = () => (
44
+ <UserProfile
45
+ user={{
46
+ name: "Alex Johnson",
47
+ email: "alex@example.com",
48
+ image: "/placeholder-user.jpg"
49
+ }}
50
+ connectedAccounts={[
51
+ { provider: "Google", email: "alex@gmail.com" },
52
+ { provider: "GitHub", email: "alex@github.com" }
53
+ ]}
54
+ />
55
+ );
56
+ WithConnectedAccounts.storyName = 'User Profile with Connected Accounts';
@@ -4,11 +4,11 @@ import tailwindcssAnimate from "tailwindcss-animate";
4
4
  const config = {
5
5
  darkMode: ["class"],
6
6
  content: [
7
- "./pages/**/*.{ts,tsx}",
8
- "./components/**/*.{ts,tsx}",
9
- "./components/**/**/*.{ts,tsx}",
10
- "./app/**/*.{ts,tsx}",
11
- "./src/**/*.{ts,tsx}"
7
+ "./src/**/*.{js,ts,jsx,tsx}",
8
+ "./src/**/*.stories.{js,ts,jsx,tsx}",
9
+ "./src/components/**/*.{js,ts,jsx,tsx}",
10
+ "./src/components/**/**/*.{js,ts,jsx,tsx}",
11
+ "./src/preview.{js,ts,jsx,tsx}",
12
12
  ],
13
13
  prefix: "",
14
14
  theme: {