@srcroot/ui 0.0.61 → 0.0.62

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,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
+ };
@@ -1,44 +1,47 @@
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 containerVariants = cva("mx-auto w-full px-4", {
6
- variants: {
7
- size: {
8
- sm: "max-w-screen-sm",
9
- md: "max-w-screen-md",
10
- lg: "max-w-screen-lg",
11
- xl: "max-w-screen-xl",
12
- "2xl": "max-w-screen-2xl",
13
- full: "max-w-full",
14
- },
15
- },
16
- defaultVariants: {
17
- size: "xl",
8
+ variants: {
9
+ size: {
10
+ sm: "max-w-screen-sm",
11
+ md: "max-w-screen-md",
12
+ lg: "max-w-screen-lg",
13
+ xl: "max-w-screen-xl",
14
+ "2xl": "max-w-screen-2xl",
15
+ full: "max-w-full",
18
16
  },
19
- })
17
+ },
18
+ defaultVariants: {
19
+ size: "xl",
20
+ },
21
+ });
20
22
 
21
23
  interface ContainerProps
22
- extends React.HTMLAttributes<HTMLDivElement>,
23
- VariantProps<typeof containerVariants> { }
24
+ extends
25
+ React.HTMLAttributes<HTMLDivElement>,
26
+ VariantProps<typeof containerVariants> {}
24
27
 
25
28
  /**
26
29
  * Container for max-width layouts
27
- *
30
+ *
28
31
  * @example
29
32
  * <Container size="lg">Content</Container>
30
33
  */
31
34
  const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
32
- ({ className, size, ...props }, ref) => {
33
- return (
34
- <div
35
- ref={ref}
36
- className={cn(containerVariants({ size }), className)}
37
- {...props}
38
- />
39
- )
40
- }
41
- )
42
- Container.displayName = "Container"
35
+ ({ className, size, ...props }, ref) => {
36
+ return (
37
+ <div
38
+ ref={ref}
39
+ className={cn(containerVariants({ size }), className)}
40
+ {...props}
41
+ />
42
+ );
43
+ },
44
+ );
45
+ Container.displayName = "Container";
43
46
 
44
- export { Container, containerVariants }
47
+ export { Container, containerVariants };
@@ -1,38 +1,40 @@
1
- import { cn } from "@/lib/utils"
1
+ "use client";
2
+
3
+ import { cn } from "@/lib/utils";
2
4
 
3
5
  interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
4
- icon?: React.ElementType
5
- title: string
6
- description: string
7
- action?: React.ReactNode
6
+ icon?: React.ElementType;
7
+ title: string;
8
+ description: string;
9
+ action?: React.ReactNode;
8
10
  }
9
11
 
10
12
  export function EmptyState({
11
- icon: Icon,
12
- title,
13
- description,
14
- action,
15
- className,
16
- ...props
13
+ icon: Icon,
14
+ title,
15
+ description,
16
+ action,
17
+ className,
18
+ ...props
17
19
  }: EmptyStateProps) {
18
- return (
19
- <div
20
- className={cn(
21
- "flex flex-col items-center justify-center py-12 text-center border-2 border-dashed rounded-lg bg-muted/5",
22
- className
23
- )}
24
- {...props}
25
- >
26
- {Icon && (
27
- <div className="flex h-20 w-20 items-center justify-center rounded-full bg-muted/50 mb-4">
28
- <Icon className="h-10 w-10 text-muted-foreground" />
29
- </div>
30
- )}
31
- <h3 className="text-lg font-semibold tracking-tight">{title}</h3>
32
- <p className="text-muted-foreground text-sm max-w-sm mt-2 mb-6">
33
- {description}
34
- </p>
35
- {action && <div>{action}</div>}
20
+ return (
21
+ <div
22
+ className={cn(
23
+ "flex flex-col items-center justify-center py-12 text-center border-2 border-dashed rounded-lg bg-muted/5",
24
+ className,
25
+ )}
26
+ {...props}
27
+ >
28
+ {Icon && (
29
+ <div className="flex h-20 w-20 items-center justify-center rounded-full bg-muted/50 mb-4">
30
+ <Icon className="h-10 w-10 text-muted-foreground" />
36
31
  </div>
37
- )
32
+ )}
33
+ <h3 className="text-lg font-semibold tracking-tight">{title}</h3>
34
+ <p className="text-muted-foreground text-sm max-w-sm mt-2 mb-6">
35
+ {description}
36
+ </p>
37
+ {action && <div>{action}</div>}
38
+ </div>
39
+ );
38
40
  }