@oussemasahbeni/keycloakify-login-shadcn 250004.0.8 → 250004.0.9

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.
@@ -1,81 +1,89 @@
1
+ import { cn } from "@/components/lib/utils";
1
2
  import { cva, type VariantProps } from "class-variance-authority";
2
3
  import { AlertTriangle, Info, XCircle } from "lucide-react";
3
4
  import * as React from "react";
4
5
  import { MdCheckCircle } from "react-icons/md";
5
6
 
6
- import { cn } from "@/components/lib/utils";
7
-
8
7
  const alertVariants = cva(
9
- "relative w-full rounded-lg border p-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",
8
+ "relative w-full rounded-lg border px-5 py-4 text-sm flex items-center gap-4 transition-all",
10
9
  {
11
10
  variants: {
12
11
  variant: {
13
12
  info: "bg-card text-card-foreground",
14
- error: "border-red-200 bg-red-50 text-red-800 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300 [&>svg]:text-red-800 dark:[&>svg]:text-red-300",
15
- warning:
16
- "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950/50 dark:text-amber-300 [&>svg]:text-amber-800 dark:[&>svg]:text-amber-300",
17
- success:
18
- "border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-950/50 dark:text-green-300 [&>svg]:text-green-800 dark:[&>svg]:text-green-300"
19
- }
13
+ success: "bg-emerald-50/50 border-emerald-200 text-emerald-900 dark:bg-emerald-500/5 dark:border-emerald-500/20 dark:text-emerald-400",
14
+ warning: "bg-amber-50/50 border-amber-200 text-amber-900 dark:bg-amber-500/5 dark:border-amber-500/20 dark:text-amber-400",
15
+ error: "bg-destructive/5 border-destructive/20 text-destructive",
16
+ },
20
17
  },
21
18
  defaultVariants: {
22
- variant: "info"
23
- }
19
+ variant: "info",
20
+ },
24
21
  }
25
22
  );
26
23
 
27
- const Alert = React.forwardRef<
28
- HTMLDivElement,
29
- React.HTMLAttributes<HTMLDivElement> &
30
- VariantProps<typeof alertVariants> & { showIcon?: boolean }
31
- >(({ className, showIcon = true, variant, ...props }, ref) => (
32
- <div
33
- ref={ref}
34
- role="alert"
35
- className={cn(alertVariants({ variant }), className)}
36
- {...props}
37
- >
38
- <div className="flex items-start gap-3">
39
- {showIcon && (
40
- <>
41
- {variant === "info" && <Info className="h-5 w-5 shrink-0" />}
42
- {variant === "error" && <XCircle className="h-5 w-5 shrink-0" />}
43
- {variant === "warning" && (
44
- <AlertTriangle className="h-5 w-5 shrink-0" />
45
- )}
46
- {variant === "success" && (
47
- <MdCheckCircle className="h-5 w-5 shrink-0" />
48
- )}
49
- </>
50
- )}
51
- {props.children}
24
+ interface AlertProps
25
+ extends React.ComponentProps<"div">,
26
+ VariantProps<typeof alertVariants> {
27
+ showIcon?: boolean;
28
+ }
29
+
30
+ function Alert({
31
+ className,
32
+ variant = "info",
33
+ showIcon = true,
34
+ children,
35
+ ...props
36
+ }: AlertProps) {
37
+ const Icon = {
38
+ info: Info,
39
+ error: XCircle,
40
+ warning: AlertTriangle,
41
+ success: MdCheckCircle,
42
+ }[variant as string] || Info;
43
+
44
+ return (
45
+ <div
46
+ data-slot="alert"
47
+ role="alert"
48
+ className={cn(alertVariants({ variant }), className)}
49
+ {...props}
50
+ >
51
+ {showIcon && <Icon className="size-5 shrink-0" data-slot="alert-icon" />}
52
+ {/* We use a div wrapper for children to ensure Title and Description stack vertically */}
53
+ <div className="flex flex-col gap-0.5 flex-1">
54
+ {children}
55
+ </div>
52
56
  </div>
53
- </div>
54
- ));
55
- Alert.displayName = "Alert";
57
+ );
58
+ }
56
59
 
57
- const AlertTitle = React.forwardRef<
58
- HTMLParagraphElement,
59
- React.HTMLAttributes<HTMLHeadingElement>
60
- >(({ className, ...props }, ref) => (
61
- <h5
62
- ref={ref}
63
- className={cn("mb-1 font-medium leading-none tracking-tight", className)}
64
- {...props}
65
- />
66
- ));
67
- AlertTitle.displayName = "AlertTitle";
60
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
61
+ return (
62
+ <div
63
+ data-slot="alert-title"
64
+ className={cn(
65
+ "font-medium leading-none tracking-tight",
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ );
71
+ }
68
72
 
69
- const AlertDescription = React.forwardRef<
70
- HTMLParagraphElement,
71
- React.HTMLAttributes<HTMLParagraphElement>
72
- >(({ className, ...props }, ref) => (
73
- <div
74
- ref={ref}
75
- className={cn("text-sm [&_p]:leading-relaxed", className)}
76
- {...props}
77
- />
78
- ));
79
- AlertDescription.displayName = "AlertDescription";
73
+ function AlertDescription({
74
+ className,
75
+ ...props
76
+ }: React.ComponentProps<"div">) {
77
+ return (
78
+ <div
79
+ data-slot="alert-description"
80
+ className={cn(
81
+ "text-muted-foreground text-sm [&_p]:leading-relaxed",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ );
87
+ }
80
88
 
81
89
  export { Alert, AlertDescription, AlertTitle };
@@ -1,56 +1,62 @@
1
- import { Slot } from "@radix-ui/react-slot";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
- import * as React from "react";
1
+ import { Slot } from "@radix-ui/react-slot"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import * as React from "react"
4
+ import { cn } from '../lib/utils'
4
5
 
5
- import { cn } from "@/components/lib/utils";
6
6
 
7
7
  const buttonVariants = cva(
8
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
8
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-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",
9
9
  {
10
10
  variants: {
11
11
  variant: {
12
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
13
  destructive:
14
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
14
+ "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
15
15
  outline:
16
- "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
16
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
17
17
  secondary:
18
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
19
- ghost: "hover:bg-accent hover:text-accent-foreground",
20
- link: "text-primary underline-offset-4 hover:underline"
18
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
19
+ ghost:
20
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
21
+ link: "text-primary underline-offset-4 hover:underline",
21
22
  },
22
23
  size: {
23
- default: "h-9 px-4 py-2",
24
- sm: "h-8 rounded-md px-3 text-xs",
25
- lg: "h-10 rounded-md px-8",
26
- icon: "h-9 w-9"
27
- }
24
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
25
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
26
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
27
+ icon: "size-9",
28
+ "icon-sm": "size-8",
29
+ "icon-lg": "size-10",
30
+ },
28
31
  },
29
32
  defaultVariants: {
30
33
  variant: "default",
31
- size: "default"
32
- }
34
+ size: "default",
35
+ },
33
36
  }
34
- );
37
+ )
35
38
 
36
- export interface ButtonProps
37
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38
- VariantProps<typeof buttonVariants> {
39
- asChild?: boolean;
40
- }
39
+ function Button({
40
+ className,
41
+ variant = "default",
42
+ size = "default",
43
+ asChild = false,
44
+ ...props
45
+ }: React.ComponentProps<"button"> &
46
+ VariantProps<typeof buttonVariants> & {
47
+ asChild?: boolean
48
+ }) {
49
+ const Comp = asChild ? Slot : "button"
41
50
 
42
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43
- ({ className, variant, size, asChild = false, ...props }, ref) => {
44
- const Comp = asChild ? Slot : "button";
45
- return (
46
- <Comp
47
- className={cn(buttonVariants({ variant, size, className }))}
48
- ref={ref}
49
- {...props}
50
- />
51
- );
52
- }
53
- );
54
- Button.displayName = "Button";
51
+ return (
52
+ <Comp
53
+ data-slot="button"
54
+ data-variant={variant}
55
+ data-size={size}
56
+ className={cn(buttonVariants({ variant, size, className }))}
57
+ {...props}
58
+ />
59
+ )
60
+ }
55
61
 
56
- export { Button, buttonVariants };
62
+ export { Button, buttonVariants }
@@ -1,72 +1,87 @@
1
- import * as React from "react";
1
+ import * as React from "react"
2
2
 
3
- import { cn } from "@/components/lib/utils";
3
+ import { cn } from '../lib/utils'
4
4
 
5
- const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
6
- ({ className, ...props }, ref) => (
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
7
  <div
8
- ref={ref}
8
+ data-slot="card"
9
9
  className={cn(
10
- "rounded-xl border bg-card text-card-foreground shadow",
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
11
  className
12
12
  )}
13
13
  {...props}
14
14
  />
15
15
  )
16
- );
17
- Card.displayName = "Card";
16
+ }
18
17
 
19
- const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
20
- ({ className, ...props }, ref) => (
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
21
20
  <div
22
- ref={ref}
23
- className={cn("flex flex-col space-y-1.5 p-6", className)}
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 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)}
24
36
  {...props}
25
37
  />
26
38
  )
27
- );
28
- CardHeader.displayName = "CardHeader";
39
+ }
29
40
 
30
- const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
31
- ({ className, ...props }, ref) => (
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
32
43
  <div
33
- ref={ref}
34
- className={cn("font-semibold leading-none tracking-tight", className)}
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
35
46
  {...props}
36
47
  />
37
48
  )
38
- );
39
- CardTitle.displayName = "CardTitle";
49
+ }
40
50
 
41
- const CardDescription = React.forwardRef<
42
- HTMLDivElement,
43
- React.HTMLAttributes<HTMLDivElement>
44
- >(({ className, ...props }, ref) => (
45
- <div
46
- ref={ref}
47
- className={cn("text-sm text-muted-foreground", className)}
48
- {...props}
49
- />
50
- ));
51
- CardDescription.displayName = "CardDescription";
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
+ }
52
63
 
53
- const CardContent = React.forwardRef<
54
- HTMLDivElement,
55
- React.HTMLAttributes<HTMLDivElement>
56
- >(({ className, ...props }, ref) => (
57
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
58
- ));
59
- CardContent.displayName = "CardContent";
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
+ }
60
73
 
61
- const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
62
- ({ className, ...props }, ref) => (
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
63
76
  <div
64
- ref={ref}
65
- className={cn("flex items-center p-6 pt-0", className)}
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
66
79
  {...props}
67
80
  />
68
81
  )
69
- );
70
- CardFooter.displayName = "CardFooter";
82
+ }
83
+
84
+ export {
85
+ Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle
86
+ }
71
87
 
72
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -1,28 +1,30 @@
1
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
2
- import { Check } from "lucide-react";
3
- import * as React from "react";
1
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
2
+ import { CheckIcon } from "lucide-react"
3
+ import * as React from "react"
4
4
 
5
- import { cn } from "@/components/lib/utils";
5
+ import { cn } from '../lib/utils'
6
6
 
7
- const Checkbox = React.forwardRef<
8
- React.ElementRef<typeof CheckboxPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10
- >(({ className, ...props }, ref) => (
7
+ function Checkbox({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
11
+ return (
11
12
  <CheckboxPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15
- className
16
- )}
17
- {...props}
13
+ data-slot="checkbox"
14
+ className={cn(
15
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-sm border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
18
19
  >
19
- <CheckboxPrimitive.Indicator
20
- className={cn("grid place-content-center text-current")}
21
- >
22
- <Check className="h-4 w-4" />
23
- </CheckboxPrimitive.Indicator>
20
+ <CheckboxPrimitive.Indicator
21
+ data-slot="checkbox-indicator"
22
+ className="grid place-content-center text-current transition-none"
23
+ >
24
+ <CheckIcon className="size-3.5" />
25
+ </CheckboxPrimitive.Indicator>
24
26
  </CheckboxPrimitive.Root>
25
- ));
26
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
27
+ )
28
+ }
27
29
 
28
- export { Checkbox };
30
+ export { Checkbox }