@helloleo/plugins 0.1.20 → 0.2.0-beta.1
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.
- package/dist/index.js +12361 -58
- package/dist/templates/tanstack-start-2026-06-18/components.json +22 -0
- package/dist/templates/tanstack-start-2026-06-18/drizzle.config.ts +15 -0
- package/dist/templates/tanstack-start-2026-06-18/package.json +103 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +51 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +115 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +49 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +5 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +47 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +32 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +101 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +49 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +177 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +55 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +240 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +331 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +26 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +11 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +143 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +187 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +104 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +98 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +188 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +171 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +27 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +69 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +22 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +21 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +229 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +120 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +98 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +31 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +25 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +36 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +37 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +44 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +152 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +24 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +122 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +744 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +7 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +23 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +23 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +27 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +94 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +53 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +21 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +57 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +42 -0
- package/dist/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +32 -0
- package/dist/templates/tanstack-start-2026-06-18/src/db/index.ts +9 -0
- package/dist/templates/tanstack-start-2026-06-18/src/db/schema.ts +18 -0
- package/dist/templates/tanstack-start-2026-06-18/src/global.d.ts +3 -0
- package/dist/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +19 -0
- package/dist/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +83 -0
- package/dist/templates/tanstack-start-2026-06-18/src/lib/utils.ts +6 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +59 -0
- package/dist/templates/tanstack-start-2026-06-18/src/router.tsx +33 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +60 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routes/api/health.ts +81 -0
- package/dist/templates/tanstack-start-2026-06-18/src/routes/index.tsx +33 -0
- package/dist/templates/tanstack-start-2026-06-18/src/server.ts +32 -0
- package/dist/templates/tanstack-start-2026-06-18/src/styles.css +214 -0
- package/dist/templates/tanstack-start-2026-06-18/tsconfig.json +27 -0
- package/dist/templates/tanstack-start-2026-06-18/vite.config.ts +17 -0
- package/package.json +1 -1
- package/src/template-render.ts +5 -0
- package/src/templates/tanstack-start-2026-06-18/components.json +22 -0
- package/src/templates/tanstack-start-2026-06-18/drizzle.config.ts +15 -0
- package/src/templates/tanstack-start-2026-06-18/package.json +103 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/accordion.tsx +51 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert-dialog.tsx +115 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/alert.tsx +49 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/avatar.tsx +47 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/badge.tsx +32 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/breadcrumb.tsx +101 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/button.tsx +49 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/calendar.tsx +177 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/card.tsx +55 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/carousel.tsx +240 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/chart.tsx +331 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/checkbox.tsx +26 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/collapsible.tsx +11 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/command.tsx +143 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/context-menu.tsx +187 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/dialog.tsx +104 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/drawer.tsx +98 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/dropdown-menu.tsx +188 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/form.tsx +171 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/hover-card.tsx +27 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/input-otp.tsx +69 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/input.tsx +22 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/label.tsx +21 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/menubar.tsx +229 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/navigation-menu.tsx +120 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/pagination.tsx +98 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/popover.tsx +31 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/progress.tsx +25 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/radio-group.tsx +36 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/resizable.tsx +37 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/scroll-area.tsx +44 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/select.tsx +152 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/separator.tsx +24 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sheet.tsx +122 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sidebar.tsx +744 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/skeleton.tsx +7 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/slider.tsx +23 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/sonner.tsx +23 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/switch.tsx +27 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/table.tsx +94 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/tabs.tsx +53 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/textarea.tsx +21 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle-group.tsx +57 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/toggle.tsx +42 -0
- package/src/templates/tanstack-start-2026-06-18/src/components/ui/tooltip.tsx +32 -0
- package/src/templates/tanstack-start-2026-06-18/src/db/index.ts +9 -0
- package/src/templates/tanstack-start-2026-06-18/src/db/schema.ts +18 -0
- package/src/templates/tanstack-start-2026-06-18/src/global.d.ts +3 -0
- package/src/templates/tanstack-start-2026-06-18/src/hooks/use-mobile.tsx +19 -0
- package/src/templates/tanstack-start-2026-06-18/src/lib/proxy.ts +83 -0
- package/src/templates/tanstack-start-2026-06-18/src/lib/utils.ts +6 -0
- package/src/templates/tanstack-start-2026-06-18/src/routeTree.gen.ts +59 -0
- package/src/templates/tanstack-start-2026-06-18/src/router.tsx +33 -0
- package/src/templates/tanstack-start-2026-06-18/src/routes/__root.tsx +60 -0
- package/src/templates/tanstack-start-2026-06-18/src/routes/api/health.ts +81 -0
- package/src/templates/tanstack-start-2026-06-18/src/routes/index.tsx +33 -0
- package/src/templates/tanstack-start-2026-06-18/src/server.ts +32 -0
- package/src/templates/tanstack-start-2026-06-18/src/styles.css +214 -0
- package/src/templates/tanstack-start-2026-06-18/tsconfig.json +27 -0
- package/src/templates/tanstack-start-2026-06-18/vite.config.ts +17 -0
- package/src/tools/scaffold.ts +42 -43
- package/src/tools/setup-netsuite.ts +28 -58
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
5
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
|
|
9
|
+
const Select = SelectPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
12
|
+
|
|
13
|
+
const SelectValue = SelectPrimitive.Value;
|
|
14
|
+
|
|
15
|
+
const SelectTrigger = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
18
|
+
>(({ className, children, ...props }, ref) => (
|
|
19
|
+
<SelectPrimitive.Trigger
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn(
|
|
22
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background cursor-pointer data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
<SelectPrimitive.Icon asChild>
|
|
29
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
30
|
+
</SelectPrimitive.Icon>
|
|
31
|
+
</SelectPrimitive.Trigger>
|
|
32
|
+
));
|
|
33
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
34
|
+
|
|
35
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
37
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
38
|
+
>(({ className, ...props }, ref) => (
|
|
39
|
+
<SelectPrimitive.ScrollUpButton
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<ChevronUp className="h-4 w-4" />
|
|
45
|
+
</SelectPrimitive.ScrollUpButton>
|
|
46
|
+
));
|
|
47
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
48
|
+
|
|
49
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
50
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
51
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
52
|
+
>(({ className, ...props }, ref) => (
|
|
53
|
+
<SelectPrimitive.ScrollDownButton
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
<ChevronDown className="h-4 w-4" />
|
|
59
|
+
</SelectPrimitive.ScrollDownButton>
|
|
60
|
+
));
|
|
61
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
62
|
+
|
|
63
|
+
const SelectContent = React.forwardRef<
|
|
64
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
65
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
66
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
67
|
+
<SelectPrimitive.Portal>
|
|
68
|
+
<SelectPrimitive.Content
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn(
|
|
71
|
+
"relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",
|
|
72
|
+
position === "popper" &&
|
|
73
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
position={position}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<SelectScrollUpButton />
|
|
80
|
+
<SelectPrimitive.Viewport
|
|
81
|
+
className={cn(
|
|
82
|
+
"p-1",
|
|
83
|
+
position === "popper" &&
|
|
84
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</SelectPrimitive.Viewport>
|
|
89
|
+
<SelectScrollDownButton />
|
|
90
|
+
</SelectPrimitive.Content>
|
|
91
|
+
</SelectPrimitive.Portal>
|
|
92
|
+
));
|
|
93
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
94
|
+
|
|
95
|
+
const SelectLabel = React.forwardRef<
|
|
96
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
98
|
+
>(({ className, ...props }, ref) => (
|
|
99
|
+
<SelectPrimitive.Label
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
));
|
|
105
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
106
|
+
|
|
107
|
+
const SelectItem = React.forwardRef<
|
|
108
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
109
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
110
|
+
>(({ className, children, ...props }, ref) => (
|
|
111
|
+
<SelectPrimitive.Item
|
|
112
|
+
ref={ref}
|
|
113
|
+
className={cn(
|
|
114
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
120
|
+
<SelectPrimitive.ItemIndicator>
|
|
121
|
+
<Check className="h-4 w-4" />
|
|
122
|
+
</SelectPrimitive.ItemIndicator>
|
|
123
|
+
</span>
|
|
124
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
125
|
+
</SelectPrimitive.Item>
|
|
126
|
+
));
|
|
127
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
128
|
+
|
|
129
|
+
const SelectSeparator = React.forwardRef<
|
|
130
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
131
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
132
|
+
>(({ className, ...props }, ref) => (
|
|
133
|
+
<SelectPrimitive.Separator
|
|
134
|
+
ref={ref}
|
|
135
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
));
|
|
139
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
Select,
|
|
143
|
+
SelectGroup,
|
|
144
|
+
SelectValue,
|
|
145
|
+
SelectTrigger,
|
|
146
|
+
SelectContent,
|
|
147
|
+
SelectLabel,
|
|
148
|
+
SelectItem,
|
|
149
|
+
SelectSeparator,
|
|
150
|
+
SelectScrollUpButton,
|
|
151
|
+
SelectScrollDownButton,
|
|
152
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
10
|
+
<SeparatorPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
decorative={decorative}
|
|
13
|
+
orientation={orientation}
|
|
14
|
+
className={cn(
|
|
15
|
+
"shrink-0 bg-border",
|
|
16
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
));
|
|
22
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
23
|
+
|
|
24
|
+
export { Separator };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { X } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
import { cn } from "@/lib/utils";
|
|
9
|
+
|
|
10
|
+
const Sheet = SheetPrimitive.Root;
|
|
11
|
+
|
|
12
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
13
|
+
|
|
14
|
+
const SheetClose = SheetPrimitive.Close;
|
|
15
|
+
|
|
16
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
17
|
+
|
|
18
|
+
const SheetOverlay = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<SheetPrimitive.Overlay
|
|
23
|
+
className={cn(
|
|
24
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
ref={ref}
|
|
29
|
+
/>
|
|
30
|
+
));
|
|
31
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
32
|
+
|
|
33
|
+
const sheetVariants = cva(
|
|
34
|
+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
side: {
|
|
38
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
39
|
+
bottom:
|
|
40
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
41
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
42
|
+
right:
|
|
43
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
side: "right",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
interface SheetContentProps
|
|
53
|
+
extends
|
|
54
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
55
|
+
VariantProps<typeof sheetVariants> {}
|
|
56
|
+
|
|
57
|
+
const SheetContent = React.forwardRef<
|
|
58
|
+
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
59
|
+
SheetContentProps
|
|
60
|
+
>(({ side = "right", className, children, ...props }, ref) => (
|
|
61
|
+
<SheetPortal>
|
|
62
|
+
<SheetOverlay />
|
|
63
|
+
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
64
|
+
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
65
|
+
<X className="h-4 w-4" />
|
|
66
|
+
<span className="sr-only">Close</span>
|
|
67
|
+
</SheetPrimitive.Close>
|
|
68
|
+
{children}
|
|
69
|
+
</SheetPrimitive.Content>
|
|
70
|
+
</SheetPortal>
|
|
71
|
+
));
|
|
72
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
73
|
+
|
|
74
|
+
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
75
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
76
|
+
);
|
|
77
|
+
SheetHeader.displayName = "SheetHeader";
|
|
78
|
+
|
|
79
|
+
const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
80
|
+
<div
|
|
81
|
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
SheetFooter.displayName = "SheetFooter";
|
|
86
|
+
|
|
87
|
+
const SheetTitle = React.forwardRef<
|
|
88
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
89
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
90
|
+
>(({ className, ...props }, ref) => (
|
|
91
|
+
<SheetPrimitive.Title
|
|
92
|
+
ref={ref}
|
|
93
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
));
|
|
97
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
98
|
+
|
|
99
|
+
const SheetDescription = React.forwardRef<
|
|
100
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<SheetPrimitive.Description
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
));
|
|
109
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
Sheet,
|
|
113
|
+
SheetPortal,
|
|
114
|
+
SheetOverlay,
|
|
115
|
+
SheetTrigger,
|
|
116
|
+
SheetClose,
|
|
117
|
+
SheetContent,
|
|
118
|
+
SheetHeader,
|
|
119
|
+
SheetFooter,
|
|
120
|
+
SheetTitle,
|
|
121
|
+
SheetDescription,
|
|
122
|
+
};
|