@brightweblabs/ui 0.1.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/package.json +42 -0
- package/src/components/alert-dialog.tsx +144 -0
- package/src/components/badge.tsx +48 -0
- package/src/components/breadcrumb.tsx +109 -0
- package/src/components/button.tsx +64 -0
- package/src/components/calendar.tsx +220 -0
- package/src/components/card.tsx +68 -0
- package/src/components/chart.tsx +381 -0
- package/src/components/dropdown-menu.tsx +257 -0
- package/src/components/field.tsx +248 -0
- package/src/components/input.tsx +21 -0
- package/src/components/label.tsx +24 -0
- package/src/components/pagination.tsx +117 -0
- package/src/components/password-input.tsx +69 -0
- package/src/components/password-strength.tsx +88 -0
- package/src/components/popover.tsx +89 -0
- package/src/components/separator.tsx +28 -0
- package/src/components/sheet.tsx +143 -0
- package/src/components/sonner.tsx +47 -0
- package/src/components/table.tsx +72 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/index.ts +29 -0
- package/src/lib/utils.ts +6 -0
|
@@ -0,0 +1,143 @@
|
|
|
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({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
16
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetClose({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
22
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetPortal({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
28
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function SheetOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<SheetPrimitive.Overlay
|
|
37
|
+
data-slot="sheet-overlay"
|
|
38
|
+
className={cn(
|
|
39
|
+
"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",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SheetContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
side = "right",
|
|
51
|
+
showCloseButton = true,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
54
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
55
|
+
showCloseButton?: boolean
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<SheetPortal>
|
|
59
|
+
<SheetOverlay />
|
|
60
|
+
<SheetPrimitive.Content
|
|
61
|
+
data-slot="sheet-content"
|
|
62
|
+
className={cn(
|
|
63
|
+
"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",
|
|
64
|
+
side === "right" &&
|
|
65
|
+
"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",
|
|
66
|
+
side === "left" &&
|
|
67
|
+
"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",
|
|
68
|
+
side === "top" &&
|
|
69
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
70
|
+
side === "bottom" &&
|
|
71
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
{showCloseButton && (
|
|
78
|
+
<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">
|
|
79
|
+
<XIcon className="size-4" />
|
|
80
|
+
<span className="sr-only">Close</span>
|
|
81
|
+
</SheetPrimitive.Close>
|
|
82
|
+
)}
|
|
83
|
+
</SheetPrimitive.Content>
|
|
84
|
+
</SheetPortal>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
data-slot="sheet-header"
|
|
92
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
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
|
+
|
|
108
|
+
function SheetTitle({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
112
|
+
return (
|
|
113
|
+
<SheetPrimitive.Title
|
|
114
|
+
data-slot="sheet-title"
|
|
115
|
+
className={cn("text-foreground font-semibold", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function SheetDescription({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
125
|
+
return (
|
|
126
|
+
<SheetPrimitive.Description
|
|
127
|
+
data-slot="sheet-description"
|
|
128
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export {
|
|
135
|
+
Sheet,
|
|
136
|
+
SheetTrigger,
|
|
137
|
+
SheetClose,
|
|
138
|
+
SheetContent,
|
|
139
|
+
SheetHeader,
|
|
140
|
+
SheetFooter,
|
|
141
|
+
SheetTitle,
|
|
142
|
+
SheetDescription,
|
|
143
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
|
|
4
|
+
import { useTheme } from "next-themes";
|
|
5
|
+
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
|
6
|
+
|
|
7
|
+
const Toaster = ({ ...props }: ToasterProps) => {
|
|
8
|
+
const { theme = "system" } = useTheme();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Sonner
|
|
12
|
+
theme={theme as ToasterProps["theme"]}
|
|
13
|
+
richColors
|
|
14
|
+
className="toaster group"
|
|
15
|
+
icons={{
|
|
16
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
17
|
+
info: <InfoIcon className="size-4" />,
|
|
18
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
19
|
+
error: <OctagonXIcon className="size-4" />,
|
|
20
|
+
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
21
|
+
}}
|
|
22
|
+
style={
|
|
23
|
+
{
|
|
24
|
+
"--normal-bg": "var(--popover)",
|
|
25
|
+
"--normal-text": "var(--popover-foreground)",
|
|
26
|
+
"--normal-border": "var(--border)",
|
|
27
|
+
"--success-bg": "color-mix(in srgb, var(--primary) 12%, var(--background))",
|
|
28
|
+
"--success-text": "var(--primary)",
|
|
29
|
+
"--success-border": "color-mix(in srgb, var(--primary) 30%, var(--background))",
|
|
30
|
+
"--warning-bg": "color-mix(in srgb, var(--accent) 12%, var(--background))",
|
|
31
|
+
"--warning-text": "color-mix(in srgb, var(--accent) 80%, var(--foreground))",
|
|
32
|
+
"--warning-border": "color-mix(in srgb, var(--accent) 30%, var(--background))",
|
|
33
|
+
"--error-bg": "color-mix(in srgb, var(--destructive) 12%, var(--background))",
|
|
34
|
+
"--error-text": "var(--destructive)",
|
|
35
|
+
"--error-border": "color-mix(in srgb, var(--destructive) 30%, var(--background))",
|
|
36
|
+
"--info-bg": "color-mix(in srgb, var(--secondary) 15%, var(--background))",
|
|
37
|
+
"--info-text": "color-mix(in srgb, var(--secondary) 70%, var(--foreground))",
|
|
38
|
+
"--info-border": "color-mix(in srgb, var(--secondary) 30%, var(--background))",
|
|
39
|
+
"--border-radius": "var(--radius)",
|
|
40
|
+
} as React.CSSProperties
|
|
41
|
+
}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { Toaster };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
|
|
6
|
+
({ className, ...props }, ref) => (
|
|
7
|
+
<div className="w-full overflow-auto">
|
|
8
|
+
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />
|
|
9
|
+
</div>
|
|
10
|
+
),
|
|
11
|
+
);
|
|
12
|
+
Table.displayName = "Table";
|
|
13
|
+
|
|
14
|
+
const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
15
|
+
({ className, ...props }, ref) => <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />,
|
|
16
|
+
);
|
|
17
|
+
TableHeader.displayName = "TableHeader";
|
|
18
|
+
|
|
19
|
+
const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
20
|
+
({ className, ...props }, ref) => (
|
|
21
|
+
<tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
TableBody.displayName = "TableBody";
|
|
25
|
+
|
|
26
|
+
const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
|
|
27
|
+
({ className, ...props }, ref) => (
|
|
28
|
+
<tfoot ref={ref} className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
TableFooter.displayName = "TableFooter";
|
|
32
|
+
|
|
33
|
+
const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
|
|
34
|
+
({ className, ...props }, ref) => (
|
|
35
|
+
<tr
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
TableRow.displayName = "TableRow";
|
|
43
|
+
|
|
44
|
+
const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(
|
|
45
|
+
({ className, ...props }, ref) => (
|
|
46
|
+
<th
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn(
|
|
49
|
+
"h-12 px-4 text-left align-middle text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
TableHead.displayName = "TableHead";
|
|
57
|
+
|
|
58
|
+
const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
|
|
59
|
+
({ className, ...props }, ref) => (
|
|
60
|
+
<td ref={ref} className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} />
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
TableCell.displayName = "TableCell";
|
|
64
|
+
|
|
65
|
+
const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
|
|
66
|
+
({ className, ...props }, ref) => (
|
|
67
|
+
<caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
TableCaption.displayName = "TableCaption";
|
|
71
|
+
|
|
72
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils"
|
|
7
|
+
|
|
8
|
+
function TooltipProvider({
|
|
9
|
+
delayDuration = 120,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
12
|
+
return (
|
|
13
|
+
<TooltipPrimitive.Provider
|
|
14
|
+
data-slot="tooltip-provider"
|
|
15
|
+
delayDuration={delayDuration}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Tooltip({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
24
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function TooltipTrigger({
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
30
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function TooltipContent({
|
|
34
|
+
className,
|
|
35
|
+
sideOffset = 10,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
38
|
+
return (
|
|
39
|
+
<TooltipPrimitive.Portal>
|
|
40
|
+
<TooltipPrimitive.Content
|
|
41
|
+
data-slot="tooltip-content"
|
|
42
|
+
sideOffset={sideOffset}
|
|
43
|
+
className={cn(
|
|
44
|
+
"z-[1300] overflow-hidden rounded-xl border border-black/12 bg-white/95 px-2.5 py-1.5 text-xs font-medium text-foreground/90 shadow-[0_14px_34px_rgba(8,24,16,0.12)] backdrop-blur-xl data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:border-white/12 dark:bg-black/70 dark:text-foreground",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
</TooltipPrimitive.Portal>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { Button, buttonVariants } from "./components/button";
|
|
2
|
+
export { Badge } from "./components/badge";
|
|
3
|
+
export * from "./components/dropdown-menu";
|
|
4
|
+
export {
|
|
5
|
+
Field,
|
|
6
|
+
FieldContent,
|
|
7
|
+
FieldDescription,
|
|
8
|
+
FieldError,
|
|
9
|
+
FieldGroup,
|
|
10
|
+
FieldLabel,
|
|
11
|
+
FieldLegend,
|
|
12
|
+
FieldSet,
|
|
13
|
+
} from "./components/field";
|
|
14
|
+
export { Input } from "./components/input";
|
|
15
|
+
export { PasswordInput } from "./components/password-input";
|
|
16
|
+
export { PasswordStrength } from "./components/password-strength";
|
|
17
|
+
export { Separator } from "./components/separator";
|
|
18
|
+
export * from "./components/alert-dialog";
|
|
19
|
+
export * from "./components/card";
|
|
20
|
+
export * from "./components/chart";
|
|
21
|
+
export * from "./components/breadcrumb";
|
|
22
|
+
export * from "./components/calendar";
|
|
23
|
+
export { Label } from "./components/label";
|
|
24
|
+
export * from "./components/pagination";
|
|
25
|
+
export * from "./components/popover";
|
|
26
|
+
export * from "./components/sheet";
|
|
27
|
+
export * from "./components/table";
|
|
28
|
+
export { Toaster } from "./components/sonner";
|
|
29
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip";
|