holie-vkit 1.1.10 → 1.1.12

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.
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
+ declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
4
+ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
4
+ import { ChevronDown } from "lucide-react";
5
+ // Utility function for classnames (copied from holie-vkit or use your own implementation)
6
+ function cn(...classes) {
7
+ return classes.filter(Boolean).join(" ");
8
+ }
9
+ const Accordion = AccordionPrimitive.Root;
10
+ const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (_jsx(AccordionPrimitive.Item, { ref: ref, className: cn("border-b", className), ...props })));
11
+ AccordionItem.displayName = "AccordionItem";
12
+ const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(AccordionPrimitive.Header, { className: "flex", children: _jsxs(AccordionPrimitive.Trigger, { ref: ref, className: cn("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180", className), ...props, children: [children, _jsx(ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200" })] }) })));
13
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
14
+ const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(AccordionPrimitive.Content, { ref: ref, className: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", ...props, children: _jsx("div", { className: cn("pb-4 pt-0", className), children: children }) })));
15
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
16
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -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
+ };
@@ -1,2 +1,26 @@
1
- "use strict";
2
- // File intentionally removed. Use useToast.tsx instead.
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
@@ -38,3 +38,5 @@ export * from './components/Progress';
38
38
  export * from './components/Skeleton';
39
39
  export * from './components/Table';
40
40
  export * from './components/Toast';
41
+ export * from './components/Accordion';
42
+ export { useToast } from './hooks/useToast';
package/dist/index.js CHANGED
@@ -39,3 +39,7 @@ export * from './components/Progress';
39
39
  export * from './components/Skeleton';
40
40
  export * from './components/Table';
41
41
  export * from './components/Toast';
42
+ // Newly added
43
+ export * from './components/Accordion';
44
+ // Export hooks
45
+ export { useToast } from './hooks/useToast';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holie-vkit",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@radix-ui/react-dropdown-menu": "^2.1.16",
15
+ "@radix-ui/react-accordion": "^1.0.3",
15
16
  "lucide-react": "^0.563.0",
16
17
  "react": "^19.2.4",
17
18
  "react-dom": "^19.2.4",