@moontra/moonui-pro 2.20.1 → 2.20.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/dist/index.d.ts +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -462
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -76
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -516
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1684
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -865
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1148
- package/src/components/ui/accordion.tsx +0 -73
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -190
- package/src/components/ui/input.tsx +0 -222
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -612
- package/src/components/ui/pagination.tsx +0 -123
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -374
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -329
- package/src/components/ui/tabs.tsx +0 -198
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -14
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
-
import { X } from "lucide-react";
|
|
7
|
-
import { cn } from "../../lib/utils";
|
|
8
|
-
|
|
9
|
-
const ToastProvider = ToastPrimitives.Provider;
|
|
10
|
-
|
|
11
|
-
const MoonUIToastViewportPro = React.forwardRef<
|
|
12
|
-
React.ElementRef<typeof ToastPrimitives.Viewport>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
|
|
14
|
-
>(({ className, ...props }, ref) => (
|
|
15
|
-
<ToastPrimitives.Viewport
|
|
16
|
-
ref={ref}
|
|
17
|
-
className={cn(
|
|
18
|
-
"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]",
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
));
|
|
24
|
-
MoonUIToastViewportPro.displayName = ToastPrimitives.Viewport.displayName;
|
|
25
|
-
|
|
26
|
-
const moonUIToastVariantsPro = cva(
|
|
27
|
-
"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-8 shadow-sm 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",
|
|
28
|
-
{
|
|
29
|
-
variants: {
|
|
30
|
-
variant: {
|
|
31
|
-
default: "border bg-background text-foreground",
|
|
32
|
-
destructive:
|
|
33
|
-
"destructive group border-destructive bg-destructive text-destructive-foreground",
|
|
34
|
-
success:
|
|
35
|
-
"border-green-200 bg-green-50 text-green-900 dark:border-green-800 dark:bg-green-900/20 dark:text-green-100",
|
|
36
|
-
warning:
|
|
37
|
-
"border-orange-200 bg-orange-50 text-orange-900 dark:border-orange-800 dark:bg-orange-900/20 dark:text-orange-100",
|
|
38
|
-
info:
|
|
39
|
-
"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-100",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
defaultVariants: {
|
|
43
|
-
variant: "default",
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
type ToastProps = React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
49
|
-
VariantProps<typeof moonUIToastVariantsPro>;
|
|
50
|
-
|
|
51
|
-
type ToastActionElement = React.ReactElement<typeof MoonUIToastActionPro>;
|
|
52
|
-
|
|
53
|
-
const MoonUIToastPro = React.forwardRef<
|
|
54
|
-
React.ElementRef<typeof ToastPrimitives.Root>,
|
|
55
|
-
ToastProps
|
|
56
|
-
>(({ className, variant, ...props }, ref) => {
|
|
57
|
-
return (
|
|
58
|
-
<ToastPrimitives.Root
|
|
59
|
-
ref={ref}
|
|
60
|
-
className={cn(moonUIToastVariantsPro({ variant }), className)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
MoonUIToastPro.displayName = ToastPrimitives.Root.displayName;
|
|
66
|
-
|
|
67
|
-
const MoonUIToastActionPro = React.forwardRef<
|
|
68
|
-
React.ElementRef<typeof ToastPrimitives.Action>,
|
|
69
|
-
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
|
|
70
|
-
>(({ className, ...props }, ref) => (
|
|
71
|
-
<ToastPrimitives.Action
|
|
72
|
-
ref={ref}
|
|
73
|
-
className={cn(
|
|
74
|
-
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring 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",
|
|
75
|
-
className
|
|
76
|
-
)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
));
|
|
80
|
-
MoonUIToastActionPro.displayName = ToastPrimitives.Action.displayName;
|
|
81
|
-
|
|
82
|
-
const MoonUIToastClosePro = React.forwardRef<
|
|
83
|
-
React.ElementRef<typeof ToastPrimitives.Close>,
|
|
84
|
-
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
|
|
85
|
-
>(({ className, ...props }, ref) => (
|
|
86
|
-
<ToastPrimitives.Close
|
|
87
|
-
ref={ref}
|
|
88
|
-
className={cn(
|
|
89
|
-
"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 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",
|
|
90
|
-
className
|
|
91
|
-
)}
|
|
92
|
-
toast-close=""
|
|
93
|
-
{...props}
|
|
94
|
-
>
|
|
95
|
-
<X className="h-4 w-4" />
|
|
96
|
-
</ToastPrimitives.Close>
|
|
97
|
-
));
|
|
98
|
-
MoonUIToastClosePro.displayName = ToastPrimitives.Close.displayName;
|
|
99
|
-
|
|
100
|
-
const MoonUIToastTitlePro = React.forwardRef<
|
|
101
|
-
React.ElementRef<typeof ToastPrimitives.Title>,
|
|
102
|
-
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
|
|
103
|
-
>(({ className, ...props }, ref) => (
|
|
104
|
-
<ToastPrimitives.Title
|
|
105
|
-
ref={ref}
|
|
106
|
-
className={cn("text-sm font-semibold [&+div]:text-xs", className)}
|
|
107
|
-
{...props}
|
|
108
|
-
/>
|
|
109
|
-
));
|
|
110
|
-
MoonUIToastTitlePro.displayName = ToastPrimitives.Title.displayName;
|
|
111
|
-
|
|
112
|
-
const MoonUIToastDescriptionPro = React.forwardRef<
|
|
113
|
-
React.ElementRef<typeof ToastPrimitives.Description>,
|
|
114
|
-
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
|
|
115
|
-
>(({ className, ...props }, ref) => (
|
|
116
|
-
<ToastPrimitives.Description
|
|
117
|
-
ref={ref}
|
|
118
|
-
className={cn("text-sm opacity-90", className)}
|
|
119
|
-
{...props}
|
|
120
|
-
/>
|
|
121
|
-
));
|
|
122
|
-
MoonUIToastDescriptionPro.displayName = ToastPrimitives.Description.displayName;
|
|
123
|
-
|
|
124
|
-
type ToastData = {
|
|
125
|
-
id: string;
|
|
126
|
-
title?: React.ReactNode;
|
|
127
|
-
description?: React.ReactNode;
|
|
128
|
-
action?: ToastActionElement;
|
|
129
|
-
variant?: ToastProps["variant"];
|
|
130
|
-
duration?: number;
|
|
131
|
-
open?: boolean;
|
|
132
|
-
onOpenChange?: (open: boolean) => void;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const TOAST_LIMIT = 5;
|
|
136
|
-
const TOAST_REMOVE_DELAY = 1000000;
|
|
137
|
-
|
|
138
|
-
type State = {
|
|
139
|
-
toasts: ToastData[];
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
|
|
143
|
-
|
|
144
|
-
const addToRemoveQueue = (toastId: string) => {
|
|
145
|
-
if (toastTimeouts.has(toastId)) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const timeout = setTimeout(() => {
|
|
150
|
-
toastTimeouts.delete(toastId);
|
|
151
|
-
dispatch({
|
|
152
|
-
type: "REMOVE_TOAST",
|
|
153
|
-
toastId: toastId,
|
|
154
|
-
});
|
|
155
|
-
}, TOAST_REMOVE_DELAY);
|
|
156
|
-
|
|
157
|
-
toastTimeouts.set(toastId, timeout);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const reducer = (state: State, action: any): State => {
|
|
161
|
-
switch (action.type) {
|
|
162
|
-
case "ADD_TOAST":
|
|
163
|
-
return {
|
|
164
|
-
...state,
|
|
165
|
-
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
case "UPDATE_TOAST":
|
|
169
|
-
return {
|
|
170
|
-
...state,
|
|
171
|
-
toasts: state.toasts.map((t) =>
|
|
172
|
-
t.id === action.toast.id ? { ...t, ...action.toast } : t
|
|
173
|
-
),
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
case "DISMISS_TOAST": {
|
|
177
|
-
const { toastId } = action;
|
|
178
|
-
|
|
179
|
-
if (toastId) {
|
|
180
|
-
addToRemoveQueue(toastId);
|
|
181
|
-
} else {
|
|
182
|
-
state.toasts.forEach((toast) => {
|
|
183
|
-
addToRemoveQueue(toast.id);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
...state,
|
|
189
|
-
toasts: state.toasts.map((t) =>
|
|
190
|
-
t.id === toastId || toastId === undefined
|
|
191
|
-
? {
|
|
192
|
-
...t,
|
|
193
|
-
open: false,
|
|
194
|
-
}
|
|
195
|
-
: t
|
|
196
|
-
),
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
case "REMOVE_TOAST":
|
|
200
|
-
if (action.toastId === undefined) {
|
|
201
|
-
return {
|
|
202
|
-
...state,
|
|
203
|
-
toasts: [],
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
...state,
|
|
208
|
-
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
209
|
-
};
|
|
210
|
-
default:
|
|
211
|
-
return state;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
const listeners: Array<(state: State) => void> = [];
|
|
216
|
-
|
|
217
|
-
let memoryState: State = { toasts: [] };
|
|
218
|
-
let toastCounter = 0;
|
|
219
|
-
|
|
220
|
-
function dispatch(action: any) {
|
|
221
|
-
memoryState = reducer(memoryState, action);
|
|
222
|
-
listeners.forEach((listener) => {
|
|
223
|
-
listener(memoryState);
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
type Toast = Omit<ToastData, "id">;
|
|
228
|
-
|
|
229
|
-
function toast({ ...props }: Toast) {
|
|
230
|
-
const id = `toast-${Date.now()}-${++toastCounter}`;
|
|
231
|
-
|
|
232
|
-
const update = (props: ToastData) =>
|
|
233
|
-
dispatch({
|
|
234
|
-
type: "UPDATE_TOAST",
|
|
235
|
-
toast: { ...props, id },
|
|
236
|
-
});
|
|
237
|
-
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
238
|
-
|
|
239
|
-
dispatch({
|
|
240
|
-
type: "ADD_TOAST",
|
|
241
|
-
toast: {
|
|
242
|
-
...props,
|
|
243
|
-
id,
|
|
244
|
-
open: true,
|
|
245
|
-
onOpenChange: (open: boolean) => {
|
|
246
|
-
if (!open) dismiss();
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
return {
|
|
252
|
-
id: id,
|
|
253
|
-
dismiss,
|
|
254
|
-
update,
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function useToast() {
|
|
259
|
-
const [state, setState] = React.useState<State>(memoryState);
|
|
260
|
-
|
|
261
|
-
React.useEffect(() => {
|
|
262
|
-
listeners.push(setState);
|
|
263
|
-
return () => {
|
|
264
|
-
const index = listeners.indexOf(setState);
|
|
265
|
-
if (index > -1) {
|
|
266
|
-
listeners.splice(index, 1);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}, [state]);
|
|
270
|
-
|
|
271
|
-
return {
|
|
272
|
-
...state,
|
|
273
|
-
toast,
|
|
274
|
-
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function Toaster() {
|
|
279
|
-
const { toasts } = useToast();
|
|
280
|
-
|
|
281
|
-
return (
|
|
282
|
-
<ToastProvider>
|
|
283
|
-
{toasts.map(function ({ id, title, description, action, variant, open, onOpenChange, ...props }) {
|
|
284
|
-
return (
|
|
285
|
-
<MoonUIToastPro key={id} variant={variant} open={open} onOpenChange={onOpenChange} {...props}>
|
|
286
|
-
<div className="grid gap-1">
|
|
287
|
-
{title && <MoonUIToastTitlePro>{title}</MoonUIToastTitlePro>}
|
|
288
|
-
{description && (
|
|
289
|
-
<MoonUIToastDescriptionPro>{description}</MoonUIToastDescriptionPro>
|
|
290
|
-
)}
|
|
291
|
-
</div>
|
|
292
|
-
{action}
|
|
293
|
-
<MoonUIToastClosePro />
|
|
294
|
-
</MoonUIToastPro>
|
|
295
|
-
);
|
|
296
|
-
})}
|
|
297
|
-
<MoonUIToastViewportPro />
|
|
298
|
-
</ToastProvider>
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export { type ToastProps,
|
|
303
|
-
type ToastActionElement,
|
|
304
|
-
ToastProvider,
|
|
305
|
-
MoonUIToastViewportPro as ToastViewport,
|
|
306
|
-
MoonUIToastPro,
|
|
307
|
-
MoonUIToastTitlePro as ToastTitle,
|
|
308
|
-
MoonUIToastDescriptionPro as ToastDescription,
|
|
309
|
-
MoonUIToastActionPro as ToastAction,
|
|
310
|
-
MoonUIToastClosePro as ToastClose,
|
|
311
|
-
Toaster,
|
|
312
|
-
toast,
|
|
313
|
-
useToast,
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
// Backward compatibility exports
|
|
317
|
-
export { MoonUIToastPro as Toast };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
-
|
|
7
|
-
import { cn } from "../../lib/utils"
|
|
8
|
-
|
|
9
|
-
const MoonUItoggleVariantsPro = cva(
|
|
10
|
-
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: "bg-transparent hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:hover:bg-muted dark:hover:text-muted-foreground dark:data-[state=on]:bg-accent dark:data-[state=on]:text-accent-foreground",
|
|
15
|
-
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:border-input dark:hover:bg-accent dark:hover:text-accent-foreground dark:data-[state=on]:bg-accent dark:data-[state=on]:text-accent-foreground",
|
|
16
|
-
ghost: "hover:bg-accent hover:text-accent-foreground data-[state=on]:bg-transparent data-[state=on]:text-accent-foreground dark:hover:bg-accent dark:hover:text-accent-foreground dark:data-[state=on]:text-accent-foreground",
|
|
17
|
-
primary: "bg-transparent hover:bg-primary/10 hover:text-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground dark:hover:bg-primary/20 dark:hover:text-primary dark:data-[state=on]:bg-primary dark:data-[state=on]:text-primary-foreground",
|
|
18
|
-
secondary: "bg-transparent hover:bg-secondary/10 hover:text-secondary data-[state=on]:bg-secondary data-[state=on]:text-secondary-foreground dark:hover:bg-accent/20 dark:hover:text-accent-foreground dark:data-[state=on]:bg-accent dark:data-[state=on]:text-accent-foreground",
|
|
19
|
-
success: "bg-transparent hover:bg-success/10 hover:text-success data-[state=on]:bg-success data-[state=on]:text-success-foreground dark:hover:bg-success/20 dark:hover:text-success dark:data-[state=on]:bg-success dark:data-[state=on]:text-success-foreground",
|
|
20
|
-
warning: "bg-transparent hover:bg-warning/10 hover:text-warning data-[state=on]:bg-warning data-[state=on]:text-warning-foreground dark:hover:bg-warning/20 dark:hover:text-warning dark:data-[state=on]:bg-warning dark:data-[state=on]:text-warning-foreground",
|
|
21
|
-
danger: "bg-transparent hover:bg-destructive/10 hover:text-destructive data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground dark:hover:bg-destructive/20 dark:hover:text-destructive dark:data-[state=on]:bg-destructive dark:data-[state=on]:text-destructive-foreground",
|
|
22
|
-
gradient: "bg-transparent hover:bg-gradient-to-r hover:from-purple-500/10 hover:to-pink-500/10 hover:text-purple-600 data-[state=on]:bg-gradient-to-r data-[state=on]:from-purple-600 data-[state=on]:to-pink-600 data-[state=on]:text-white dark:hover:from-purple-500/20 dark:hover:to-pink-500/20 dark:hover:text-purple-400 dark:data-[state=on]:from-purple-600 dark:data-[state=on]:to-pink-600 dark:data-[state=on]:text-white",
|
|
23
|
-
},
|
|
24
|
-
size: {
|
|
25
|
-
xs: "h-7 px-2 text-xs",
|
|
26
|
-
sm: "h-8 px-2.5 text-xs",
|
|
27
|
-
default: "h-9 px-3",
|
|
28
|
-
md: "h-10 px-4",
|
|
29
|
-
lg: "h-11 px-6",
|
|
30
|
-
xl: "h-12 px-8 text-base",
|
|
31
|
-
},
|
|
32
|
-
shape: {
|
|
33
|
-
default: "rounded-md",
|
|
34
|
-
square: "rounded-none",
|
|
35
|
-
rounded: "rounded-lg",
|
|
36
|
-
pill: "rounded-full",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
variant: "default",
|
|
41
|
-
size: "default",
|
|
42
|
-
shape: "default",
|
|
43
|
-
},
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
export interface MoonUIToggleProProps extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>, VariantProps<typeof MoonUItoggleVariantsPro> {
|
|
48
|
-
/** Loading state */
|
|
49
|
-
loading?: boolean;
|
|
50
|
-
/** Show a badge with a count */
|
|
51
|
-
badge?: string | number;
|
|
52
|
-
/** Badge variant */
|
|
53
|
-
badgeVariant?: "default" | "primary" | "secondary" | "success" | "warning" | "danger";
|
|
54
|
-
/** Icon to show when toggled on */
|
|
55
|
-
iconOn?: React.ReactNode;
|
|
56
|
-
/** Icon to show when toggled off */
|
|
57
|
-
iconOff?: React.ReactNode;
|
|
58
|
-
/** Position of icon relative to text */
|
|
59
|
-
iconPosition?: "left" | "right";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const MoonUITogglePro = React.forwardRef<
|
|
63
|
-
React.ElementRef<typeof TogglePrimitive.Root>,
|
|
64
|
-
MoonUIToggleProProps
|
|
65
|
-
>(({ className, variant, size, shape, loading, badge, badgeVariant = "default", iconOn, iconOff, iconPosition = "left", children, pressed, onPressedChange, defaultPressed, ...props }, ref) => {
|
|
66
|
-
const icon = pressed ? iconOn : iconOff;
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<TogglePrimitive.Root
|
|
70
|
-
ref={ref}
|
|
71
|
-
className={cn(MoonUItoggleVariantsPro({ variant, size, shape }), className)}
|
|
72
|
-
pressed={pressed}
|
|
73
|
-
onPressedChange={onPressedChange}
|
|
74
|
-
defaultPressed={defaultPressed}
|
|
75
|
-
disabled={loading || props.disabled}
|
|
76
|
-
{...props}
|
|
77
|
-
>
|
|
78
|
-
{loading ? (
|
|
79
|
-
<div className="flex items-center gap-2">
|
|
80
|
-
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
|
81
|
-
{children && <span>{children}</span>}
|
|
82
|
-
</div>
|
|
83
|
-
) : (
|
|
84
|
-
<div className="flex items-center gap-2">
|
|
85
|
-
{icon && iconPosition === "left" && <span className="flex-shrink-0">{icon}</span>}
|
|
86
|
-
{children && <span>{children}</span>}
|
|
87
|
-
{icon && iconPosition === "right" && <span className="flex-shrink-0">{icon}</span>}
|
|
88
|
-
{badge !== undefined && (
|
|
89
|
-
<span className={cn(
|
|
90
|
-
"ml-1 inline-flex items-center justify-center rounded-full px-1.5 text-xs font-semibold",
|
|
91
|
-
badgeVariant === "default" && "bg-muted text-muted-foreground",
|
|
92
|
-
badgeVariant === "primary" && "bg-primary text-primary-foreground",
|
|
93
|
-
badgeVariant === "secondary" && "bg-secondary text-secondary-foreground dark:bg-accent dark:text-accent-foreground",
|
|
94
|
-
badgeVariant === "success" && "bg-success text-success-foreground",
|
|
95
|
-
badgeVariant === "warning" && "bg-warning text-warning-foreground",
|
|
96
|
-
badgeVariant === "danger" && "bg-destructive text-destructive-foreground",
|
|
97
|
-
)}>
|
|
98
|
-
{badge}
|
|
99
|
-
</span>
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
)}
|
|
103
|
-
</TogglePrimitive.Root>
|
|
104
|
-
)
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
MoonUITogglePro.displayName = TogglePrimitive.Root.displayName
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Internal aliases for Pro component usage
|
|
111
|
-
export const toggleVariantsInternal = MoonUItoggleVariantsPro
|
|
112
|
-
export const ToggleInternal = MoonUITogglePro
|
|
113
|
-
|
|
114
|
-
// Pro exports
|
|
115
|
-
export { MoonUItoggleVariantsPro, MoonUITogglePro }
|
|
116
|
-
|
|
117
|
-
// Clean exports (without MoonUI prefix for easier usage)
|
|
118
|
-
export { MoonUItoggleVariantsPro as toggleVariants, MoonUITogglePro as Toggle }
|
|
119
|
-
export type { MoonUIToggleProProps as ToggleProps }
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
-
|
|
7
|
-
import { cn } from "../../lib/utils"
|
|
8
|
-
|
|
9
|
-
const MoonUITooltipProviderPro = TooltipPrimitive.Provider
|
|
10
|
-
|
|
11
|
-
const tooltipVariants = cva(
|
|
12
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
|
|
13
|
-
{
|
|
14
|
-
variants: {
|
|
15
|
-
variant: {
|
|
16
|
-
default: "bg-primary text-primary-foreground",
|
|
17
|
-
secondary: "bg-secondary text-secondary-foreground",
|
|
18
|
-
success: "bg-green-500 text-white border-green-600",
|
|
19
|
-
warning: "bg-yellow-500 text-white border-yellow-600",
|
|
20
|
-
destructive: "bg-destructive text-destructive-foreground",
|
|
21
|
-
info: "bg-blue-500 text-white border-blue-600",
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
sm: "px-2 py-1 text-xs",
|
|
25
|
-
md: "px-3 py-1.5 text-sm",
|
|
26
|
-
lg: "px-4 py-2 text-base",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: "default",
|
|
31
|
-
size: "md",
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
const MoonUITooltipPro = TooltipPrimitive.Root
|
|
37
|
-
|
|
38
|
-
const MoonUITooltipTriggerPro = TooltipPrimitive.Trigger
|
|
39
|
-
|
|
40
|
-
const MoonUITooltipArrowPro = React.forwardRef<
|
|
41
|
-
React.ElementRef<typeof TooltipPrimitive.Arrow>,
|
|
42
|
-
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>
|
|
43
|
-
>(({ className, ...props }, ref) => (
|
|
44
|
-
<TooltipPrimitive.Arrow
|
|
45
|
-
ref={ref}
|
|
46
|
-
className={cn("fill-current", className)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
))
|
|
50
|
-
MoonUITooltipArrowPro.displayName = TooltipPrimitive.Arrow.displayName
|
|
51
|
-
|
|
52
|
-
export interface MoonUITooltipContentProProps
|
|
53
|
-
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>,
|
|
54
|
-
VariantProps<typeof tooltipVariants> {
|
|
55
|
-
showArrow?: boolean
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const MoonUITooltipContentPro = React.forwardRef<
|
|
59
|
-
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
60
|
-
MoonUITooltipContentProProps
|
|
61
|
-
>(({ className, variant, size, showArrow = false, sideOffset = 4, ...props }, ref) => (
|
|
62
|
-
<TooltipPrimitive.Content
|
|
63
|
-
ref={ref}
|
|
64
|
-
sideOffset={sideOffset}
|
|
65
|
-
className={cn(tooltipVariants({ variant, size }), className)}
|
|
66
|
-
{...props}
|
|
67
|
-
>
|
|
68
|
-
{props.children}
|
|
69
|
-
{showArrow && <MoonUITooltipArrowPro />}
|
|
70
|
-
</TooltipPrimitive.Content>
|
|
71
|
-
))
|
|
72
|
-
MoonUITooltipContentPro.displayName = TooltipPrimitive.Content.displayName
|
|
73
|
-
|
|
74
|
-
// Simplified Tooltip component for easy usage
|
|
75
|
-
interface SimpleTooltipProps {
|
|
76
|
-
children: React.ReactElement
|
|
77
|
-
content: React.ReactNode
|
|
78
|
-
variant?: MoonUITooltipContentProProps["variant"]
|
|
79
|
-
size?: MoonUITooltipContentProProps["size"]
|
|
80
|
-
side?: "top" | "right" | "bottom" | "left"
|
|
81
|
-
align?: "start" | "center" | "end"
|
|
82
|
-
delayDuration?: number
|
|
83
|
-
sideOffset?: number
|
|
84
|
-
showArrow?: boolean
|
|
85
|
-
className?: string
|
|
86
|
-
open?: boolean
|
|
87
|
-
defaultOpen?: boolean
|
|
88
|
-
onOpenChange?: (open: boolean) => void
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const MoonUISimpleTooltipPro = React.forwardRef<
|
|
92
|
-
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
93
|
-
SimpleTooltipProps
|
|
94
|
-
>(
|
|
95
|
-
(
|
|
96
|
-
{
|
|
97
|
-
children,
|
|
98
|
-
content,
|
|
99
|
-
variant = "default",
|
|
100
|
-
size = "md",
|
|
101
|
-
side = "top",
|
|
102
|
-
align = "center",
|
|
103
|
-
delayDuration = 400,
|
|
104
|
-
sideOffset = 4,
|
|
105
|
-
showArrow = false,
|
|
106
|
-
className,
|
|
107
|
-
open,
|
|
108
|
-
defaultOpen,
|
|
109
|
-
onOpenChange,
|
|
110
|
-
...props
|
|
111
|
-
},
|
|
112
|
-
ref
|
|
113
|
-
) => {
|
|
114
|
-
return (
|
|
115
|
-
<MoonUITooltipPro
|
|
116
|
-
open={open}
|
|
117
|
-
defaultOpen={defaultOpen}
|
|
118
|
-
onOpenChange={onOpenChange}
|
|
119
|
-
delayDuration={delayDuration}
|
|
120
|
-
>
|
|
121
|
-
<MoonUITooltipTriggerPro asChild>{children}</MoonUITooltipTriggerPro>
|
|
122
|
-
<MoonUITooltipContentPro
|
|
123
|
-
ref={ref}
|
|
124
|
-
side={side}
|
|
125
|
-
align={align}
|
|
126
|
-
variant={variant}
|
|
127
|
-
size={size}
|
|
128
|
-
sideOffset={sideOffset}
|
|
129
|
-
showArrow={showArrow}
|
|
130
|
-
className={className}
|
|
131
|
-
{...props}
|
|
132
|
-
>
|
|
133
|
-
{content}
|
|
134
|
-
</MoonUITooltipContentPro>
|
|
135
|
-
</MoonUITooltipPro>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
MoonUISimpleTooltipPro.displayName = "SimpleTooltip"
|
|
140
|
-
|
|
141
|
-
export { MoonUITooltipPro,
|
|
142
|
-
MoonUITooltipProviderPro,
|
|
143
|
-
MoonUITooltipTriggerPro,
|
|
144
|
-
MoonUITooltipContentPro,
|
|
145
|
-
MoonUITooltipArrowPro,
|
|
146
|
-
MoonUISimpleTooltipPro,
|
|
147
|
-
tooltipVariants,
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Backward compatibility exports
|
|
151
|
-
export { MoonUITooltipPro as Tooltip, MoonUITooltipTriggerPro as TooltipTrigger, MoonUITooltipContentPro as TooltipContent, MoonUITooltipProviderPro as TooltipProvider }
|