@snapdragonsnursery/react-components 1.6.0 → 1.8.0

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.
@@ -0,0 +1,140 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SheetPrimitive from "@radix-ui/react-dialog"
5
+ import { XIcon } from "lucide-react"
6
+
7
+ import { cn } from "../../lib/utils"
8
+
9
+ function Sheet({
10
+ ...props
11
+ }) {
12
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
13
+ }
14
+
15
+ function SheetTrigger({
16
+ ...props
17
+ }) {
18
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
19
+ }
20
+
21
+ function SheetClose({
22
+ ...props
23
+ }) {
24
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
25
+ }
26
+
27
+ function SheetPortal({
28
+ ...props
29
+ }) {
30
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
31
+ }
32
+
33
+ function SheetOverlay({
34
+ className,
35
+ ...props
36
+ }) {
37
+ return (
38
+ <SheetPrimitive.Overlay
39
+ data-slot="sheet-overlay"
40
+ className={cn(
41
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
42
+ className
43
+ )}
44
+ {...props} />
45
+ );
46
+ }
47
+
48
+ function SheetContent({
49
+ className,
50
+ children,
51
+ side = "right",
52
+ ...props
53
+ }) {
54
+ return (
55
+ <SheetPortal>
56
+ <SheetOverlay />
57
+ <SheetPrimitive.Content
58
+ data-slot="sheet-content"
59
+ className={cn(
60
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
61
+ side === "right" &&
62
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
63
+ side === "left" &&
64
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
65
+ side === "top" &&
66
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
67
+ side === "bottom" &&
68
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
69
+ className
70
+ )}
71
+ {...props}>
72
+ {children}
73
+ <SheetPrimitive.Close
74
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
75
+ <XIcon className="size-4" />
76
+ <span className="sr-only">Close</span>
77
+ </SheetPrimitive.Close>
78
+ </SheetPrimitive.Content>
79
+ </SheetPortal>
80
+ );
81
+ }
82
+
83
+ function SheetHeader({
84
+ className,
85
+ ...props
86
+ }) {
87
+ return (
88
+ <div
89
+ data-slot="sheet-header"
90
+ className={cn("flex flex-col gap-1.5 p-4", className)}
91
+ {...props} />
92
+ );
93
+ }
94
+
95
+ function SheetFooter({
96
+ className,
97
+ ...props
98
+ }) {
99
+ return (
100
+ <div
101
+ data-slot="sheet-footer"
102
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
103
+ {...props} />
104
+ );
105
+ }
106
+
107
+ function SheetTitle({
108
+ className,
109
+ ...props
110
+ }) {
111
+ return (
112
+ <SheetPrimitive.Title
113
+ data-slot="sheet-title"
114
+ className={cn("text-foreground font-semibold", className)}
115
+ {...props} />
116
+ );
117
+ }
118
+
119
+ function SheetDescription({
120
+ className,
121
+ ...props
122
+ }) {
123
+ return (
124
+ <SheetPrimitive.Description
125
+ data-slot="sheet-description"
126
+ className={cn("text-muted-foreground text-sm", className)}
127
+ {...props} />
128
+ );
129
+ }
130
+
131
+ export {
132
+ Sheet,
133
+ SheetTrigger,
134
+ SheetClose,
135
+ SheetContent,
136
+ SheetHeader,
137
+ SheetFooter,
138
+ SheetTitle,
139
+ SheetDescription,
140
+ }