shadcn-packaged 2025.2.17 → 2025.3.3
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/index.d.ts +0 -3
- package/package.json +5 -6
- package/ui/dialog.jsx +1 -1
- package/ui/form.jsx +1 -1
- package/ui/select.jsx +1 -1
- package/ui/sidebar.jsx +13 -9
- package/hooks/use-toast.d.ts +0 -44
- package/hooks/use-toast.js +0 -128
- package/ui/toast.d.ts +0 -15
- package/ui/toast.jsx +0 -35
- package/ui/toaster.d.ts +0 -1
- package/ui/toaster.jsx +0 -19
package/index.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
/// <reference path="./hooks/use-mobile.d.ts" />;
|
2
|
-
/// <reference path="./hooks/use-toast.d.ts" />;
|
3
2
|
/// <reference path="./lib/utils.d.ts" />;
|
4
3
|
/// <reference path="./ui/accordion.d.ts" />;
|
5
4
|
/// <reference path="./ui/alert-dialog.d.ts" />;
|
@@ -44,8 +43,6 @@
|
|
44
43
|
/// <reference path="./ui/table.d.ts" />;
|
45
44
|
/// <reference path="./ui/tabs.d.ts" />;
|
46
45
|
/// <reference path="./ui/textarea.d.ts" />;
|
47
|
-
/// <reference path="./ui/toast.d.ts" />;
|
48
|
-
/// <reference path="./ui/toaster.d.ts" />;
|
49
46
|
/// <reference path="./ui/toggle-group.d.ts" />;
|
50
47
|
/// <reference path="./ui/toggle.d.ts" />;
|
51
48
|
/// <reference path="./ui/tooltip.d.ts" />;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "shadcn-packaged",
|
3
3
|
"private": false,
|
4
|
-
"version": "2025.
|
4
|
+
"version": "2025.3.3",
|
5
5
|
"type": "module",
|
6
6
|
"module": "index.mjs",
|
7
7
|
"scripts": {
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"index.mjs"
|
25
25
|
],
|
26
26
|
"dependencies": {
|
27
|
-
"@hookform/resolvers": "^4.1.
|
27
|
+
"@hookform/resolvers": "^4.1.2",
|
28
28
|
"@radix-ui/react-accordion": "^1.2.3",
|
29
29
|
"@radix-ui/react-alert-dialog": "^1.1.6",
|
30
30
|
"@radix-ui/react-aspect-ratio": "^1.1.2",
|
@@ -48,7 +48,6 @@
|
|
48
48
|
"@radix-ui/react-slot": "^1.1.2",
|
49
49
|
"@radix-ui/react-switch": "^1.1.3",
|
50
50
|
"@radix-ui/react-tabs": "^1.1.3",
|
51
|
-
"@radix-ui/react-toast": "^1.2.6",
|
52
51
|
"@radix-ui/react-toggle": "^1.1.2",
|
53
52
|
"@radix-ui/react-toggle-group": "^1.1.2",
|
54
53
|
"@radix-ui/react-tooltip": "^1.1.8",
|
@@ -61,7 +60,7 @@
|
|
61
60
|
"react-hook-form": "^7.54.2",
|
62
61
|
"react-resizable-panels": "^2.1.7",
|
63
62
|
"recharts": "^2.15.1",
|
64
|
-
"sonner": "^
|
63
|
+
"sonner": "^2.0.1",
|
65
64
|
"vaul": "^1.1.2",
|
66
65
|
"zod": "^3.24.2"
|
67
66
|
},
|
@@ -72,8 +71,8 @@
|
|
72
71
|
"class-variance-authority": "^0.7.1",
|
73
72
|
"clsx": "^2.1.1",
|
74
73
|
"globals": "^15.14.0",
|
75
|
-
"lucide-react": "^0.
|
76
|
-
"tailwind-merge": "^3.0.
|
74
|
+
"lucide-react": "^0.477.0",
|
75
|
+
"tailwind-merge": "^3.0.2",
|
77
76
|
"tailwindcss": "^3.4.17",
|
78
77
|
"tailwindcss-animate": "^1.0.7",
|
79
78
|
"typescript": "~5.6.2"
|
package/ui/dialog.jsx
CHANGED
@@ -7,7 +7,7 @@ const Dialog = DialogPrimitive.Root;
|
|
7
7
|
const DialogTrigger = DialogPrimitive.Trigger;
|
8
8
|
const DialogPortal = DialogPrimitive.Portal;
|
9
9
|
const DialogClose = DialogPrimitive.Close;
|
10
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (<DialogPrimitive.Overlay ref={ref} className={cn("fixed inset-0 z-50 bg-black/80
|
10
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (<DialogPrimitive.Overlay ref={ref} className={cn("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", className)} {...props}/>));
|
11
11
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
12
12
|
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (<DialogPortal>
|
13
13
|
<DialogOverlay />
|
package/ui/form.jsx
CHANGED
@@ -56,7 +56,7 @@ const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
56
56
|
FormDescription.displayName = "FormDescription";
|
57
57
|
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
58
58
|
const { error, formMessageId } = useFormField();
|
59
|
-
const body = error ? String(error?.message) : children;
|
59
|
+
const body = error ? String(error?.message ?? "") : children;
|
60
60
|
if (!body) {
|
61
61
|
return null;
|
62
62
|
}
|
package/ui/select.jsx
CHANGED
@@ -6,7 +6,7 @@ import { cn } from "../lib/utils";
|
|
6
6
|
const Select = SelectPrimitive.Root;
|
7
7
|
const SelectGroup = SelectPrimitive.Group;
|
8
8
|
const SelectValue = SelectPrimitive.Value;
|
9
|
-
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (<SelectPrimitive.Trigger ref={ref} className={cn("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className)} {...props}>
|
9
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (<SelectPrimitive.Trigger ref={ref} className={cn("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className)} {...props}>
|
10
10
|
{children}
|
11
11
|
<SelectPrimitive.Icon asChild>
|
12
12
|
<ChevronDown className="h-4 w-4 opacity-50"/>
|
package/ui/sidebar.jsx
CHANGED
@@ -8,7 +8,7 @@ import { cn } from "../lib/utils";
|
|
8
8
|
import { Button } from "../ui/button";
|
9
9
|
import { Input } from "../ui/input";
|
10
10
|
import { Separator } from "../ui/separator";
|
11
|
-
import { Sheet, SheetContent } from "../ui/sheet";
|
11
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "../ui/sheet";
|
12
12
|
import { Skeleton } from "../ui/skeleton";
|
13
13
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip";
|
14
14
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
@@ -98,16 +98,20 @@ const Sidebar = React.forwardRef(({ side = "left", variant = "sidebar", collapsi
|
|
98
98
|
<SheetContent data-sidebar="sidebar" data-mobile="true" className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden" style={{
|
99
99
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
100
100
|
}} side={side}>
|
101
|
+
<SheetHeader className="sr-only">
|
102
|
+
<SheetTitle>Sidebar</SheetTitle>
|
103
|
+
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
104
|
+
</SheetHeader>
|
101
105
|
<div className="flex h-full w-full flex-col">{children}</div>
|
102
106
|
</SheetContent>
|
103
107
|
</Sheet>);
|
104
108
|
}
|
105
|
-
return (<div ref={ref} className="group peer hidden
|
109
|
+
return (<div ref={ref} className="group peer hidden text-sidebar-foreground md:block" data-state={state} data-collapsible={state === "collapsed" ? collapsible : ""} data-variant={variant} data-side={side}>
|
106
110
|
{/* This is what handles the sidebar gap on desktop */}
|
107
|
-
<div className={cn("
|
111
|
+
<div className={cn("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
|
108
112
|
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
109
113
|
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}/>
|
110
|
-
<div className={cn("
|
114
|
+
<div className={cn("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
|
111
115
|
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
112
116
|
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
113
117
|
// Adjust the padding for floating and inset variants.
|
@@ -138,7 +142,7 @@ const SidebarRail = React.forwardRef(({ className, ...props }, ref) => {
|
|
138
142
|
});
|
139
143
|
SidebarRail.displayName = "SidebarRail";
|
140
144
|
const SidebarInset = React.forwardRef(({ className, ...props }, ref) => {
|
141
|
-
return (<main ref={ref} className={cn("relative flex
|
145
|
+
return (<main ref={ref} className={cn("relative flex w-full flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow", className)} {...props}/>);
|
142
146
|
});
|
143
147
|
SidebarInset.displayName = "SidebarInset";
|
144
148
|
const SidebarInput = React.forwardRef(({ className, ...props }, ref) => {
|
@@ -167,7 +171,7 @@ const SidebarGroup = React.forwardRef(({ className, ...props }, ref) => {
|
|
167
171
|
SidebarGroup.displayName = "SidebarGroup";
|
168
172
|
const SidebarGroupLabel = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
169
173
|
const Comp = asChild ? Slot : "div";
|
170
|
-
return (<Comp ref={ref} data-sidebar="group-label" className={cn("
|
174
|
+
return (<Comp ref={ref} data-sidebar="group-label" className={cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className)} {...props}/>);
|
171
175
|
});
|
172
176
|
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
173
177
|
const SidebarGroupAction = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
@@ -226,16 +230,16 @@ const SidebarMenuAction = React.forwardRef(({ className, asChild = false, showOn
|
|
226
230
|
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0", className)} {...props}/>);
|
227
231
|
});
|
228
232
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
229
|
-
const SidebarMenuBadge = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} data-sidebar="menu-badge" className={cn("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground
|
233
|
+
const SidebarMenuBadge = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} data-sidebar="menu-badge" className={cn("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className)} {...props}/>));
|
230
234
|
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
231
235
|
const SidebarMenuSkeleton = React.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
232
236
|
// Random width between 50 to 90%.
|
233
237
|
const width = React.useMemo(() => {
|
234
238
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
235
239
|
}, []);
|
236
|
-
return (<div ref={ref} data-sidebar="menu-skeleton" className={cn("
|
240
|
+
return (<div ref={ref} data-sidebar="menu-skeleton" className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)} {...props}>
|
237
241
|
{showIcon && (<Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon"/>)}
|
238
|
-
<Skeleton className="h-4
|
242
|
+
<Skeleton className="h-4 max-w-[--skeleton-width] flex-1" data-sidebar="menu-skeleton-text" style={{
|
239
243
|
"--skeleton-width": width,
|
240
244
|
}}/>
|
241
245
|
</div>);
|
package/hooks/use-toast.d.ts
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import type { ToastActionElement, ToastProps } from "../ui/toast";
|
3
|
-
type ToasterToast = ToastProps & {
|
4
|
-
id: string;
|
5
|
-
title?: React.ReactNode;
|
6
|
-
description?: React.ReactNode;
|
7
|
-
action?: ToastActionElement;
|
8
|
-
};
|
9
|
-
declare const actionTypes: {
|
10
|
-
readonly ADD_TOAST: "ADD_TOAST";
|
11
|
-
readonly UPDATE_TOAST: "UPDATE_TOAST";
|
12
|
-
readonly DISMISS_TOAST: "DISMISS_TOAST";
|
13
|
-
readonly REMOVE_TOAST: "REMOVE_TOAST";
|
14
|
-
};
|
15
|
-
type ActionType = typeof actionTypes;
|
16
|
-
type Action = {
|
17
|
-
type: ActionType["ADD_TOAST"];
|
18
|
-
toast: ToasterToast;
|
19
|
-
} | {
|
20
|
-
type: ActionType["UPDATE_TOAST"];
|
21
|
-
toast: Partial<ToasterToast>;
|
22
|
-
} | {
|
23
|
-
type: ActionType["DISMISS_TOAST"];
|
24
|
-
toastId?: ToasterToast["id"];
|
25
|
-
} | {
|
26
|
-
type: ActionType["REMOVE_TOAST"];
|
27
|
-
toastId?: ToasterToast["id"];
|
28
|
-
};
|
29
|
-
interface State {
|
30
|
-
toasts: ToasterToast[];
|
31
|
-
}
|
32
|
-
export declare const reducer: (state: State, action: Action) => State;
|
33
|
-
type Toast = Omit<ToasterToast, "id">;
|
34
|
-
declare function toast({ ...props }: Toast): {
|
35
|
-
id: string;
|
36
|
-
dismiss: () => void;
|
37
|
-
update: (props: ToasterToast) => void;
|
38
|
-
};
|
39
|
-
declare function useToast(): {
|
40
|
-
toast: typeof toast;
|
41
|
-
dismiss: (toastId?: string) => void;
|
42
|
-
toasts: ToasterToast[];
|
43
|
-
};
|
44
|
-
export { useToast, toast };
|
package/hooks/use-toast.js
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
// Inspired by react-hot-toast library
|
3
|
-
import * as React from "react";
|
4
|
-
const TOAST_LIMIT = 1;
|
5
|
-
const TOAST_REMOVE_DELAY = 1000000;
|
6
|
-
const actionTypes = {
|
7
|
-
ADD_TOAST: "ADD_TOAST",
|
8
|
-
UPDATE_TOAST: "UPDATE_TOAST",
|
9
|
-
DISMISS_TOAST: "DISMISS_TOAST",
|
10
|
-
REMOVE_TOAST: "REMOVE_TOAST",
|
11
|
-
};
|
12
|
-
let count = 0;
|
13
|
-
function genId() {
|
14
|
-
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
15
|
-
return count.toString();
|
16
|
-
}
|
17
|
-
const toastTimeouts = new Map();
|
18
|
-
const addToRemoveQueue = (toastId) => {
|
19
|
-
if (toastTimeouts.has(toastId)) {
|
20
|
-
return;
|
21
|
-
}
|
22
|
-
const timeout = setTimeout(() => {
|
23
|
-
toastTimeouts.delete(toastId);
|
24
|
-
dispatch({
|
25
|
-
type: "REMOVE_TOAST",
|
26
|
-
toastId: toastId,
|
27
|
-
});
|
28
|
-
}, TOAST_REMOVE_DELAY);
|
29
|
-
toastTimeouts.set(toastId, timeout);
|
30
|
-
};
|
31
|
-
export const reducer = (state, action) => {
|
32
|
-
switch (action.type) {
|
33
|
-
case "ADD_TOAST":
|
34
|
-
return {
|
35
|
-
...state,
|
36
|
-
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
37
|
-
};
|
38
|
-
case "UPDATE_TOAST":
|
39
|
-
return {
|
40
|
-
...state,
|
41
|
-
toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t),
|
42
|
-
};
|
43
|
-
case "DISMISS_TOAST": {
|
44
|
-
const { toastId } = action;
|
45
|
-
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
46
|
-
// but I'll keep it here for simplicity
|
47
|
-
if (toastId) {
|
48
|
-
addToRemoveQueue(toastId);
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
state.toasts.forEach((toast) => {
|
52
|
-
addToRemoveQueue(toast.id);
|
53
|
-
});
|
54
|
-
}
|
55
|
-
return {
|
56
|
-
...state,
|
57
|
-
toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
58
|
-
? {
|
59
|
-
...t,
|
60
|
-
open: false,
|
61
|
-
}
|
62
|
-
: t),
|
63
|
-
};
|
64
|
-
}
|
65
|
-
case "REMOVE_TOAST":
|
66
|
-
if (action.toastId === undefined) {
|
67
|
-
return {
|
68
|
-
...state,
|
69
|
-
toasts: [],
|
70
|
-
};
|
71
|
-
}
|
72
|
-
return {
|
73
|
-
...state,
|
74
|
-
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
75
|
-
};
|
76
|
-
}
|
77
|
-
};
|
78
|
-
const listeners = [];
|
79
|
-
let memoryState = { toasts: [] };
|
80
|
-
function dispatch(action) {
|
81
|
-
memoryState = reducer(memoryState, action);
|
82
|
-
listeners.forEach((listener) => {
|
83
|
-
listener(memoryState);
|
84
|
-
});
|
85
|
-
}
|
86
|
-
function toast({ ...props }) {
|
87
|
-
const id = genId();
|
88
|
-
const update = (props) => dispatch({
|
89
|
-
type: "UPDATE_TOAST",
|
90
|
-
toast: { ...props, id },
|
91
|
-
});
|
92
|
-
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
93
|
-
dispatch({
|
94
|
-
type: "ADD_TOAST",
|
95
|
-
toast: {
|
96
|
-
...props,
|
97
|
-
id,
|
98
|
-
open: true,
|
99
|
-
onOpenChange: (open) => {
|
100
|
-
if (!open)
|
101
|
-
dismiss();
|
102
|
-
},
|
103
|
-
},
|
104
|
-
});
|
105
|
-
return {
|
106
|
-
id: id,
|
107
|
-
dismiss,
|
108
|
-
update,
|
109
|
-
};
|
110
|
-
}
|
111
|
-
function useToast() {
|
112
|
-
const [state, setState] = React.useState(memoryState);
|
113
|
-
React.useEffect(() => {
|
114
|
-
listeners.push(setState);
|
115
|
-
return () => {
|
116
|
-
const index = listeners.indexOf(setState);
|
117
|
-
if (index > -1) {
|
118
|
-
listeners.splice(index, 1);
|
119
|
-
}
|
120
|
-
};
|
121
|
-
}, [state]);
|
122
|
-
return {
|
123
|
-
...state,
|
124
|
-
toast,
|
125
|
-
dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
126
|
-
};
|
127
|
-
}
|
128
|
-
export { useToast, toast };
|
package/ui/toast.d.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
3
|
-
import { type VariantProps } from "class-variance-authority";
|
4
|
-
declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
|
5
|
-
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
6
|
-
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: {
|
7
|
-
variant?: "default" | "destructive";
|
8
|
-
} & import("class-variance-authority/dist/types").ClassProp) => string> & React.RefAttributes<HTMLLIElement>>;
|
9
|
-
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
10
|
-
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
11
|
-
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
12
|
-
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
13
|
-
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
14
|
-
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
15
|
-
export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
package/ui/toast.jsx
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import * as React from "react";
|
3
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
4
|
-
import { cva } from "class-variance-authority";
|
5
|
-
import { X } from "lucide-react";
|
6
|
-
import { cn } from "../lib/utils";
|
7
|
-
const ToastProvider = ToastPrimitives.Provider;
|
8
|
-
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => (<ToastPrimitives.Viewport ref={ref} className={cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]", className)} {...props}/>));
|
9
|
-
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
10
|
-
const toastVariants = cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", {
|
11
|
-
variants: {
|
12
|
-
variant: {
|
13
|
-
default: "border bg-background text-foreground",
|
14
|
-
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground",
|
15
|
-
},
|
16
|
-
},
|
17
|
-
defaultVariants: {
|
18
|
-
variant: "default",
|
19
|
-
},
|
20
|
-
});
|
21
|
-
const Toast = React.forwardRef(({ className, variant, ...props }, ref) => {
|
22
|
-
return (<ToastPrimitives.Root ref={ref} className={cn(toastVariants({ variant }), className)} {...props}/>);
|
23
|
-
});
|
24
|
-
Toast.displayName = ToastPrimitives.Root.displayName;
|
25
|
-
const ToastAction = React.forwardRef(({ className, ...props }, ref) => (<ToastPrimitives.Action ref={ref} className={cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className)} {...props}/>));
|
26
|
-
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
27
|
-
const ToastClose = React.forwardRef(({ className, ...props }, ref) => (<ToastPrimitives.Close ref={ref} className={cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className)} toast-close="" {...props}>
|
28
|
-
<X className="h-4 w-4"/>
|
29
|
-
</ToastPrimitives.Close>));
|
30
|
-
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
31
|
-
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => (<ToastPrimitives.Title ref={ref} className={cn("text-sm font-semibold", className)} {...props}/>));
|
32
|
-
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
33
|
-
const ToastDescription = React.forwardRef(({ className, ...props }, ref) => (<ToastPrimitives.Description ref={ref} className={cn("text-sm opacity-90", className)} {...props}/>));
|
34
|
-
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
35
|
-
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
package/ui/toaster.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export declare function Toaster(): import("react").JSX.Element;
|
package/ui/toaster.jsx
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import { useToast } from "../hooks/use-toast";
|
3
|
-
import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from "../ui/toast";
|
4
|
-
export function Toaster() {
|
5
|
-
const { toasts } = useToast();
|
6
|
-
return (<ToastProvider>
|
7
|
-
{toasts.map(function ({ id, title, description, action, ...props }) {
|
8
|
-
return (<Toast key={id} {...props}>
|
9
|
-
<div className="grid gap-1">
|
10
|
-
{title && <ToastTitle>{title}</ToastTitle>}
|
11
|
-
{description && (<ToastDescription>{description}</ToastDescription>)}
|
12
|
-
</div>
|
13
|
-
{action}
|
14
|
-
<ToastClose />
|
15
|
-
</Toast>);
|
16
|
-
})}
|
17
|
-
<ToastViewport />
|
18
|
-
</ToastProvider>);
|
19
|
-
}
|