holie-vkit 1.1.9 → 1.1.11
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/components/Card.d.ts +2 -0
- package/dist/components/Card.js +2 -0
- package/dist/hooks/useToast.d.ts +10 -0
- package/dist/hooks/useToast.js +26 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -7,3 +7,5 @@ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.Ref
|
|
|
7
7
|
export declare const CardHeader: ({ children, className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const CardContent: ({ children, className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export declare const CardFooter: ({ children, className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const CardTitle: ({ children, className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const CardDescription: ({ children, className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/components/Card.js
CHANGED
|
@@ -5,3 +5,5 @@ Card.displayName = 'Card';
|
|
|
5
5
|
export const CardHeader = ({ children, className = '', ...props }) => (_jsx("div", { className: `p-4 border-b ${className}`, ...props, children: children }));
|
|
6
6
|
export const CardContent = ({ children, className = '', ...props }) => (_jsx("div", { className: `p-4 ${className}`, ...props, children: children }));
|
|
7
7
|
export const CardFooter = ({ children, className = '', ...props }) => (_jsx("div", { className: `p-4 border-t ${className}`, ...props, children: children }));
|
|
8
|
+
export const CardTitle = ({ children, className = '', ...props }) => (_jsx("h3", { className: `text-2xl font-semibold leading-none tracking-tight ${className}`, ...props, children: children }));
|
|
9
|
+
export const CardDescription = ({ children, className = '', ...props }) => (_jsx("p", { className: `text-sm text-muted-foreground ${className}`, ...props, children: children }));
|
package/dist/hooks/useToast.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ToastOptions {
|
|
2
|
+
message: string;
|
|
3
|
+
type?: "info" | "success" | "warning" | "error";
|
|
4
|
+
duration?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function useToast(): {
|
|
7
|
+
showToast: (options: ToastOptions) => void;
|
|
8
|
+
hideToast: () => void;
|
|
9
|
+
ToastComponent: () => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
};
|
package/dist/hooks/useToast.js
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export function useToast() {
|
|
4
|
+
const [toast, setToast] = React.useState(null);
|
|
5
|
+
const showToast = (options) => setToast(options);
|
|
6
|
+
const hideToast = () => setToast(null);
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
if (toast && toast.duration !== 0) {
|
|
9
|
+
const timer = setTimeout(() => setToast(null), toast.duration || 3000);
|
|
10
|
+
return () => clearTimeout(timer);
|
|
11
|
+
}
|
|
12
|
+
}, [toast]);
|
|
13
|
+
let bgClass = "bg-blue-500 text-white";
|
|
14
|
+
if ((toast === null || toast === void 0 ? void 0 : toast.type) === "success")
|
|
15
|
+
bgClass = "bg-green-500 text-white";
|
|
16
|
+
else if ((toast === null || toast === void 0 ? void 0 : toast.type) === "error")
|
|
17
|
+
bgClass = "bg-red-500 text-white";
|
|
18
|
+
else if ((toast === null || toast === void 0 ? void 0 : toast.type) === "warning")
|
|
19
|
+
bgClass = "bg-yellow-500 text-black";
|
|
20
|
+
function ToastComponent() {
|
|
21
|
+
if (!toast)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsx("div", { className: `fixed bottom-4 right-4 px-4 py-2 rounded shadow-lg z-50 ${bgClass}`, children: toast.message }));
|
|
24
|
+
}
|
|
25
|
+
return { showToast, hideToast, ToastComponent };
|
|
26
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED