@myrjfa/ui 1.1.0 → 1.1.2
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/chat/ChatMain.d.ts +3 -1
- package/dist/chat/ChatMain.d.ts.map +1 -1
- package/dist/chat/ChatMain.js +174 -145
- package/dist/chat/ChatSidebar.js +7 -8
- package/dist/chat/ConversationList.d.ts.map +1 -1
- package/dist/chat/ConversationList.js +20 -18
- package/dist/chat/ExpensePanel.d.ts +4 -1
- package/dist/chat/ExpensePanel.d.ts.map +1 -1
- package/dist/chat/ExpensePanel.js +215 -195
- package/dist/chat/MessageBubble.d.ts +5 -3
- package/dist/chat/MessageBubble.d.ts.map +1 -1
- package/dist/chat/MessageBubble.js +185 -103
- package/dist/chat/MessageInput.d.ts +8 -1
- package/dist/chat/MessageInput.d.ts.map +1 -1
- package/dist/chat/MessageInput.js +182 -165
- package/dist/chat/MilestonePanel.d.ts +4 -1
- package/dist/chat/MilestonePanel.d.ts.map +1 -1
- package/dist/chat/MilestonePanel.js +150 -150
- package/dist/chat/components/ParticipantSelector.d.ts +11 -0
- package/dist/chat/components/ParticipantSelector.d.ts.map +1 -0
- package/dist/chat/components/ParticipantSelector.js +17 -0
- package/dist/chat/components/SplitInputs.d.ts +11 -0
- package/dist/chat/components/SplitInputs.d.ts.map +1 -0
- package/dist/chat/components/SplitInputs.js +83 -0
- package/dist/chat/components/SplitTypeSelector.d.ts +8 -0
- package/dist/chat/components/SplitTypeSelector.d.ts.map +1 -0
- package/dist/chat/components/SplitTypeSelector.js +13 -0
- package/dist/chat/dialogs/AddMemberDialog.js +30 -90
- package/dist/chat/dialogs/CameraDialog.js +38 -86
- package/dist/chat/dialogs/CreatePollDialog.d.ts +8 -0
- package/dist/chat/dialogs/CreatePollDialog.d.ts.map +1 -0
- package/dist/chat/dialogs/CreatePollDialog.js +38 -0
- package/dist/chat/dialogs/ExpenseAnalyticsDialog.d.ts +19 -0
- package/dist/chat/dialogs/ExpenseAnalyticsDialog.d.ts.map +1 -0
- package/dist/chat/dialogs/ExpenseAnalyticsDialog.js +52 -0
- package/dist/chat/dialogs/GroupInfoDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/GroupInfoDialog.js +55 -92
- package/dist/chat/dialogs/GroupInfoViewDialog.js +5 -6
- package/dist/chat/dialogs/NewChatDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/NewChatDialog.js +49 -113
- package/dist/chat/dialogs/NewGroupDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/NewGroupDialog.js +49 -92
- package/dist/chat/dialogs/ParticipantsDialog.d.ts.map +1 -1
- package/dist/chat/dialogs/ParticipantsDialog.js +68 -118
- package/dist/dashboard/action-buttons.js +4 -5
- package/dist/dashboard/app-sidebar.js +47 -129
- package/dist/dashboard/card-header.js +1 -2
- package/dist/dashboard/dashboard-components.js +3 -5
- package/dist/dashboard/data-table.d.ts +2 -1
- package/dist/dashboard/data-table.d.ts.map +1 -1
- package/dist/dashboard/data-table.js +21 -33
- package/dist/dashboard/nav-main.js +4 -5
- package/dist/dashboard/nav-secondary.js +2 -25
- package/dist/dashboard/stats-card.js +1 -2
- package/dist/dashboard/table.js +8 -54
- package/dist/header/mobile-nav-item.js +1 -2
- package/dist/header/mobile-navbar.js +8 -9
- package/dist/header/nav-item.js +1 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/main/footer.js +5 -9
- package/dist/main/navbar.js +55 -138
- package/dist/main/paginationBar.js +12 -14
- package/dist/main/portfolio/portfolioItem.js +1 -2
- package/dist/main/portfolio/portfolioPopup.js +16 -17
- package/dist/main/review-page.d.ts.map +1 -1
- package/dist/main/review-page.js +132 -199
- package/dist/misc/accordion.js +8 -34
- package/dist/misc/alert-dialog.js +22 -55
- package/dist/misc/alert.js +7 -32
- package/dist/misc/alertdialogclaude.js +50 -125
- package/dist/misc/avatar.js +6 -31
- package/dist/misc/badge.js +4 -27
- package/dist/misc/button.js +4 -27
- package/dist/misc/card.js +12 -40
- package/dist/misc/carousel.js +37 -61
- package/dist/misc/checkbox.js +2 -25
- package/dist/misc/command.js +18 -49
- package/dist/misc/datepicker.js +66 -76
- package/dist/misc/dialog.js +20 -52
- package/dist/misc/document-upload-button.d.ts +12 -0
- package/dist/misc/document-upload-button.d.ts.map +1 -0
- package/dist/misc/document-upload-button.js +27 -0
- package/dist/misc/dropdown-menu.js +30 -67
- package/dist/misc/empty-state.d.ts +10 -0
- package/dist/misc/empty-state.d.ts.map +1 -0
- package/dist/misc/empty-state.js +5 -0
- package/dist/misc/faq.js +2 -3
- package/dist/misc/file-preview.js +43 -97
- package/dist/misc/filter.d.ts.map +1 -1
- package/dist/misc/filter.js +18 -21
- package/dist/misc/filterBar.js +136 -160
- package/dist/misc/form.js +39 -60
- package/dist/misc/image-compressor.d.ts +29 -0
- package/dist/misc/image-compressor.d.ts.map +1 -0
- package/dist/misc/image-compressor.js +70 -0
- package/dist/misc/image-cropper.d.ts +10 -0
- package/dist/misc/image-cropper.d.ts.map +1 -0
- package/dist/misc/image-cropper.js +44 -0
- package/dist/misc/input.d.ts.map +1 -1
- package/dist/misc/input.js +2 -25
- package/dist/misc/label.js +2 -25
- package/dist/misc/line-carousel.js +3 -13
- package/dist/misc/multiImageUploader.d.ts +2 -1
- package/dist/misc/multiImageUploader.d.ts.map +1 -1
- package/dist/misc/multiImageUploader.js +26 -3
- package/dist/misc/newsLetter.js +19 -79
- package/dist/misc/notification.d.ts +1 -2
- package/dist/misc/notification.d.ts.map +1 -1
- package/dist/misc/notification.js +89 -125
- package/dist/misc/pagination.js +16 -45
- package/dist/misc/password-eye.js +2 -3
- package/dist/misc/popover.d.ts.map +1 -1
- package/dist/misc/popover.js +8 -34
- package/dist/misc/progress.js +2 -25
- package/dist/misc/pwa-install-button.d.ts +9 -0
- package/dist/misc/pwa-install-button.d.ts.map +1 -0
- package/dist/misc/pwa-install-button.js +158 -0
- package/dist/misc/scroll-area.js +5 -29
- package/dist/misc/searchBar.js +27 -31
- package/dist/misc/searchBox.js +18 -22
- package/dist/misc/select.d.ts.map +1 -1
- package/dist/misc/select.js +22 -54
- package/dist/misc/separator.js +2 -25
- package/dist/misc/share.js +48 -104
- package/dist/misc/sheet.js +21 -53
- package/dist/misc/sidebar.js +112 -153
- package/dist/misc/skeleton.d.ts +36 -1
- package/dist/misc/skeleton.d.ts.map +1 -1
- package/dist/misc/skeleton.js +41 -27
- package/dist/misc/slider.js +3 -26
- package/dist/misc/starRating.js +5 -15
- package/dist/misc/stateCard.js +7 -8
- package/dist/misc/switch.d.ts +5 -0
- package/dist/misc/switch.d.ts.map +1 -0
- package/dist/misc/switch.js +8 -0
- package/dist/misc/tabs.js +8 -34
- package/dist/misc/textarea.js +2 -25
- package/dist/misc/tile.js +32 -93
- package/dist/misc/tooltip.js +8 -34
- package/dist/misc/whatsapp-help.d.ts +9 -0
- package/dist/misc/whatsapp-help.d.ts.map +1 -0
- package/dist/misc/whatsapp-help.js +13 -0
- package/dist/profile/socialLink.d.ts +1 -1
- package/dist/profile/socialLink.d.ts.map +1 -1
- package/dist/profile/socialLink.js +53 -69
- package/dist/utils/permissions.d.ts +7 -0
- package/dist/utils/permissions.d.ts.map +1 -0
- package/dist/utils/permissions.js +38 -0
- package/package.json +6 -4
- package/dist/main/portfolio/temp-page.d.ts +0 -2
- package/dist/main/portfolio/temp-page.d.ts.map +0 -1
- package/dist/main/portfolio/temp-page.js +0 -102
package/dist/misc/dialog.js
CHANGED
|
@@ -1,68 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
3
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
26
4
|
import { cn } from "@myrjfa/state/dist/lib/utils";
|
|
27
5
|
import { XIcon } from "lucide-react";
|
|
28
|
-
function Dialog(
|
|
29
|
-
|
|
30
|
-
return _jsx(DialogPrimitive.Root, __assign({ "data-slot": "dialog" }, props));
|
|
6
|
+
function Dialog({ ...props }) {
|
|
7
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
31
8
|
}
|
|
32
|
-
function DialogTrigger(
|
|
33
|
-
|
|
34
|
-
return _jsx(DialogPrimitive.Trigger, __assign({ "data-slot": "dialog-trigger" }, props));
|
|
9
|
+
function DialogTrigger({ ...props }) {
|
|
10
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
35
11
|
}
|
|
36
|
-
function DialogPortal(
|
|
37
|
-
|
|
38
|
-
return _jsx(DialogPrimitive.Portal, __assign({ "data-slot": "dialog-portal" }, props));
|
|
12
|
+
function DialogPortal({ ...props }) {
|
|
13
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
39
14
|
}
|
|
40
|
-
function DialogClose(
|
|
41
|
-
|
|
42
|
-
return _jsx(DialogPrimitive.Close, __assign({ "data-slot": "dialog-close" }, props));
|
|
15
|
+
function DialogClose({ ...props }) {
|
|
16
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
43
17
|
}
|
|
44
|
-
function DialogOverlay(
|
|
45
|
-
|
|
46
|
-
return (_jsx(DialogPrimitive.Overlay, __assign({ "data-slot": "dialog-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", className) }, props)));
|
|
18
|
+
function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", className), ...props }));
|
|
47
20
|
}
|
|
48
|
-
function DialogContent(
|
|
49
|
-
|
|
50
|
-
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, __assign({ "data-slot": "dialog-content", className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className) }, props, { children: [children, _jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] })] }))] }));
|
|
21
|
+
function DialogContent({ className, children, ...props }) {
|
|
22
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] })] })] }));
|
|
51
23
|
}
|
|
52
|
-
function DialogHeader(
|
|
53
|
-
|
|
54
|
-
return (_jsx("div", __assign({ "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className) }, props)));
|
|
24
|
+
function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props }));
|
|
55
26
|
}
|
|
56
|
-
function DialogFooter(
|
|
57
|
-
|
|
58
|
-
return (_jsx("div", __assign({ "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className) }, props)));
|
|
27
|
+
function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props }));
|
|
59
29
|
}
|
|
60
|
-
function DialogTitle(
|
|
61
|
-
|
|
62
|
-
return (_jsx(DialogPrimitive.Title, __assign({ "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className) }, props)));
|
|
30
|
+
function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props }));
|
|
63
32
|
}
|
|
64
|
-
function DialogDescription(
|
|
65
|
-
|
|
66
|
-
return (_jsx(DialogPrimitive.Description, __assign({ "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className) }, props)));
|
|
33
|
+
function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
67
35
|
}
|
|
68
36
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type UploadType = "image" | "document" | "both";
|
|
2
|
+
interface FileUploadProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
type?: UploadType;
|
|
6
|
+
value?: File | null;
|
|
7
|
+
onChange: (file: File | null) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function FileUpload({ label, required, type, value, onChange, className, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=document-upload-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-upload-button.d.ts","sourceRoot":"","sources":["../../src/misc/document-upload-button.tsx"],"names":[],"mappings":"AAMA,KAAK,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhD,UAAU,eAAe;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EACvB,KAAqB,EACrB,QAAQ,EACR,IAAa,EACb,KAAK,EACL,QAAQ,EACR,SAAS,GACZ,EAAE,eAAe,2CAmEjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { cn } from "@myrjfa/state/dist/lib/utils";
|
|
4
|
+
import { FileUp, ImageIcon, FileText } from "lucide-react";
|
|
5
|
+
import { Input } from "./input";
|
|
6
|
+
import { Label } from "./label";
|
|
7
|
+
export function FileUpload({ label = "Upload File", required, type = "both", value, onChange, className, }) {
|
|
8
|
+
const inputRef = useRef(null);
|
|
9
|
+
const acceptMap = {
|
|
10
|
+
image: "image/*",
|
|
11
|
+
document: "application/pdf",
|
|
12
|
+
both: "application/pdf,image/*",
|
|
13
|
+
};
|
|
14
|
+
const helperTextMap = {
|
|
15
|
+
image: "Image only",
|
|
16
|
+
document: "PDF only",
|
|
17
|
+
both: "PDF or image",
|
|
18
|
+
};
|
|
19
|
+
const Icon = type === "image"
|
|
20
|
+
? ImageIcon
|
|
21
|
+
: type === "document"
|
|
22
|
+
? FileText
|
|
23
|
+
: FileUp;
|
|
24
|
+
return (_jsxs("div", { className: cn("w-full", className), children: [_jsxs(Label, { className: "text-sm font-medium", children: [label, " ", required && _jsx("span", { className: "text-destructive", children: "*" }), _jsxs("span", { className: "text-xs text-muted-foreground ml-2", children: ["(", helperTextMap[type], ")"] })] }), _jsxs("div", { onClick: () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, className: cn("mt-2 border-2 border-dashed rounded-lg cursor-pointer transition-all", "flex flex-col items-center justify-center text-center", "hover:border-primary/50",
|
|
25
|
+
// 📱 Responsive sizing
|
|
26
|
+
"p-3"), children: [_jsx(Icon, { className: "w-5 h-5 sm:w-6 sm:h-6 text-muted-foreground mb-1" }), value ? (_jsx("p", { className: "text-xs sm:text-sm text-primary font-medium break-all", children: value.name })) : (_jsx("p", { className: "text-xs sm:text-sm text-muted-foreground", children: "Tap or click to upload" })), _jsx(Input, { ref: inputRef, type: "file", accept: acceptMap[type], className: "hidden", onChange: (e) => { var _a, _b; return onChange((_b = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null); } })] })] }));
|
|
27
|
+
}
|
|
@@ -1,88 +1,51 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
3
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
26
4
|
import { cn } from "@myrjfa/state/dist/lib/utils";
|
|
27
5
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
28
|
-
function DropdownMenu(
|
|
29
|
-
|
|
30
|
-
return _jsx(DropdownMenuPrimitive.Root, __assign({ "data-slot": "dropdown-menu" }, props));
|
|
6
|
+
function DropdownMenu({ ...props }) {
|
|
7
|
+
return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
31
8
|
}
|
|
32
|
-
function DropdownMenuPortal(
|
|
33
|
-
|
|
34
|
-
return (_jsx(DropdownMenuPrimitive.Portal, __assign({ "data-slot": "dropdown-menu-portal" }, props)));
|
|
9
|
+
function DropdownMenuPortal({ ...props }) {
|
|
10
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props }));
|
|
35
11
|
}
|
|
36
|
-
function DropdownMenuTrigger(
|
|
37
|
-
|
|
38
|
-
return (_jsx(DropdownMenuPrimitive.Trigger, __assign({ "data-slot": "dropdown-menu-trigger" }, props)));
|
|
12
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
13
|
+
return (_jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props }));
|
|
39
14
|
}
|
|
40
|
-
function DropdownMenuContent(
|
|
41
|
-
|
|
42
|
-
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, __assign({ "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className) }, props)) }));
|
|
15
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
16
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className), ...props }) }));
|
|
43
17
|
}
|
|
44
|
-
function DropdownMenuGroup(
|
|
45
|
-
|
|
46
|
-
return (_jsx(DropdownMenuPrimitive.Group, __assign({ "data-slot": "dropdown-menu-group" }, props)));
|
|
18
|
+
function DropdownMenuGroup({ ...props }) {
|
|
19
|
+
return (_jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props }));
|
|
47
20
|
}
|
|
48
|
-
function DropdownMenuItem(
|
|
49
|
-
|
|
50
|
-
return (_jsx(DropdownMenuPrimitive.Item, __assign({ "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/40 data-[variant=destructive]:focus:text-destructive-foreground data-[variant=destructive]:*:[svg]:!text-destructive-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
|
|
21
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
22
|
+
return (_jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/40 data-[variant=destructive]:focus:text-destructive-foreground data-[variant=destructive]:*:[svg]:!text-destructive-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
51
23
|
}
|
|
52
|
-
function DropdownMenuCheckboxItem(
|
|
53
|
-
|
|
54
|
-
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, __assign({ "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked }, props, { children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), children] })));
|
|
24
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
25
|
+
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked, ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), children] }));
|
|
55
26
|
}
|
|
56
|
-
function DropdownMenuRadioGroup(
|
|
57
|
-
|
|
58
|
-
return (_jsx(DropdownMenuPrimitive.RadioGroup, __assign({ "data-slot": "dropdown-menu-radio-group" }, props)));
|
|
27
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
28
|
+
return (_jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props }));
|
|
59
29
|
}
|
|
60
|
-
function DropdownMenuRadioItem(
|
|
61
|
-
|
|
62
|
-
return (_jsxs(DropdownMenuPrimitive.RadioItem, __assign({ "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props, { children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] })));
|
|
30
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
31
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] }));
|
|
63
32
|
}
|
|
64
|
-
function DropdownMenuLabel(
|
|
65
|
-
|
|
66
|
-
return (_jsx(DropdownMenuPrimitive.Label, __assign({ "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className) }, props)));
|
|
33
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
34
|
+
return (_jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className), ...props }));
|
|
67
35
|
}
|
|
68
|
-
function DropdownMenuSeparator(
|
|
69
|
-
|
|
70
|
-
return (_jsx(DropdownMenuPrimitive.Separator, __assign({ "data-slot": "dropdown-menu-separator", className: cn("bg-border -mx-1 my-1 h-px", className) }, props)));
|
|
36
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
37
|
+
return (_jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn("bg-border -mx-1 my-1 h-px", className), ...props }));
|
|
71
38
|
}
|
|
72
|
-
function DropdownMenuShortcut(
|
|
73
|
-
|
|
74
|
-
return (_jsx("span", __assign({ "data-slot": "dropdown-menu-shortcut", className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className) }, props)));
|
|
39
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
40
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className), ...props }));
|
|
75
41
|
}
|
|
76
|
-
function DropdownMenuSub(
|
|
77
|
-
|
|
78
|
-
return _jsx(DropdownMenuPrimitive.Sub, __assign({ "data-slot": "dropdown-menu-sub" }, props));
|
|
42
|
+
function DropdownMenuSub({ ...props }) {
|
|
43
|
+
return _jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
79
44
|
}
|
|
80
|
-
function DropdownMenuSubTrigger(
|
|
81
|
-
|
|
82
|
-
return (_jsxs(DropdownMenuPrimitive.SubTrigger, __assign({ "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className) }, props, { children: [children, _jsx(ChevronRightIcon, { className: "ml-auto size-4" })] })));
|
|
45
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
46
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "ml-auto size-4" })] }));
|
|
83
47
|
}
|
|
84
|
-
function DropdownMenuSubContent(
|
|
85
|
-
|
|
86
|
-
return (_jsx(DropdownMenuPrimitive.SubContent, __assign({ "data-slot": "dropdown-menu-sub-content", className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg", className) }, props)));
|
|
48
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
49
|
+
return (_jsx(DropdownMenuPrimitive.SubContent, { "data-slot": "dropdown-menu-sub-content", className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg", className), ...props }));
|
|
87
50
|
}
|
|
88
51
|
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface EmptyStateProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
action?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function EmptyState({ title, description, icon, action, }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/misc/empty-state.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,eAAe;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EACvB,KAA0B,EAC1B,WAAW,EACX,IAAI,EACJ,MAAM,GACT,EAAE,eAAe,2CAajB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Inbox } from 'lucide-react';
|
|
3
|
+
export function EmptyState({ title = 'Nothing here yet', description, icon, action, }) {
|
|
4
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center py-16 px-4 text-center gap-3", children: [_jsx("div", { className: "text-muted-foreground", children: icon !== null && icon !== void 0 ? icon : _jsx(Inbox, { className: "w-12 h-12 mx-auto mb-2 opacity-40" }) }), _jsx("h3", { className: "text-lg font-semibold text-foreground", children: title }), description && (_jsx("p", { className: "text-sm text-muted-foreground max-w-xs", children: description })), action && _jsx("div", { className: "mt-2", children: action })] }));
|
|
5
|
+
}
|
package/dist/misc/faq.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './accordion';
|
|
3
|
-
export default function Faq(
|
|
4
|
-
|
|
5
|
-
return (_jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold text-center mb-6", children: "Frequently Asked Questions" }), _jsx(Accordion, { type: "multiple", className: "space-y-2", children: faqs.map(function (faq, index) { return (_jsxs(AccordionItem, { value: "item-".concat(index), className: "border border-gray-200 rounded-lg last:border-b", children: [_jsx(AccordionTrigger, { className: "text-left px-4 py-3 font-medium", children: faq.question }), _jsx(AccordionContent, { className: "px-4 pb-4 text-sm text-gray-600", children: faq.answer })] }, index)); }) })] }));
|
|
3
|
+
export default function Faq({ faqs }) {
|
|
4
|
+
return (_jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold text-center mb-6", children: "Frequently Asked Questions" }), _jsx(Accordion, { type: "multiple", className: "space-y-2", children: faqs.map((faq, index) => (_jsxs(AccordionItem, { value: `item-${index}`, className: "border border-gray-200 rounded-lg last:border-b", children: [_jsx(AccordionTrigger, { className: "text-left px-4 py-3 font-medium", children: faq.question }), _jsx(AccordionContent, { className: "px-4 pb-4 text-sm text-gray-600", children: faq.answer })] }, index))) })] }));
|
|
6
5
|
}
|
|
@@ -1,46 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
3
|
import { FileIcon, ImageIcon, VideoIcon } from 'lucide-react';
|
|
40
4
|
import { useState } from 'react';
|
|
41
5
|
import { showAlert } from './alertdialogclaude';
|
|
42
6
|
import { Button } from './button';
|
|
43
|
-
|
|
7
|
+
const mimeMap = {
|
|
44
8
|
'.pdf': 'application/pdf',
|
|
45
9
|
'.jpg': 'image/jpeg',
|
|
46
10
|
'.jpeg': 'image/jpeg',
|
|
@@ -52,16 +16,15 @@ var mimeMap = {
|
|
|
52
16
|
'.mov': 'video/quicktime',
|
|
53
17
|
// Add more as needed
|
|
54
18
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var IconInternal = icon || _jsx(FileIcon, { className: "h-8 w-8 text-chart-2" });
|
|
19
|
+
const imageTypes = ["jpg", "jpeg", "png", "gif", "webp"];
|
|
20
|
+
const videotypes = ["mp4", "webm"];
|
|
21
|
+
const docTypes = ["pdf"];
|
|
22
|
+
const DocumentPreviewButton = ({ filepath, label, icon, size = 'default', labelInMobile = false, }) => {
|
|
23
|
+
const [loading, setLoading] = useState(false);
|
|
24
|
+
let labelInternal = label;
|
|
25
|
+
let IconInternal = icon || _jsx(FileIcon, { className: "h-8 w-8 text-chart-2" });
|
|
63
26
|
if (typeof filepath === 'string') {
|
|
64
|
-
|
|
27
|
+
const ext = filepath.split('.').pop() || "unknown";
|
|
65
28
|
if (imageTypes.includes(ext)) {
|
|
66
29
|
labelInternal = label || "View Image";
|
|
67
30
|
IconInternal = icon || _jsx(ImageIcon, { className: "h-8 w-8 text-chart-2" });
|
|
@@ -74,57 +37,40 @@ var DocumentPreviewButton = function (_a) {
|
|
|
74
37
|
labelInternal = label || "View Doc";
|
|
75
38
|
}
|
|
76
39
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
case 4:
|
|
96
|
-
rawBlob = _a.sent();
|
|
97
|
-
console.log('Blob type:', rawBlob.type);
|
|
98
|
-
matchedExt = Object.keys(mimeMap).find(function (ext) { return filepath.toLowerCase().endsWith(ext); });
|
|
99
|
-
type = matchedExt ? mimeMap[matchedExt] : rawBlob.type;
|
|
100
|
-
blob = new Blob([rawBlob], { type: type }); // Force correct type
|
|
101
|
-
return [3 /*break*/, 8];
|
|
102
|
-
case 5:
|
|
103
|
-
if (!(filepath instanceof File)) return [3 /*break*/, 6];
|
|
104
|
-
blob = new Blob([filepath], { type: 'application/pdf' });
|
|
105
|
-
return [3 /*break*/, 8];
|
|
106
|
-
case 6: return [4 /*yield*/, showAlert('Invalid file')];
|
|
107
|
-
case 7:
|
|
108
|
-
_a.sent();
|
|
109
|
-
return [2 /*return*/];
|
|
110
|
-
case 8:
|
|
111
|
-
fileURL = URL.createObjectURL(blob);
|
|
112
|
-
window.open(fileURL, '_blank', 'noopener,noreferrer');
|
|
113
|
-
return [3 /*break*/, 12];
|
|
114
|
-
case 9:
|
|
115
|
-
error_1 = _a.sent();
|
|
116
|
-
console.error('Error opening file:', error_1);
|
|
117
|
-
return [4 /*yield*/, showAlert('Could not open document.')];
|
|
118
|
-
case 10:
|
|
119
|
-
_a.sent();
|
|
120
|
-
return [3 /*break*/, 12];
|
|
121
|
-
case 11:
|
|
122
|
-
setLoading(false);
|
|
123
|
-
return [7 /*endfinally*/];
|
|
124
|
-
case 12: return [2 /*return*/];
|
|
40
|
+
const handleOpenFile = async () => {
|
|
41
|
+
try {
|
|
42
|
+
setLoading(true);
|
|
43
|
+
let blob;
|
|
44
|
+
if (typeof filepath === 'string') {
|
|
45
|
+
const response = await fetch(filepath);
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
await showAlert('Error fetching file');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const rawBlob = await response.blob();
|
|
51
|
+
console.log('Blob type:', rawBlob.type);
|
|
52
|
+
const matchedExt = Object.keys(mimeMap).find(ext => filepath.toLowerCase().endsWith(ext));
|
|
53
|
+
const type = matchedExt ? mimeMap[matchedExt] : rawBlob.type;
|
|
54
|
+
blob = new Blob([rawBlob], { type: type }); // Force correct type
|
|
55
|
+
}
|
|
56
|
+
else if (filepath instanceof File) {
|
|
57
|
+
blob = new Blob([filepath], { type: 'application/pdf' });
|
|
125
58
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
59
|
+
else {
|
|
60
|
+
await showAlert('Invalid file');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const fileURL = URL.createObjectURL(blob);
|
|
64
|
+
window.open(fileURL, '_blank', 'noopener,noreferrer');
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('Error opening file:', error);
|
|
68
|
+
await showAlert('Could not open document.');
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
setLoading(false);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_jsx("div", { className: "flex flex-col items-center", children: _jsxs(Button, { variant: "outline", size: size, className: "w-full cursor-pointer flex md:flex", onClick: handleOpenFile, disabled: loading, children: [IconInternal, _jsx("span", { className: `${labelInMobile ? "inline" : "hidden"} md:inline`, children: labelInternal })] }) }));
|
|
129
75
|
};
|
|
130
76
|
export default DocumentPreviewButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/misc/filter.tsx"],"names":[],"mappings":"AAsBA,KAAK,WAAW,GAAG;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AACF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,aACwC,CAAC;AAElF,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/misc/filter.tsx"],"names":[],"mappings":"AAsBA,KAAK,WAAW,GAAG;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AACF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,aACwC,CAAC;AAElF,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAqHjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/misc/filter.js
CHANGED
|
@@ -8,40 +8,37 @@ import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from ".
|
|
|
8
8
|
import { Input } from "./input";
|
|
9
9
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
10
10
|
import { Select, SelectContent, SelectItem, SelectTrigger } from "./select";
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _f = useState(""), customValue = _f[0], setCustomValue = _f[1];
|
|
22
|
-
var data = uniqDecoded(values);
|
|
23
|
-
useEffect(function () {
|
|
11
|
+
export const uniqDecoded = (arr) => Array.from(new Set(arr.map(v => decodeURIComponent(v.trim().toLowerCase()))));
|
|
12
|
+
const Filter = ({ values, label, formType, selectedValue, onChange, others }) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const [open, setOpen] = useState(false);
|
|
15
|
+
const [popoverWidth, setPopoverWidth] = useState(0);
|
|
16
|
+
const triggerRef = useRef(null);
|
|
17
|
+
const [isCustom, setIsCustom] = useState(false);
|
|
18
|
+
const [customValue, setCustomValue] = useState("");
|
|
19
|
+
const data = uniqDecoded(values);
|
|
20
|
+
useEffect(() => {
|
|
24
21
|
if (triggerRef.current) {
|
|
25
22
|
setPopoverWidth(triggerRef.current.offsetWidth);
|
|
26
23
|
}
|
|
27
|
-
}, [(
|
|
28
|
-
useEffect(
|
|
24
|
+
}, [(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth]);
|
|
25
|
+
useEffect(() => {
|
|
29
26
|
if (!open) {
|
|
30
27
|
setIsCustom(false);
|
|
31
28
|
setCustomValue("");
|
|
32
29
|
}
|
|
33
30
|
}, [open]);
|
|
34
|
-
return (_jsx("div", { className: cn("filter-container", label), children: formType === "select" ? (_jsxs(Select, { value: selectedValue !== null && selectedValue !== void 0 ? selectedValue : "", onValueChange:
|
|
35
|
-
?
|
|
36
|
-
: selectedValue }), _jsxs(SelectContent, { className: "w-full z-
|
|
31
|
+
return (_jsx("div", { className: cn("filter-container", label), children: formType === "select" ? (_jsxs(Select, { value: selectedValue !== null && selectedValue !== void 0 ? selectedValue : "", onValueChange: (val) => onChange(val === "clear" ? null : val), children: [_jsx(SelectTrigger, { className: "w-full bg-transparent hover:bg-muted border-none shadow-none", children: !selectedValue || selectedValue === "clear" || selectedValue[0] == '0'
|
|
32
|
+
? `Choose ${label.toLowerCase()}...`
|
|
33
|
+
: selectedValue }), _jsxs(SelectContent, { className: "w-full z-[301]", children: [_jsx(SelectItem, { value: "clear", children: _jsx("em", { children: "Clear" }) }), data.map((option) => (_jsx(SelectItem, { value: option, children: option }, option)))] })] })) : (_jsxs(Popover, { open: open, onOpenChange: setOpen, modal: false, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { ref: triggerRef, variant: "ghost", role: "combobox", className: "filter-box justify-between w-full", children: [selectedValue || `Select ${label.toLowerCase()}...`, _jsx(ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsxs(PopoverContent, { className: "p-0 z-[310] pointer-events-auto overflow-hidden", style: { width: popoverWidth > 0 ? `${popoverWidth}px` : 'auto', minWidth: 'min(300px, 90vw)' }, align: "start", onWheel: (e) => e.stopPropagation(), children: [_jsxs(Command, { children: [_jsx(CommandInput, { placeholder: `Search ${label.toLowerCase()}...` }), _jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandList, { children: data.map((option) => (_jsxs(CommandItem, { value: option, onSelect: () => {
|
|
37
34
|
onChange(option);
|
|
38
35
|
setOpen(false);
|
|
39
|
-
}, children: [_jsx(Check, { className: cn("mr-2 h-4 w-4", selectedValue === option ? "opacity-100" : "opacity-0") }), option] }, option))
|
|
40
|
-
(_jsx("div", { children: isCustom ? (_jsx("div", { className: "border-t px-5 py-2", children: _jsx(Input, { placeholder:
|
|
36
|
+
}, children: [_jsx(Check, { className: cn("mr-2 h-4 w-4", selectedValue === option ? "opacity-100" : "opacity-0") }), option] }, option))) })] }), others &&
|
|
37
|
+
(_jsx("div", { children: isCustom ? (_jsx("div", { className: "border-t px-5 py-2", children: _jsx(Input, { placeholder: `Enter other ${label.toLowerCase()}`, value: customValue, onChange: (e) => setCustomValue(e.target.value), onKeyDown: (e) => {
|
|
41
38
|
if (e.key === "Enter" && customValue.trim()) {
|
|
42
39
|
onChange(customValue.trim());
|
|
43
40
|
setOpen(false);
|
|
44
41
|
}
|
|
45
|
-
}, autoFocus: true }) })) : (_jsx("div", { className: "border-t px-10 py-2 cursor-pointer text-sm hover:bg-muted", onClick:
|
|
42
|
+
}, autoFocus: true }) })) : (_jsx("div", { className: "border-t px-10 py-2 cursor-pointer text-sm hover:bg-muted", onClick: () => setIsCustom(true), children: "Other" })) }))] })] })) }));
|
|
46
43
|
};
|
|
47
44
|
export default Filter;
|