@srcroot/ui 0.0.61 → 0.0.63

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,52 +1,55 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
- import { cn } from "@/lib/utils"
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { cn } from "@/lib/utils";
4
6
 
5
7
  const badgeVariants = cva(
6
- "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
7
- {
8
- variants: {
9
- variant: {
10
- default:
11
- "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
12
- secondary:
13
- "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
14
- destructive:
15
- "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
16
- outline: "text-foreground",
17
- },
18
- },
19
- defaultVariants: {
20
- variant: "default",
21
- },
22
- }
23
- )
8
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
14
+ secondary:
15
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
16
+ destructive:
17
+ "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
18
+ outline: "text-foreground",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "default",
23
+ },
24
+ },
25
+ );
24
26
 
25
27
  interface BadgeProps
26
- extends React.HTMLAttributes<HTMLSpanElement>,
27
- VariantProps<typeof badgeVariants> { }
28
+ extends
29
+ React.HTMLAttributes<HTMLSpanElement>,
30
+ VariantProps<typeof badgeVariants> {}
28
31
 
29
32
  /**
30
33
  * Badge component for status indicators
31
- *
34
+ *
32
35
  * @example
33
36
  * // Default badge
34
37
  * <Badge>New</Badge>
35
- *
38
+ *
36
39
  * // Destructive variant
37
40
  * <Badge variant="destructive">Error</Badge>
38
41
  */
39
42
  const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
40
- ({ className, variant, ...props }, ref) => {
41
- return (
42
- <span
43
- ref={ref}
44
- className={cn(badgeVariants({ variant }), className)}
45
- {...props}
46
- />
47
- )
48
- }
49
- )
50
- Badge.displayName = "Badge"
43
+ ({ className, variant, ...props }, ref) => {
44
+ return (
45
+ <span
46
+ ref={ref}
47
+ className={cn(badgeVariants({ variant }), className)}
48
+ {...props}
49
+ />
50
+ );
51
+ },
52
+ );
53
+ Badge.displayName = "Badge";
51
54
 
52
- export { Badge, badgeVariants }
55
+ export { Badge, badgeVariants };
@@ -1,10 +1,12 @@
1
- import * as React from "react"
2
- import { cn } from "@/lib/utils"
3
- import { Slot } from "@/components/ui/slot"
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cn } from "@/lib/utils";
5
+ import { Slot } from "@/components/ui/slot";
4
6
 
5
7
  /**
6
8
  * Breadcrumb navigation component
7
- *
9
+ *
8
10
  * @example
9
11
  * <Breadcrumb>
10
12
  * <BreadcrumbList>
@@ -20,128 +22,126 @@ import { Slot } from "@/components/ui/slot"
20
22
  */
21
23
 
22
24
  const Breadcrumb = React.forwardRef<
23
- HTMLElement,
24
- React.HTMLAttributes<HTMLElement>
25
- >(({ ...props }, ref) => (
26
- <nav ref={ref} aria-label="breadcrumb" {...props} />
27
- ))
28
- Breadcrumb.displayName = "Breadcrumb"
25
+ HTMLElement,
26
+ React.HTMLAttributes<HTMLElement>
27
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
28
+ Breadcrumb.displayName = "Breadcrumb";
29
29
 
30
30
  const BreadcrumbList = React.forwardRef<
31
- HTMLOListElement,
32
- React.OlHTMLAttributes<HTMLOListElement>
31
+ HTMLOListElement,
32
+ React.OlHTMLAttributes<HTMLOListElement>
33
33
  >(({ className, ...props }, ref) => (
34
- <ol
35
- ref={ref}
36
- className={cn(
37
- "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
38
- className
39
- )}
40
- {...props}
41
- />
42
- ))
43
- BreadcrumbList.displayName = "BreadcrumbList"
34
+ <ol
35
+ ref={ref}
36
+ className={cn(
37
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
38
+ className,
39
+ )}
40
+ {...props}
41
+ />
42
+ ));
43
+ BreadcrumbList.displayName = "BreadcrumbList";
44
44
 
45
45
  const BreadcrumbItem = React.forwardRef<
46
- HTMLLIElement,
47
- React.LiHTMLAttributes<HTMLLIElement>
46
+ HTMLLIElement,
47
+ React.LiHTMLAttributes<HTMLLIElement>
48
48
  >(({ className, ...props }, ref) => (
49
- <li
50
- ref={ref}
51
- className={cn("inline-flex items-center gap-1.5", className)}
52
- {...props}
53
- />
54
- ))
55
- BreadcrumbItem.displayName = "BreadcrumbItem"
49
+ <li
50
+ ref={ref}
51
+ className={cn("inline-flex items-center gap-1.5", className)}
52
+ {...props}
53
+ />
54
+ ));
55
+ BreadcrumbItem.displayName = "BreadcrumbItem";
56
56
 
57
57
  interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
58
- asChild?: boolean
58
+ asChild?: boolean;
59
59
  }
60
60
 
61
61
  const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(
62
- ({ asChild, className, children, ...props }, ref) => {
63
- const Comp = asChild ? Slot : "a"
62
+ ({ asChild, className, children, ...props }, ref) => {
63
+ const Comp = asChild ? Slot : "a";
64
64
 
65
- return (
66
- <Comp
67
- ref={ref}
68
- className={cn("transition-colors hover:text-foreground", className)}
69
- {...props}
70
- >
71
- {children}
72
- </Comp>
73
- )
74
- }
75
- )
76
- BreadcrumbLink.displayName = "BreadcrumbLink"
65
+ return (
66
+ <Comp
67
+ ref={ref}
68
+ className={cn("transition-colors hover:text-foreground", className)}
69
+ {...props}
70
+ >
71
+ {children}
72
+ </Comp>
73
+ );
74
+ },
75
+ );
76
+ BreadcrumbLink.displayName = "BreadcrumbLink";
77
77
 
78
78
  const BreadcrumbPage = React.forwardRef<
79
- HTMLSpanElement,
80
- React.HTMLAttributes<HTMLSpanElement>
79
+ HTMLSpanElement,
80
+ React.HTMLAttributes<HTMLSpanElement>
81
81
  >(({ className, ...props }, ref) => (
82
- <span
83
- ref={ref}
84
- role="link"
85
- aria-disabled="true"
86
- aria-current="page"
87
- className={cn("font-normal text-foreground", className)}
88
- {...props}
89
- />
90
- ))
91
- BreadcrumbPage.displayName = "BreadcrumbPage"
82
+ <span
83
+ ref={ref}
84
+ role="link"
85
+ aria-disabled="true"
86
+ aria-current="page"
87
+ className={cn("font-normal text-foreground", className)}
88
+ {...props}
89
+ />
90
+ ));
91
+ BreadcrumbPage.displayName = "BreadcrumbPage";
92
92
 
93
93
  const BreadcrumbSeparator = ({
94
- children,
95
- className,
96
- ...props
94
+ children,
95
+ className,
96
+ ...props
97
97
  }: React.LiHTMLAttributes<HTMLLIElement>) => (
98
- <li
99
- role="presentation"
100
- aria-hidden="true"
101
- className={cn("[&>svg]:h-3.5 [&>svg]:w-3.5", className)}
102
- {...props}
103
- >
104
- {children || (
105
- <svg
106
- className="h-4 w-4"
107
- fill="none"
108
- viewBox="0 0 24 24"
109
- stroke="currentColor"
110
- strokeWidth={2}
111
- >
112
- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
113
- </svg>
114
- )}
115
- </li>
116
- )
117
- BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
98
+ <li
99
+ role="presentation"
100
+ aria-hidden="true"
101
+ className={cn("[&>svg]:h-3.5 [&>svg]:w-3.5", className)}
102
+ {...props}
103
+ >
104
+ {children || (
105
+ <svg
106
+ className="h-4 w-4"
107
+ fill="none"
108
+ viewBox="0 0 24 24"
109
+ stroke="currentColor"
110
+ strokeWidth={2}
111
+ >
112
+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
113
+ </svg>
114
+ )}
115
+ </li>
116
+ );
117
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
118
118
 
119
119
  const BreadcrumbEllipsis = ({
120
- className,
121
- ...props
120
+ className,
121
+ ...props
122
122
  }: React.HTMLAttributes<HTMLSpanElement>) => (
123
- <span
124
- role="presentation"
125
- aria-hidden="true"
126
- className={cn("flex h-9 w-9 items-center justify-center", className)}
127
- {...props}
128
- >
129
- <svg className="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
130
- <circle cx="12" cy="12" r="1" />
131
- <circle cx="19" cy="12" r="1" />
132
- <circle cx="5" cy="12" r="1" />
133
- </svg>
134
- <span className="sr-only">More</span>
135
- </span>
136
- )
137
- BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis"
123
+ <span
124
+ role="presentation"
125
+ aria-hidden="true"
126
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
127
+ {...props}
128
+ >
129
+ <svg className="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
130
+ <circle cx="12" cy="12" r="1" />
131
+ <circle cx="19" cy="12" r="1" />
132
+ <circle cx="5" cy="12" r="1" />
133
+ </svg>
134
+ <span className="sr-only">More</span>
135
+ </span>
136
+ );
137
+ BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
138
138
 
139
139
  export {
140
- Breadcrumb,
141
- BreadcrumbList,
142
- BreadcrumbItem,
143
- BreadcrumbLink,
144
- BreadcrumbPage,
145
- BreadcrumbSeparator,
146
- BreadcrumbEllipsis,
147
- }
140
+ Breadcrumb,
141
+ BreadcrumbList,
142
+ BreadcrumbItem,
143
+ BreadcrumbLink,
144
+ BreadcrumbPage,
145
+ BreadcrumbSeparator,
146
+ BreadcrumbEllipsis,
147
+ };
@@ -1,45 +1,48 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
- import { cn } from "@/lib/utils"
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { cn } from "@/lib/utils";
4
6
 
5
7
  const buttonGroupVariants = cva("inline-flex", {
6
- variants: {
7
- orientation: {
8
- horizontal: "flex-row",
9
- vertical: "flex-col",
10
- },
11
- attached: {
12
- true: "",
13
- false: "gap-2",
14
- },
8
+ variants: {
9
+ orientation: {
10
+ horizontal: "flex-row",
11
+ vertical: "flex-col",
12
+ },
13
+ attached: {
14
+ true: "",
15
+ false: "gap-2",
16
+ },
17
+ },
18
+ compoundVariants: [
19
+ {
20
+ orientation: "horizontal",
21
+ attached: true,
22
+ className:
23
+ "[&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child)]:-ml-px",
15
24
  },
16
- compoundVariants: [
17
- {
18
- orientation: "horizontal",
19
- attached: true,
20
- className:
21
- "[&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child)]:-ml-px",
22
- },
23
- {
24
- orientation: "vertical",
25
- attached: true,
26
- className:
27
- "[&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none [&>*:not(:first-child)]:-mt-px",
28
- },
29
- ],
30
- defaultVariants: {
31
- orientation: "horizontal",
32
- attached: true,
25
+ {
26
+ orientation: "vertical",
27
+ attached: true,
28
+ className:
29
+ "[&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none [&>*:not(:first-child)]:-mt-px",
33
30
  },
34
- })
31
+ ],
32
+ defaultVariants: {
33
+ orientation: "horizontal",
34
+ attached: true,
35
+ },
36
+ });
35
37
 
36
38
  interface ButtonGroupProps
37
- extends React.HTMLAttributes<HTMLDivElement>,
38
- VariantProps<typeof buttonGroupVariants> { }
39
+ extends
40
+ React.HTMLAttributes<HTMLDivElement>,
41
+ VariantProps<typeof buttonGroupVariants> {}
39
42
 
40
43
  /**
41
44
  * ButtonGroup to group buttons together
42
- *
45
+ *
43
46
  * @example
44
47
  * <ButtonGroup>
45
48
  * <Button>Left</Button>
@@ -48,17 +51,20 @@ interface ButtonGroupProps
48
51
  * </ButtonGroup>
49
52
  */
50
53
  const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
51
- ({ className, orientation, attached, ...props }, ref) => {
52
- return (
53
- <div
54
- ref={ref}
55
- role="group"
56
- className={cn(buttonGroupVariants({ orientation, attached }), className)}
57
- {...props}
58
- />
59
- )
60
- }
61
- )
62
- ButtonGroup.displayName = "ButtonGroup"
54
+ ({ className, orientation, attached, ...props }, ref) => {
55
+ return (
56
+ <div
57
+ ref={ref}
58
+ role="group"
59
+ className={cn(
60
+ buttonGroupVariants({ orientation, attached }),
61
+ className,
62
+ )}
63
+ {...props}
64
+ />
65
+ );
66
+ },
67
+ );
68
+ ButtonGroup.displayName = "ButtonGroup";
63
69
 
64
- export { ButtonGroup, buttonGroupVariants }
70
+ export { ButtonGroup, buttonGroupVariants };
@@ -1,9 +1,11 @@
1
- import * as React from "react"
2
- import { cn } from "@/lib/utils"
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cn } from "@/lib/utils";
3
5
 
4
6
  /**
5
7
  * Card component - Container with header, content, and footer
6
- *
8
+ *
7
9
  * @example
8
10
  * <Card>
9
11
  * <CardHeader>
@@ -15,74 +17,82 @@ import { cn } from "@/lib/utils"
15
17
  * </Card>
16
18
  */
17
19
 
18
- const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
19
- ({ className, ...props }, ref) => (
20
- <div
21
- ref={ref}
22
- className={cn(
23
- "rounded-xl border bg-card text-card-foreground shadow",
24
- className
25
- )}
26
- {...props}
27
- />
28
- )
29
- )
30
- Card.displayName = "Card"
20
+ const Card = React.forwardRef<
21
+ HTMLDivElement,
22
+ React.HTMLAttributes<HTMLDivElement>
23
+ >(({ className, ...props }, ref) => (
24
+ <div
25
+ ref={ref}
26
+ className={cn(
27
+ "rounded-xl border bg-card text-card-foreground shadow",
28
+ className,
29
+ )}
30
+ {...props}
31
+ />
32
+ ));
33
+ Card.displayName = "Card";
31
34
 
32
35
  const CardHeader = React.forwardRef<
33
- HTMLDivElement,
34
- React.HTMLAttributes<HTMLDivElement>
36
+ HTMLDivElement,
37
+ React.HTMLAttributes<HTMLDivElement>
35
38
  >(({ className, ...props }, ref) => (
36
- <div
37
- ref={ref}
38
- className={cn("flex flex-col space-y-1.5 p-6", className)}
39
- {...props}
40
- />
41
- ))
42
- CardHeader.displayName = "CardHeader"
39
+ <div
40
+ ref={ref}
41
+ className={cn("flex flex-col space-y-1.5 p-6", className)}
42
+ {...props}
43
+ />
44
+ ));
45
+ CardHeader.displayName = "CardHeader";
43
46
 
44
47
  const CardTitle = React.forwardRef<
45
- HTMLHeadingElement,
46
- React.HTMLAttributes<HTMLHeadingElement>
48
+ HTMLHeadingElement,
49
+ React.HTMLAttributes<HTMLHeadingElement>
47
50
  >(({ className, ...props }, ref) => (
48
- <h3
49
- ref={ref}
50
- className={cn("font-semibold leading-none tracking-tight", className)}
51
- {...props}
52
- />
53
- ))
54
- CardTitle.displayName = "CardTitle"
51
+ <h3
52
+ ref={ref}
53
+ className={cn("font-semibold leading-none tracking-tight", className)}
54
+ {...props}
55
+ />
56
+ ));
57
+ CardTitle.displayName = "CardTitle";
55
58
 
56
59
  const CardDescription = React.forwardRef<
57
- HTMLParagraphElement,
58
- React.HTMLAttributes<HTMLParagraphElement>
60
+ HTMLParagraphElement,
61
+ React.HTMLAttributes<HTMLParagraphElement>
59
62
  >(({ className, ...props }, ref) => (
60
- <p
61
- ref={ref}
62
- className={cn("text-sm text-muted-foreground", className)}
63
- {...props}
64
- />
65
- ))
66
- CardDescription.displayName = "CardDescription"
63
+ <p
64
+ ref={ref}
65
+ className={cn("text-sm text-muted-foreground", className)}
66
+ {...props}
67
+ />
68
+ ));
69
+ CardDescription.displayName = "CardDescription";
67
70
 
68
71
  const CardContent = React.forwardRef<
69
- HTMLDivElement,
70
- React.HTMLAttributes<HTMLDivElement>
72
+ HTMLDivElement,
73
+ React.HTMLAttributes<HTMLDivElement>
71
74
  >(({ className, ...props }, ref) => (
72
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
73
- ))
74
- CardContent.displayName = "CardContent"
75
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
76
+ ));
77
+ CardContent.displayName = "CardContent";
75
78
 
76
79
  const CardFooter = React.forwardRef<
77
- HTMLDivElement,
78
- React.HTMLAttributes<HTMLDivElement>
80
+ HTMLDivElement,
81
+ React.HTMLAttributes<HTMLDivElement>
79
82
  >(({ className, ...props }, ref) => (
80
- <div
81
- ref={ref}
82
- className={cn("flex items-center p-6 pt-0", className)}
83
- {...props}
84
- />
85
- ))
86
- CardFooter.displayName = "CardFooter"
83
+ <div
84
+ ref={ref}
85
+ className={cn("flex items-center p-6 pt-0", className)}
86
+ {...props}
87
+ />
88
+ ));
89
+ CardFooter.displayName = "CardFooter";
87
90
 
88
- export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
91
+ export {
92
+ Card,
93
+ CardHeader,
94
+ CardFooter,
95
+ CardTitle,
96
+ CardDescription,
97
+ CardContent,
98
+ };