@camox/ui 0.1.1-alpha.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.
- package/LICENSE.md +110 -0
- package/package.json +185 -0
- package/src/components/accordion.tsx +58 -0
- package/src/components/alert-dialog.tsx +133 -0
- package/src/components/alert.tsx +60 -0
- package/src/components/avatar.tsx +94 -0
- package/src/components/badge.tsx +39 -0
- package/src/components/breadcrumb.tsx +102 -0
- package/src/components/button-group.tsx +78 -0
- package/src/components/button.tsx +58 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/command.tsx +168 -0
- package/src/components/control-group.tsx +58 -0
- package/src/components/dialog.tsx +127 -0
- package/src/components/dropdown-menu.tsx +226 -0
- package/src/components/floating-toolbar.tsx +17 -0
- package/src/components/frame.tsx +146 -0
- package/src/components/input-base.tsx +189 -0
- package/src/components/input.tsx +21 -0
- package/src/components/kbd.tsx +28 -0
- package/src/components/label.tsx +21 -0
- package/src/components/panel.tsx +78 -0
- package/src/components/popover.tsx +40 -0
- package/src/components/resizable.tsx +46 -0
- package/src/components/select.tsx +169 -0
- package/src/components/separator.tsx +26 -0
- package/src/components/sheet.tsx +130 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/spinner.tsx +16 -0
- package/src/components/switch.tsx +26 -0
- package/src/components/tabs.tsx +52 -0
- package/src/components/textarea.tsx +20 -0
- package/src/components/toaster.tsx +22 -0
- package/src/components/toggle.tsx +45 -0
- package/src/components/tooltip.tsx +55 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/utils.ts +15 -0
- package/src/styles/globals.css +120 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
export const Panel = ({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
asChild = false,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<"section"> & {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
}) => {
|
|
14
|
+
const Comp = asChild ? Slot : "section";
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Comp
|
|
18
|
+
className={cn(
|
|
19
|
+
"flex flex-col bg-background border-2 border-border shadow-xl rounded-lg overflow-hidden",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</Comp>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const PanelHeader = ({
|
|
30
|
+
children,
|
|
31
|
+
className,
|
|
32
|
+
asChild = false,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<"header"> & {
|
|
35
|
+
asChild?: boolean;
|
|
36
|
+
}) => {
|
|
37
|
+
const Comp = asChild ? Slot : "header";
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Comp className={cn("p-4 border-b-2 border-border", className)} {...props}>
|
|
41
|
+
{children}
|
|
42
|
+
</Comp>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const PanelTitle = ({
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
asChild = false,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<"h3"> & {
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
}) => {
|
|
54
|
+
const Comp = asChild ? Slot : "h3";
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Comp className={cn("text-lg leading-none font-semibold", className)} {...props}>
|
|
58
|
+
{children}
|
|
59
|
+
</Comp>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const PanelContent = ({
|
|
64
|
+
children,
|
|
65
|
+
className,
|
|
66
|
+
asChild = false,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<"header"> & {
|
|
69
|
+
asChild?: boolean;
|
|
70
|
+
}) => {
|
|
71
|
+
const Comp = asChild ? Slot : "main";
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Comp className={cn("grow overflow-auto", className)} {...props}>
|
|
75
|
+
{children}
|
|
76
|
+
</Comp>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
7
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
11
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function PopoverContent({
|
|
15
|
+
className,
|
|
16
|
+
align = "center",
|
|
17
|
+
sideOffset = 4,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
20
|
+
return (
|
|
21
|
+
<PopoverPrimitive.Portal>
|
|
22
|
+
<PopoverPrimitive.Content
|
|
23
|
+
data-slot="popover-content"
|
|
24
|
+
align={align}
|
|
25
|
+
sideOffset={sideOffset}
|
|
26
|
+
className={cn(
|
|
27
|
+
"bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
</PopoverPrimitive.Portal>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
37
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Panel, PanelGroup, PanelResizer } from "@window-splitter/react";
|
|
2
|
+
import { GripVerticalIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
function ResizablePanelGroup({ className, ...props }: React.ComponentProps<typeof PanelGroup>) {
|
|
8
|
+
return (
|
|
9
|
+
<PanelGroup
|
|
10
|
+
data-slot="resizable-panel-group"
|
|
11
|
+
className={cn("h-full w-full data-[panel-group-direction=vertical]:flex-col", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function ResizablePanel({ ...props }: React.ComponentProps<typeof Panel>) {
|
|
18
|
+
return <Panel data-slot="resizable-panel" {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function ResizableHandle({
|
|
22
|
+
withHandle,
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof PanelResizer> & {
|
|
26
|
+
withHandle?: boolean;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<PanelResizer
|
|
30
|
+
data-slot="resizable-handle"
|
|
31
|
+
className={cn(
|
|
32
|
+
"bg-border ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{withHandle && (
|
|
38
|
+
<div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
|
|
39
|
+
<GripVerticalIcon className="size-2.5" />
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
</PanelResizer>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { INPUT_FOCUS_STYLES, cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
8
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
12
|
+
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
16
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SelectTrigger({
|
|
20
|
+
className,
|
|
21
|
+
size = "default",
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
25
|
+
size?: "sm" | "default";
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<SelectPrimitive.Trigger
|
|
29
|
+
data-slot="select-trigger"
|
|
30
|
+
data-size={size}
|
|
31
|
+
className={cn(
|
|
32
|
+
INPUT_FOCUS_STYLES,
|
|
33
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
<SelectPrimitive.Icon asChild>
|
|
40
|
+
<ChevronDownIcon className="size-4 opacity-50" />
|
|
41
|
+
</SelectPrimitive.Icon>
|
|
42
|
+
</SelectPrimitive.Trigger>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function SelectContent({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
position = "popper",
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
52
|
+
return (
|
|
53
|
+
<SelectPrimitive.Portal>
|
|
54
|
+
<SelectPrimitive.Content
|
|
55
|
+
data-slot="select-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
58
|
+
position === "popper" &&
|
|
59
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
60
|
+
className,
|
|
61
|
+
)}
|
|
62
|
+
position={position}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
<SelectScrollUpButton />
|
|
66
|
+
<SelectPrimitive.Viewport
|
|
67
|
+
className={cn(
|
|
68
|
+
"p-1",
|
|
69
|
+
position === "popper" &&
|
|
70
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
</SelectPrimitive.Viewport>
|
|
75
|
+
<SelectScrollDownButton />
|
|
76
|
+
</SelectPrimitive.Content>
|
|
77
|
+
</SelectPrimitive.Portal>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
82
|
+
return (
|
|
83
|
+
<SelectPrimitive.Label
|
|
84
|
+
data-slot="select-label"
|
|
85
|
+
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function SelectItem({
|
|
92
|
+
className,
|
|
93
|
+
children,
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
96
|
+
return (
|
|
97
|
+
<SelectPrimitive.Item
|
|
98
|
+
data-slot="select-item"
|
|
99
|
+
className={cn(
|
|
100
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
>
|
|
105
|
+
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
106
|
+
<SelectPrimitive.ItemIndicator>
|
|
107
|
+
<CheckIcon className="size-4" />
|
|
108
|
+
</SelectPrimitive.ItemIndicator>
|
|
109
|
+
</span>
|
|
110
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
111
|
+
</SelectPrimitive.Item>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function SelectSeparator({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
119
|
+
return (
|
|
120
|
+
<SelectPrimitive.Separator
|
|
121
|
+
data-slot="select-separator"
|
|
122
|
+
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function SelectScrollUpButton({
|
|
129
|
+
className,
|
|
130
|
+
...props
|
|
131
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
132
|
+
return (
|
|
133
|
+
<SelectPrimitive.ScrollUpButton
|
|
134
|
+
data-slot="select-scroll-up-button"
|
|
135
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
<ChevronUpIcon className="size-4" />
|
|
139
|
+
</SelectPrimitive.ScrollUpButton>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function SelectScrollDownButton({
|
|
144
|
+
className,
|
|
145
|
+
...props
|
|
146
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
147
|
+
return (
|
|
148
|
+
<SelectPrimitive.ScrollDownButton
|
|
149
|
+
data-slot="select-scroll-down-button"
|
|
150
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
151
|
+
{...props}
|
|
152
|
+
>
|
|
153
|
+
<ChevronDownIcon className="size-4" />
|
|
154
|
+
</SelectPrimitive.ScrollDownButton>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
Select,
|
|
160
|
+
SelectContent,
|
|
161
|
+
SelectGroup,
|
|
162
|
+
SelectItem,
|
|
163
|
+
SelectLabel,
|
|
164
|
+
SelectScrollDownButton,
|
|
165
|
+
SelectScrollUpButton,
|
|
166
|
+
SelectSeparator,
|
|
167
|
+
SelectTrigger,
|
|
168
|
+
SelectValue,
|
|
169
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
decorative = true,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
data-slot="separator"
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Separator };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import { XIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
8
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
12
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
16
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
20
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function SheetOverlay({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
27
|
+
return (
|
|
28
|
+
<SheetPrimitive.Overlay
|
|
29
|
+
data-slot="sheet-overlay"
|
|
30
|
+
className={cn(
|
|
31
|
+
"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",
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function SheetContent({
|
|
40
|
+
className,
|
|
41
|
+
children,
|
|
42
|
+
side = "right",
|
|
43
|
+
overlayClassName,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
46
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
47
|
+
overlayClassName?: string;
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<SheetPortal>
|
|
51
|
+
<SheetOverlay className={overlayClassName} />
|
|
52
|
+
<SheetPrimitive.Content
|
|
53
|
+
data-slot="sheet-content"
|
|
54
|
+
className={cn(
|
|
55
|
+
"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",
|
|
56
|
+
side === "right" &&
|
|
57
|
+
"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",
|
|
58
|
+
side === "left" &&
|
|
59
|
+
"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",
|
|
60
|
+
side === "top" &&
|
|
61
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
62
|
+
side === "bottom" &&
|
|
63
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
<SheetPrimitive.Close 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">
|
|
70
|
+
<XIcon className="size-4" />
|
|
71
|
+
<span className="sr-only">Close</span>
|
|
72
|
+
</SheetPrimitive.Close>
|
|
73
|
+
</SheetPrimitive.Content>
|
|
74
|
+
</SheetPortal>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
data-slot="sheet-header"
|
|
82
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
data-slot="sheet-footer"
|
|
92
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
99
|
+
return (
|
|
100
|
+
<SheetPrimitive.Title
|
|
101
|
+
data-slot="sheet-title"
|
|
102
|
+
className={cn("text-foreground font-semibold", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function SheetDescription({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
112
|
+
return (
|
|
113
|
+
<SheetPrimitive.Description
|
|
114
|
+
data-slot="sheet-description"
|
|
115
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
Sheet,
|
|
123
|
+
SheetTrigger,
|
|
124
|
+
SheetClose,
|
|
125
|
+
SheetContent,
|
|
126
|
+
SheetHeader,
|
|
127
|
+
SheetFooter,
|
|
128
|
+
SheetTitle,
|
|
129
|
+
SheetDescription,
|
|
130
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "../lib/utils";
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="skeleton"
|
|
7
|
+
className={cn("bg-accent animate-pulse rounded-md", className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Loader2Icon } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
|
6
|
+
return (
|
|
7
|
+
<Loader2Icon
|
|
8
|
+
role="status"
|
|
9
|
+
aria-label="Loading"
|
|
10
|
+
className={cn("size-4 animate-spin", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { Spinner };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
|
7
|
+
return (
|
|
8
|
+
<SwitchPrimitive.Root
|
|
9
|
+
data-slot="switch"
|
|
10
|
+
className={cn(
|
|
11
|
+
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<SwitchPrimitive.Thumb
|
|
17
|
+
data-slot="switch-thumb"
|
|
18
|
+
className={cn(
|
|
19
|
+
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
</SwitchPrimitive.Root>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Switch };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
7
|
+
return (
|
|
8
|
+
<TabsPrimitive.Root
|
|
9
|
+
data-slot="tabs"
|
|
10
|
+
className={cn("flex flex-col gap-2", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {
|
|
17
|
+
return (
|
|
18
|
+
<TabsPrimitive.List
|
|
19
|
+
data-slot="tabs-list"
|
|
20
|
+
className={cn(
|
|
21
|
+
"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
30
|
+
return (
|
|
31
|
+
<TabsPrimitive.Trigger
|
|
32
|
+
data-slot="tabs-trigger"
|
|
33
|
+
className={cn(
|
|
34
|
+
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
43
|
+
return (
|
|
44
|
+
<TabsPrimitive.Content
|
|
45
|
+
data-slot="tabs-content"
|
|
46
|
+
className={cn("flex-1 outline-none", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
6
|
+
return (
|
|
7
|
+
<textarea
|
|
8
|
+
data-slot="textarea"
|
|
9
|
+
className={cn(
|
|
10
|
+
INPUT_BASE_STYLES,
|
|
11
|
+
INPUT_FOCUS_STYLES,
|
|
12
|
+
"dark:bg-input/30 flex field-sizing-content min-h-16 w-full px-3 py-2",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Textarea };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToasterProps } from "sonner";
|
|
2
|
+
import { Toaster as Sonner, toast } from "sonner";
|
|
3
|
+
|
|
4
|
+
const Toaster = ({ theme = "system", ...props }: ToasterProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<Sonner
|
|
7
|
+
theme={theme as ToasterProps["theme"]}
|
|
8
|
+
className="toaster group"
|
|
9
|
+
style={
|
|
10
|
+
{
|
|
11
|
+
"--normal-bg": "var(--popover)",
|
|
12
|
+
"--normal-text": "var(--popover-foreground)",
|
|
13
|
+
"--normal-border": "var(--border)",
|
|
14
|
+
} as React.CSSProperties
|
|
15
|
+
}
|
|
16
|
+
position="top-center"
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { Toaster, toast };
|