myoperator-mcp 0.2.30 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +420 -131
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3724,48 +3724,357 @@ TextField.displayName = "TextField";
|
|
|
3724
3724
|
|
|
3725
3725
|
export { TextField, textFieldContainerVariants, textFieldInputVariants };
|
|
3726
3726
|
`,
|
|
3727
|
-
"toast": `import
|
|
3727
|
+
"toast": `import * as React from "react";
|
|
3728
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
3729
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3730
|
+
import { X, CheckCircle2, XCircle, AlertTriangle, Info } from "lucide-react";
|
|
3728
3731
|
|
|
3729
3732
|
import { cn } from "@/lib/utils";
|
|
3730
3733
|
|
|
3731
|
-
|
|
3732
|
-
* Position options for the toast container.
|
|
3733
|
-
*/
|
|
3734
|
-
export type ToastPosition =
|
|
3735
|
-
| "top-left"
|
|
3736
|
-
| "top-center"
|
|
3737
|
-
| "top-right"
|
|
3738
|
-
| "bottom-left"
|
|
3739
|
-
| "bottom-center"
|
|
3740
|
-
| "bottom-right";
|
|
3734
|
+
const ToastProvider = ToastPrimitives.Provider;
|
|
3741
3735
|
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3736
|
+
const ToastViewport = React.forwardRef<
|
|
3737
|
+
React.ElementRef<typeof ToastPrimitives.Viewport>,
|
|
3738
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
|
|
3739
|
+
>(({ className, ...props }, ref) => (
|
|
3740
|
+
<ToastPrimitives.Viewport
|
|
3741
|
+
ref={ref}
|
|
3742
|
+
className={cn(
|
|
3743
|
+
"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]",
|
|
3744
|
+
className
|
|
3745
|
+
)}
|
|
3746
|
+
{...props}
|
|
3747
|
+
/>
|
|
3748
|
+
));
|
|
3749
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
3750
|
+
|
|
3751
|
+
const toastVariants = cva(
|
|
3752
|
+
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-lg border p-4 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",
|
|
3753
|
+
{
|
|
3754
|
+
variants: {
|
|
3755
|
+
variant: {
|
|
3756
|
+
default: "border-[#E9EAEB] bg-white text-[#181D27]",
|
|
3757
|
+
success: "border-[#17B26A]/20 bg-[#ECFDF3] text-[#067647]",
|
|
3758
|
+
error: "border-[#F04438]/20 bg-[#FEF3F2] text-[#B42318]",
|
|
3759
|
+
warning: "border-[#F79009]/20 bg-[#FFFAEB] text-[#B54708]",
|
|
3760
|
+
info: "border-[#4275D6]/20 bg-[#EBF5FF] text-[#1849A9]",
|
|
3761
|
+
},
|
|
3762
|
+
},
|
|
3763
|
+
defaultVariants: {
|
|
3764
|
+
variant: "default",
|
|
3765
|
+
},
|
|
3766
|
+
}
|
|
3767
|
+
);
|
|
3768
|
+
|
|
3769
|
+
const Toast = React.forwardRef<
|
|
3770
|
+
React.ElementRef<typeof ToastPrimitives.Root>,
|
|
3771
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
3772
|
+
VariantProps<typeof toastVariants>
|
|
3773
|
+
>(({ className, variant, ...props }, ref) => {
|
|
3774
|
+
return (
|
|
3775
|
+
<ToastPrimitives.Root
|
|
3776
|
+
ref={ref}
|
|
3777
|
+
className={cn(toastVariants({ variant }), className)}
|
|
3778
|
+
{...props}
|
|
3779
|
+
/>
|
|
3780
|
+
);
|
|
3781
|
+
});
|
|
3782
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
3783
|
+
|
|
3784
|
+
const ToastAction = React.forwardRef<
|
|
3785
|
+
React.ElementRef<typeof ToastPrimitives.Action>,
|
|
3786
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
|
|
3787
|
+
>(({ className, ...props }, ref) => (
|
|
3788
|
+
<ToastPrimitives.Action
|
|
3789
|
+
ref={ref}
|
|
3790
|
+
className={cn(
|
|
3791
|
+
"inline-flex h-8 shrink-0 items-center justify-center rounded border border-[#E9EAEB] bg-transparent px-3 text-sm font-medium transition-colors hover:bg-[#F5F5F5] focus:outline-none focus:ring-2 focus:ring-[#4275D6] focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
3792
|
+
"group-[.success]:border-[#17B26A]/30 group-[.success]:hover:border-[#17B26A]/50 group-[.success]:hover:bg-[#17B26A]/10",
|
|
3793
|
+
"group-[.error]:border-[#F04438]/30 group-[.error]:hover:border-[#F04438]/50 group-[.error]:hover:bg-[#F04438]/10",
|
|
3794
|
+
"group-[.warning]:border-[#F79009]/30 group-[.warning]:hover:border-[#F79009]/50 group-[.warning]:hover:bg-[#F79009]/10",
|
|
3795
|
+
"group-[.info]:border-[#4275D6]/30 group-[.info]:hover:border-[#4275D6]/50 group-[.info]:hover:bg-[#4275D6]/10",
|
|
3796
|
+
className
|
|
3797
|
+
)}
|
|
3798
|
+
{...props}
|
|
3799
|
+
/>
|
|
3800
|
+
));
|
|
3801
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
3802
|
+
|
|
3803
|
+
const ToastClose = React.forwardRef<
|
|
3804
|
+
React.ElementRef<typeof ToastPrimitives.Close>,
|
|
3805
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
|
|
3806
|
+
>(({ className, ...props }, ref) => (
|
|
3807
|
+
<ToastPrimitives.Close
|
|
3808
|
+
ref={ref}
|
|
3809
|
+
className={cn(
|
|
3810
|
+
"absolute right-2 top-2 rounded-md p-1 text-[#717680] opacity-0 transition-opacity hover:text-[#181D27] focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100",
|
|
3811
|
+
"group-[.success]:text-[#067647] group-[.success]:hover:text-[#067647]",
|
|
3812
|
+
"group-[.error]:text-[#B42318] group-[.error]:hover:text-[#B42318]",
|
|
3813
|
+
"group-[.warning]:text-[#B54708] group-[.warning]:hover:text-[#B54708]",
|
|
3814
|
+
"group-[.info]:text-[#1849A9] group-[.info]:hover:text-[#1849A9]",
|
|
3815
|
+
className
|
|
3816
|
+
)}
|
|
3817
|
+
toast-close=""
|
|
3818
|
+
{...props}
|
|
3819
|
+
>
|
|
3820
|
+
<X className="h-4 w-4" />
|
|
3821
|
+
</ToastPrimitives.Close>
|
|
3822
|
+
));
|
|
3823
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
3824
|
+
|
|
3825
|
+
const ToastTitle = React.forwardRef<
|
|
3826
|
+
React.ElementRef<typeof ToastPrimitives.Title>,
|
|
3827
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
|
|
3828
|
+
>(({ className, ...props }, ref) => (
|
|
3829
|
+
<ToastPrimitives.Title
|
|
3830
|
+
ref={ref}
|
|
3831
|
+
className={cn("text-sm font-semibold", className)}
|
|
3832
|
+
{...props}
|
|
3833
|
+
/>
|
|
3834
|
+
));
|
|
3835
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
3836
|
+
|
|
3837
|
+
const ToastDescription = React.forwardRef<
|
|
3838
|
+
React.ElementRef<typeof ToastPrimitives.Description>,
|
|
3839
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
|
|
3840
|
+
>(({ className, ...props }, ref) => (
|
|
3841
|
+
<ToastPrimitives.Description
|
|
3842
|
+
ref={ref}
|
|
3843
|
+
className={cn("text-sm opacity-90", className)}
|
|
3844
|
+
{...props}
|
|
3845
|
+
/>
|
|
3846
|
+
));
|
|
3847
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
3848
|
+
|
|
3849
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
3850
|
+
|
|
3851
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
3852
|
+
|
|
3853
|
+
|
|
3854
|
+
export {
|
|
3855
|
+
type ToastProps,
|
|
3856
|
+
type ToastActionElement,
|
|
3857
|
+
ToastProvider,
|
|
3858
|
+
ToastViewport,
|
|
3859
|
+
Toast,
|
|
3860
|
+
ToastTitle,
|
|
3861
|
+
ToastDescription,
|
|
3862
|
+
ToastClose,
|
|
3863
|
+
ToastAction,
|
|
3864
|
+
toastVariants,
|
|
3865
|
+
};
|
|
3866
|
+
|
|
3867
|
+
// ============================================================================
|
|
3868
|
+
// Toast Hook & Toaster Component
|
|
3869
|
+
// ============================================================================
|
|
3870
|
+
|
|
3871
|
+
const TOAST_LIMIT = 5;
|
|
3872
|
+
const TOAST_REMOVE_DELAY = 5000;
|
|
3873
|
+
|
|
3874
|
+
type ToasterToast = ToastProps & {
|
|
3875
|
+
id: string;
|
|
3876
|
+
title?: React.ReactNode;
|
|
3877
|
+
description?: React.ReactNode;
|
|
3878
|
+
action?: ToastActionElement;
|
|
3879
|
+
};
|
|
3880
|
+
|
|
3881
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3882
|
+
const actionTypes = {
|
|
3883
|
+
ADD_TOAST: "ADD_TOAST",
|
|
3884
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
3885
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
3886
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
3887
|
+
} as const;
|
|
3888
|
+
|
|
3889
|
+
type ActionType = typeof actionTypes;
|
|
3890
|
+
|
|
3891
|
+
let count = 0;
|
|
3892
|
+
|
|
3893
|
+
function genId() {
|
|
3894
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
3895
|
+
return count.toString();
|
|
3764
3896
|
}
|
|
3765
3897
|
|
|
3898
|
+
type Action =
|
|
3899
|
+
| {
|
|
3900
|
+
type: ActionType["ADD_TOAST"];
|
|
3901
|
+
toast: ToasterToast;
|
|
3902
|
+
}
|
|
3903
|
+
| {
|
|
3904
|
+
type: ActionType["UPDATE_TOAST"];
|
|
3905
|
+
toast: Partial<ToasterToast>;
|
|
3906
|
+
}
|
|
3907
|
+
| {
|
|
3908
|
+
type: ActionType["DISMISS_TOAST"];
|
|
3909
|
+
toastId?: ToasterToast["id"];
|
|
3910
|
+
}
|
|
3911
|
+
| {
|
|
3912
|
+
type: ActionType["REMOVE_TOAST"];
|
|
3913
|
+
toastId?: ToasterToast["id"];
|
|
3914
|
+
};
|
|
3915
|
+
|
|
3916
|
+
interface State {
|
|
3917
|
+
toasts: ToasterToast[];
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
|
|
3921
|
+
|
|
3922
|
+
const addToRemoveQueue = (toastId: string) => {
|
|
3923
|
+
if (toastTimeouts.has(toastId)) {
|
|
3924
|
+
return;
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
const timeout = setTimeout(() => {
|
|
3928
|
+
toastTimeouts.delete(toastId);
|
|
3929
|
+
dispatch({
|
|
3930
|
+
type: "REMOVE_TOAST",
|
|
3931
|
+
toastId: toastId,
|
|
3932
|
+
});
|
|
3933
|
+
}, TOAST_REMOVE_DELAY);
|
|
3934
|
+
|
|
3935
|
+
toastTimeouts.set(toastId, timeout);
|
|
3936
|
+
};
|
|
3937
|
+
|
|
3938
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
3939
|
+
export const reducer = (state: State, action: Action): State => {
|
|
3940
|
+
switch (action.type) {
|
|
3941
|
+
case "ADD_TOAST":
|
|
3942
|
+
return {
|
|
3943
|
+
...state,
|
|
3944
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
3945
|
+
};
|
|
3946
|
+
|
|
3947
|
+
case "UPDATE_TOAST":
|
|
3948
|
+
return {
|
|
3949
|
+
...state,
|
|
3950
|
+
toasts: state.toasts.map((t) =>
|
|
3951
|
+
t.id === action.toast.id ? { ...t, ...action.toast } : t
|
|
3952
|
+
),
|
|
3953
|
+
};
|
|
3954
|
+
|
|
3955
|
+
case "DISMISS_TOAST": {
|
|
3956
|
+
const { toastId } = action;
|
|
3957
|
+
|
|
3958
|
+
if (toastId) {
|
|
3959
|
+
addToRemoveQueue(toastId);
|
|
3960
|
+
} else {
|
|
3961
|
+
state.toasts.forEach((toast) => {
|
|
3962
|
+
addToRemoveQueue(toast.id);
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3966
|
+
return {
|
|
3967
|
+
...state,
|
|
3968
|
+
toasts: state.toasts.map((t) =>
|
|
3969
|
+
t.id === toastId || toastId === undefined
|
|
3970
|
+
? {
|
|
3971
|
+
...t,
|
|
3972
|
+
open: false,
|
|
3973
|
+
}
|
|
3974
|
+
: t
|
|
3975
|
+
),
|
|
3976
|
+
};
|
|
3977
|
+
}
|
|
3978
|
+
case "REMOVE_TOAST":
|
|
3979
|
+
if (action.toastId === undefined) {
|
|
3980
|
+
return {
|
|
3981
|
+
...state,
|
|
3982
|
+
toasts: [],
|
|
3983
|
+
};
|
|
3984
|
+
}
|
|
3985
|
+
return {
|
|
3986
|
+
...state,
|
|
3987
|
+
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3990
|
+
};
|
|
3991
|
+
|
|
3992
|
+
const listeners: Array<(state: State) => void> = [];
|
|
3993
|
+
|
|
3994
|
+
let memoryState: State = { toasts: [] };
|
|
3995
|
+
|
|
3996
|
+
function dispatch(action: Action) {
|
|
3997
|
+
memoryState = reducer(memoryState, action);
|
|
3998
|
+
listeners.forEach((listener) => {
|
|
3999
|
+
listener(memoryState);
|
|
4000
|
+
});
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
type ToastInput = Omit<ToasterToast, "id">;
|
|
4004
|
+
|
|
4005
|
+
function toast({ ...props }: ToastInput) {
|
|
4006
|
+
const id = genId();
|
|
4007
|
+
|
|
4008
|
+
const update = (props: ToasterToast) =>
|
|
4009
|
+
dispatch({
|
|
4010
|
+
type: "UPDATE_TOAST",
|
|
4011
|
+
toast: { ...props, id },
|
|
4012
|
+
});
|
|
4013
|
+
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
4014
|
+
|
|
4015
|
+
dispatch({
|
|
4016
|
+
type: "ADD_TOAST",
|
|
4017
|
+
toast: {
|
|
4018
|
+
...props,
|
|
4019
|
+
id,
|
|
4020
|
+
open: true,
|
|
4021
|
+
onOpenChange: (open) => {
|
|
4022
|
+
if (!open) dismiss();
|
|
4023
|
+
},
|
|
4024
|
+
},
|
|
4025
|
+
});
|
|
4026
|
+
|
|
4027
|
+
return {
|
|
4028
|
+
id: id,
|
|
4029
|
+
dismiss,
|
|
4030
|
+
update,
|
|
4031
|
+
};
|
|
4032
|
+
}
|
|
4033
|
+
|
|
4034
|
+
// Convenience methods for different variants
|
|
4035
|
+
toast.success = (props: Omit<ToastInput, "variant">) =>
|
|
4036
|
+
toast({ ...props, variant: "success" });
|
|
4037
|
+
toast.error = (props: Omit<ToastInput, "variant">) =>
|
|
4038
|
+
toast({ ...props, variant: "error" });
|
|
4039
|
+
toast.warning = (props: Omit<ToastInput, "variant">) =>
|
|
4040
|
+
toast({ ...props, variant: "warning" });
|
|
4041
|
+
toast.info = (props: Omit<ToastInput, "variant">) =>
|
|
4042
|
+
toast({ ...props, variant: "info" });
|
|
4043
|
+
toast.dismiss = (toastId?: string) =>
|
|
4044
|
+
dispatch({ type: "DISMISS_TOAST", toastId });
|
|
4045
|
+
|
|
4046
|
+
function useToast() {
|
|
4047
|
+
const [state, setState] = React.useState<State>(memoryState);
|
|
4048
|
+
|
|
4049
|
+
React.useEffect(() => {
|
|
4050
|
+
listeners.push(setState);
|
|
4051
|
+
return () => {
|
|
4052
|
+
const index = listeners.indexOf(setState);
|
|
4053
|
+
if (index > -1) {
|
|
4054
|
+
listeners.splice(index, 1);
|
|
4055
|
+
}
|
|
4056
|
+
};
|
|
4057
|
+
}, [state]);
|
|
4058
|
+
|
|
4059
|
+
return {
|
|
4060
|
+
...state,
|
|
4061
|
+
toast,
|
|
4062
|
+
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
|
4063
|
+
};
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
// Variant icons mapping
|
|
4067
|
+
const variantIcons = {
|
|
4068
|
+
default: null,
|
|
4069
|
+
success: CheckCircle2,
|
|
4070
|
+
error: XCircle,
|
|
4071
|
+
warning: AlertTriangle,
|
|
4072
|
+
info: Info,
|
|
4073
|
+
};
|
|
4074
|
+
|
|
3766
4075
|
/**
|
|
3767
|
-
*
|
|
3768
|
-
* Place this component once at the root of your app
|
|
4076
|
+
* Toaster component that renders toast notifications.
|
|
4077
|
+
* Place this component once at the root of your app.
|
|
3769
4078
|
*
|
|
3770
4079
|
* @example
|
|
3771
4080
|
* \`\`\`tsx
|
|
@@ -3782,125 +4091,103 @@ export interface ToasterProps {
|
|
|
3782
4091
|
* }
|
|
3783
4092
|
* \`\`\`
|
|
3784
4093
|
*/
|
|
3785
|
-
function Toaster({
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
duration = 4000,
|
|
3789
|
-
gap = 8,
|
|
3790
|
-
offset = 16,
|
|
3791
|
-
expand = true,
|
|
3792
|
-
visibleToasts = 3,
|
|
3793
|
-
className,
|
|
3794
|
-
richColors = true,
|
|
3795
|
-
...props
|
|
3796
|
-
}: ToasterProps) {
|
|
4094
|
+
function Toaster() {
|
|
4095
|
+
const { toasts } = useToast();
|
|
4096
|
+
|
|
3797
4097
|
return (
|
|
3798
|
-
<
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
"group-[.toast]:text-[#717680]",
|
|
3831
|
-
"group-[.toast]:hover:text-[#181D27]",
|
|
3832
|
-
"group-[.toast]:border-[#E9EAEB]",
|
|
3833
|
-
"group-[.toast]:bg-white"
|
|
3834
|
-
),
|
|
3835
|
-
// Variant-specific styles (when richColors is true)
|
|
3836
|
-
success: cn(
|
|
3837
|
-
"group-[.toaster]:bg-[#ECFDF3] group-[.toaster]:border-[#17B26A]/20",
|
|
3838
|
-
"group-[.toaster]:text-[#067647]",
|
|
3839
|
-
"[&_[data-icon]]:text-[#17B26A]"
|
|
3840
|
-
),
|
|
3841
|
-
error: cn(
|
|
3842
|
-
"group-[.toaster]:bg-[#FEF3F2] group-[.toaster]:border-[#F04438]/20",
|
|
3843
|
-
"group-[.toaster]:text-[#B42318]",
|
|
3844
|
-
"[&_[data-icon]]:text-[#F04438]"
|
|
3845
|
-
),
|
|
3846
|
-
warning: cn(
|
|
3847
|
-
"group-[.toaster]:bg-[#FFFAEB] group-[.toaster]:border-[#F79009]/20",
|
|
3848
|
-
"group-[.toaster]:text-[#B54708]",
|
|
3849
|
-
"[&_[data-icon]]:text-[#F79009]"
|
|
3850
|
-
),
|
|
3851
|
-
info: cn(
|
|
3852
|
-
"group-[.toaster]:bg-[#EBF5FF] group-[.toaster]:border-[#4275D6]/20",
|
|
3853
|
-
"group-[.toaster]:text-[#1849A9]",
|
|
3854
|
-
"[&_[data-icon]]:text-[#4275D6]"
|
|
3855
|
-
),
|
|
3856
|
-
},
|
|
3857
|
-
}}
|
|
3858
|
-
{...props}
|
|
3859
|
-
/>
|
|
4098
|
+
<ToastProvider>
|
|
4099
|
+
{toasts.map(function ({ id, title, description, action, variant, ...props }) {
|
|
4100
|
+
const Icon = variant ? variantIcons[variant] : null;
|
|
4101
|
+
|
|
4102
|
+
return (
|
|
4103
|
+
<Toast key={id} variant={variant} className={variant} {...props}>
|
|
4104
|
+
<div className="flex gap-3">
|
|
4105
|
+
{Icon && (
|
|
4106
|
+
<Icon
|
|
4107
|
+
className={cn(
|
|
4108
|
+
"h-5 w-5 shrink-0",
|
|
4109
|
+
variant === "success" && "text-[#17B26A]",
|
|
4110
|
+
variant === "error" && "text-[#F04438]",
|
|
4111
|
+
variant === "warning" && "text-[#F79009]",
|
|
4112
|
+
variant === "info" && "text-[#4275D6]"
|
|
4113
|
+
)}
|
|
4114
|
+
/>
|
|
4115
|
+
)}
|
|
4116
|
+
<div className="grid gap-1">
|
|
4117
|
+
{title && <ToastTitle>{title}</ToastTitle>}
|
|
4118
|
+
{description && (
|
|
4119
|
+
<ToastDescription>{description}</ToastDescription>
|
|
4120
|
+
)}
|
|
4121
|
+
</div>
|
|
4122
|
+
</div>
|
|
4123
|
+
{action}
|
|
4124
|
+
<ToastClose />
|
|
4125
|
+
</Toast>
|
|
4126
|
+
);
|
|
4127
|
+
})}
|
|
4128
|
+
<ToastViewport />
|
|
4129
|
+
</ToastProvider>
|
|
3860
4130
|
);
|
|
3861
4131
|
}
|
|
3862
4132
|
|
|
3863
|
-
//
|
|
3864
|
-
export {
|
|
4133
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
4134
|
+
export { useToast, toast, Toaster };
|
|
3865
4135
|
|
|
3866
4136
|
/**
|
|
3867
|
-
*
|
|
4137
|
+
* Toast notification system using Radix UI primitives.
|
|
3868
4138
|
*
|
|
3869
4139
|
* @example
|
|
3870
4140
|
* \`\`\`tsx
|
|
4141
|
+
* // In your App.tsx or layout
|
|
4142
|
+
* import { Toaster } from "@/components/ui/toast"
|
|
4143
|
+
*
|
|
4144
|
+
* function App() {
|
|
4145
|
+
* return (
|
|
4146
|
+
* <>
|
|
4147
|
+
* <YourApp />
|
|
4148
|
+
* <Toaster />
|
|
4149
|
+
* </>
|
|
4150
|
+
* )
|
|
4151
|
+
* }
|
|
4152
|
+
* \`\`\`
|
|
4153
|
+
*
|
|
4154
|
+
* @example
|
|
4155
|
+
* \`\`\`tsx
|
|
4156
|
+
* // Trigger toasts from anywhere
|
|
3871
4157
|
* import { toast } from "@/components/ui/toast"
|
|
3872
4158
|
*
|
|
3873
4159
|
* // Simple message
|
|
3874
|
-
* toast("Event has been created")
|
|
4160
|
+
* toast({ title: "Event has been created" })
|
|
3875
4161
|
*
|
|
3876
|
-
* //
|
|
3877
|
-
* toast.success(
|
|
4162
|
+
* // Success toast
|
|
4163
|
+
* toast.success({
|
|
4164
|
+
* title: "Success!",
|
|
3878
4165
|
* description: "Your changes have been saved."
|
|
3879
4166
|
* })
|
|
3880
4167
|
*
|
|
3881
4168
|
* // Error toast
|
|
3882
|
-
* toast.error(
|
|
4169
|
+
* toast.error({
|
|
4170
|
+
* title: "Error",
|
|
3883
4171
|
* description: "Something went wrong. Please try again."
|
|
3884
4172
|
* })
|
|
3885
4173
|
*
|
|
3886
|
-
* //
|
|
3887
|
-
* toast(
|
|
3888
|
-
*
|
|
3889
|
-
*
|
|
3890
|
-
* onClick: () => console.log("Undo clicked")
|
|
3891
|
-
* }
|
|
4174
|
+
* // Warning toast
|
|
4175
|
+
* toast.warning({
|
|
4176
|
+
* title: "Warning",
|
|
4177
|
+
* description: "This action cannot be undone."
|
|
3892
4178
|
* })
|
|
3893
4179
|
*
|
|
3894
|
-
* //
|
|
3895
|
-
* toast.
|
|
3896
|
-
*
|
|
3897
|
-
*
|
|
3898
|
-
* error: "Failed to save"
|
|
4180
|
+
* // Info toast
|
|
4181
|
+
* toast.info({
|
|
4182
|
+
* title: "Info",
|
|
4183
|
+
* description: "You have 3 new notifications."
|
|
3899
4184
|
* })
|
|
3900
4185
|
*
|
|
3901
|
-
* //
|
|
3902
|
-
*
|
|
3903
|
-
*
|
|
4186
|
+
* // With action button
|
|
4187
|
+
* toast({
|
|
4188
|
+
* title: "Event created",
|
|
4189
|
+
* action: <ToastAction altText="Undo">Undo</ToastAction>
|
|
4190
|
+
* })
|
|
3904
4191
|
*
|
|
3905
4192
|
* // Dismiss all toasts
|
|
3906
4193
|
* toast.dismiss()
|
|
@@ -5118,9 +5405,11 @@ var componentMetadata = {
|
|
|
5118
5405
|
"name": "Toast",
|
|
5119
5406
|
"description": "A toast component.",
|
|
5120
5407
|
"dependencies": [
|
|
5408
|
+
"@radix-ui/react-toast",
|
|
5121
5409
|
"class-variance-authority",
|
|
5122
5410
|
"clsx",
|
|
5123
|
-
"tailwind-merge"
|
|
5411
|
+
"tailwind-merge",
|
|
5412
|
+
"lucide-react"
|
|
5124
5413
|
],
|
|
5125
5414
|
"props": [],
|
|
5126
5415
|
"variants": [],
|
package/package.json
CHANGED