sea-react-components 1.0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/HOC/can-access-application/index.d.ts +9 -0
- package/dist/HOC/can-access-application/index.d.ts.map +1 -0
- package/dist/HOC/can-access-application/index.js +11 -0
- package/dist/HOC/with-authorization/index.d.ts +12 -0
- package/dist/HOC/with-authorization/index.d.ts.map +1 -0
- package/dist/HOC/with-authorization/index.js +23 -0
- package/dist/components/alert/index.d.ts +12 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/alert/index.js +51 -0
- package/dist/components/avatar/index.d.ts +10 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +26 -0
- package/dist/components/badge/index.d.ts +8 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +33 -0
- package/dist/components/breadcrumb/index.d.ts +7 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +8 -0
- package/dist/components/button/index.d.ts +6 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +18 -0
- package/dist/components/carousel/index.d.ts +17 -0
- package/dist/components/carousel/index.d.ts.map +1 -0
- package/dist/components/carousel/index.js +89 -0
- package/dist/components/checkbox/index.d.ts +11 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/checkbox/index.js +15 -0
- package/dist/components/color-picker/index.d.ts +8 -0
- package/dist/components/color-picker/index.d.ts.map +1 -0
- package/dist/components/color-picker/index.js +21 -0
- package/dist/components/count-down/index.d.ts +6 -0
- package/dist/components/count-down/index.d.ts.map +1 -0
- package/dist/components/count-down/index.js +32 -0
- package/dist/components/drawer/index.d.ts +12 -0
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/drawer/index.js +15 -0
- package/dist/components/file-input/components/file-item/index.d.ts +9 -0
- package/dist/components/file-input/components/file-item/index.d.ts.map +1 -0
- package/dist/components/file-input/components/file-item/index.js +10 -0
- package/dist/components/file-input/index.d.ts +44 -0
- package/dist/components/file-input/index.d.ts.map +1 -0
- package/dist/components/file-input/index.js +85 -0
- package/dist/components/icon/index.d.ts +7 -0
- package/dist/components/icon/index.d.ts.map +1 -0
- package/dist/components/icon/index.js +5 -0
- package/dist/components/input/index.d.ts +9 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +33 -0
- package/dist/components/list-item/components/page-button/index.d.ts +8 -0
- package/dist/components/list-item/components/page-button/index.d.ts.map +1 -0
- package/dist/components/list-item/components/page-button/index.js +8 -0
- package/dist/components/list-item/components/pagination/index.d.ts +9 -0
- package/dist/components/list-item/components/pagination/index.d.ts.map +1 -0
- package/dist/components/list-item/components/pagination/index.js +49 -0
- package/dist/components/list-item/components/search-input/index.d.ts +7 -0
- package/dist/components/list-item/components/search-input/index.d.ts.map +1 -0
- package/dist/components/list-item/components/search-input/index.js +38 -0
- package/dist/components/list-item/index.d.ts +26 -0
- package/dist/components/list-item/index.d.ts.map +1 -0
- package/dist/components/list-item/index.js +23 -0
- package/dist/components/loader/index.d.ts +6 -0
- package/dist/components/loader/index.d.ts.map +1 -0
- package/dist/components/loader/index.js +5 -0
- package/dist/components/menu/index.d.ts +9 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +19 -0
- package/dist/components/menu/menu-item/index.d.ts +10 -0
- package/dist/components/menu/menu-item/index.d.ts.map +1 -0
- package/dist/components/menu/menu-item/index.js +19 -0
- package/dist/components/modal/index.d.ts +12 -0
- package/dist/components/modal/index.d.ts.map +1 -0
- package/dist/components/modal/index.js +41 -0
- package/dist/components/not-authorized/index.d.ts +2 -0
- package/dist/components/not-authorized/index.d.ts.map +1 -0
- package/dist/components/not-authorized/index.js +5 -0
- package/dist/components/otp-input/index.d.ts +7 -0
- package/dist/components/otp-input/index.d.ts.map +1 -0
- package/dist/components/otp-input/index.js +35 -0
- package/dist/components/paper/index.d.ts +4 -0
- package/dist/components/paper/index.d.ts.map +1 -0
- package/dist/components/paper/index.js +17 -0
- package/dist/components/progress-bar/index.d.ts +11 -0
- package/dist/components/progress-bar/index.d.ts.map +1 -0
- package/dist/components/progress-bar/index.js +32 -0
- package/dist/components/radio-button/index.d.ts +10 -0
- package/dist/components/radio-button/index.d.ts.map +1 -0
- package/dist/components/radio-button/index.js +17 -0
- package/dist/components/select/index.d.ts +16 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/index.js +36 -0
- package/dist/components/skeleton/index.d.ts +4 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +5 -0
- package/dist/components/stacked-avatars/index.d.ts +10 -0
- package/dist/components/stacked-avatars/index.d.ts.map +1 -0
- package/dist/components/stacked-avatars/index.js +23 -0
- package/dist/components/tab/index.d.ts +16 -0
- package/dist/components/tab/index.d.ts.map +1 -0
- package/dist/components/tab/index.js +23 -0
- package/dist/components/table/index.d.ts +22 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +67 -0
- package/dist/components/text-editor/components/toolbar/index.d.ts +9 -0
- package/dist/components/text-editor/components/toolbar/index.d.ts.map +1 -0
- package/dist/components/text-editor/components/toolbar/index.js +280 -0
- package/dist/components/text-editor/index.d.ts +12 -0
- package/dist/components/text-editor/index.d.ts.map +1 -0
- package/dist/components/text-editor/index.js +152 -0
- package/dist/components/text-editor/style.css +132 -0
- package/dist/components/text-editor/utils/index.d.ts +14 -0
- package/dist/components/text-editor/utils/index.d.ts.map +1 -0
- package/dist/components/text-editor/utils/index.js +82 -0
- package/dist/components/textarea/index.d.ts +7 -0
- package/dist/components/textarea/index.d.ts.map +1 -0
- package/dist/components/textarea/index.js +24 -0
- package/dist/components/toggle/index.d.ts +8 -0
- package/dist/components/toggle/index.d.ts.map +1 -0
- package/dist/components/toggle/index.js +12 -0
- package/dist/components/tooltip/index.d.ts +10 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/index.js +15 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.d.ts +10 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/components/tree-checkbox-item/index.js +10 -0
- package/dist/components/tree-checkbox/index.d.ts +26 -0
- package/dist/components/tree-checkbox/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/index.js +62 -0
- package/dist/components/tree-checkbox/utils/index.d.ts +9 -0
- package/dist/components/tree-checkbox/utils/index.d.ts.map +1 -0
- package/dist/components/tree-checkbox/utils/index.js +14 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/hooks/list-items-hook/types.d.ts +18 -0
- package/dist/hooks/list-items-hook/types.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/types.js +1 -0
- package/dist/hooks/list-items-hook/useBulkActions.d.ts +3 -0
- package/dist/hooks/list-items-hook/useBulkActions.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/useBulkActions.js +8 -0
- package/dist/hooks/list-items-hook/useFilters.d.ts +3 -0
- package/dist/hooks/list-items-hook/useFilters.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/useFilters.js +27 -0
- package/dist/hooks/list-items-hook/usePagination.d.ts +2 -0
- package/dist/hooks/list-items-hook/usePagination.d.ts.map +1 -0
- package/dist/hooks/list-items-hook/usePagination.js +21 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/styles.css +7 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/axios/index.d.ts +7 -0
- package/dist/utils/axios/index.d.ts.map +1 -0
- package/dist/utils/axios/index.js +23 -0
- package/dist/utils/color/index.d.ts +7 -0
- package/dist/utils/color/index.d.ts.map +1 -0
- package/dist/utils/color/index.js +22 -0
- package/dist/utils/file/index.d.ts +2 -0
- package/dist/utils/file/index.d.ts.map +1 -0
- package/dist/utils/file/index.js +8 -0
- package/dist/utils/jwt/index.d.ts +2 -0
- package/dist/utils/jwt/index.d.ts.map +1 -0
- package/dist/utils/jwt/index.js +1 -0
- package/dist/utils/validation/index.d.ts +10 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +20 -0
- package/package.json +66 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare enum AcceptedTypes {
|
|
3
|
+
Image = "image/*",
|
|
4
|
+
Audio = "audio/*",
|
|
5
|
+
Video = "video/*",
|
|
6
|
+
PDF = "application/pdf",
|
|
7
|
+
TEXT = "text/plain"
|
|
8
|
+
}
|
|
9
|
+
type AcceptedValuesArray = (AcceptedTypes | string)[];
|
|
10
|
+
export declare enum UploadStatuses {
|
|
11
|
+
Pending = "Pending",
|
|
12
|
+
Uploading = "Uploading",
|
|
13
|
+
Uploaded = "Uploaded",
|
|
14
|
+
Failed = "Failed"
|
|
15
|
+
}
|
|
16
|
+
export type FileState = {
|
|
17
|
+
id: string;
|
|
18
|
+
serverId: string | undefined;
|
|
19
|
+
file?: File | undefined;
|
|
20
|
+
name: string;
|
|
21
|
+
size: number;
|
|
22
|
+
type: string;
|
|
23
|
+
progress: number;
|
|
24
|
+
status: UploadStatuses;
|
|
25
|
+
};
|
|
26
|
+
export type Props<T> = {
|
|
27
|
+
name: string;
|
|
28
|
+
files: FileState[];
|
|
29
|
+
setFiles: React.Dispatch<React.SetStateAction<FileState[]>>;
|
|
30
|
+
acceptedTypes?: AcceptedValuesArray;
|
|
31
|
+
multiple: boolean;
|
|
32
|
+
errorMessage?: string | boolean;
|
|
33
|
+
onUpload: (file: FileState) => Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
} & T>;
|
|
36
|
+
onDelete: (file: FileState) => Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
} & T>;
|
|
39
|
+
onUploadSuccess?: (file: T) => void;
|
|
40
|
+
onDeleteSuccess?: (file: T) => void;
|
|
41
|
+
};
|
|
42
|
+
export default function FileInput<T>({ name, files, setFiles, acceptedTypes, multiple, errorMessage, onUpload, onDelete, onUploadSuccess, onDeleteSuccess, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/file-input/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,oBAAY,aAAa;IACvB,KAAK,YAAY;IACjB,KAAK,YAAY;IACjB,KAAK,YAAY;IACjB,GAAG,oBAAoB;IACvB,IAAI,eAAe;CACpB;AAED,KAAK,mBAAmB,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC;AAEtD,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC5D,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC,CAAC;IAC3D,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACpC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,EAAE,EACnC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,aAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,eAAe,GAChB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAkIV"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useState, useRef } from "react";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
import FileItem from "./components/file-item";
|
|
15
|
+
const generateTempFileId = (type, size, name) => `(${type})-${size}-${name}`;
|
|
16
|
+
export var AcceptedTypes;
|
|
17
|
+
(function (AcceptedTypes) {
|
|
18
|
+
AcceptedTypes["Image"] = "image/*";
|
|
19
|
+
AcceptedTypes["Audio"] = "audio/*";
|
|
20
|
+
AcceptedTypes["Video"] = "video/*";
|
|
21
|
+
AcceptedTypes["PDF"] = "application/pdf";
|
|
22
|
+
AcceptedTypes["TEXT"] = "text/plain";
|
|
23
|
+
})(AcceptedTypes || (AcceptedTypes = {}));
|
|
24
|
+
export var UploadStatuses;
|
|
25
|
+
(function (UploadStatuses) {
|
|
26
|
+
UploadStatuses["Pending"] = "Pending";
|
|
27
|
+
UploadStatuses["Uploading"] = "Uploading";
|
|
28
|
+
UploadStatuses["Uploaded"] = "Uploaded";
|
|
29
|
+
UploadStatuses["Failed"] = "Failed";
|
|
30
|
+
})(UploadStatuses || (UploadStatuses = {}));
|
|
31
|
+
export default function FileInput({ name, files, setFiles, acceptedTypes = [], multiple, errorMessage, onUpload, onDelete, onUploadSuccess, onDeleteSuccess, }) {
|
|
32
|
+
const currentFileIds = files.map((file) => generateTempFileId(file.type, file.size, file.name));
|
|
33
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
34
|
+
const inputRef = useRef(null);
|
|
35
|
+
const handleFiles = (selectedFiles) => {
|
|
36
|
+
if (!selectedFiles)
|
|
37
|
+
return;
|
|
38
|
+
const selectedFilesArray = Array.from(selectedFiles);
|
|
39
|
+
const filesToUpload = selectedFilesArray.filter((f) => !currentFileIds.includes(generateTempFileId(f.type, f.size, f.name)));
|
|
40
|
+
const newFiles = filesToUpload.map((f) => ({
|
|
41
|
+
id: generateTempFileId(f.type, f.size, f.name),
|
|
42
|
+
serverId: undefined,
|
|
43
|
+
file: f,
|
|
44
|
+
type: f.type,
|
|
45
|
+
name: f.name,
|
|
46
|
+
size: f.size,
|
|
47
|
+
progress: 0,
|
|
48
|
+
status: UploadStatuses.Pending,
|
|
49
|
+
}));
|
|
50
|
+
setFiles((prev) => [...prev, ...newFiles]);
|
|
51
|
+
for (let i = 0; i < newFiles.length; i++) {
|
|
52
|
+
handleUploadFile(newFiles[i]);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const handleUploadFile = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
setFiles((prev) => prev.map((f) => f.id === file.id ? Object.assign(Object.assign({}, f), { status: UploadStatuses.Uploading }) : f));
|
|
58
|
+
const result = yield onUpload(file);
|
|
59
|
+
onUploadSuccess(result);
|
|
60
|
+
setFiles((prev) => prev.map((f) => f.id === file.id
|
|
61
|
+
? Object.assign(Object.assign({}, f), { serverId: result.id, status: UploadStatuses.Uploaded, progress: 100 }) : f));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
setFiles((prev) => prev.map((f) => f.id === file.id ? Object.assign(Object.assign({}, f), { status: UploadStatuses.Failed }) : f));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const handleDrop = (event) => {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
event.stopPropagation();
|
|
70
|
+
setIsDragging(false);
|
|
71
|
+
handleFiles(event.dataTransfer.files);
|
|
72
|
+
};
|
|
73
|
+
const handleDeleteFile = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
try {
|
|
75
|
+
const result = yield onDelete(file);
|
|
76
|
+
onDeleteSuccess(result);
|
|
77
|
+
setFiles((prev) => prev.filter((file) => file.serverId !== result.id));
|
|
78
|
+
}
|
|
79
|
+
catch (error) { }
|
|
80
|
+
});
|
|
81
|
+
return (_jsxs("div", { className: "w-full flex flex-col gap-1", children: [(!files.length || multiple) && (_jsxs("div", { className: clsx("border-0.5 px-3 py-2 rounded-xl text-center", "cursor-pointer transition-all duration-200 ease-in-out", "hover:border-primary", errorMessage ? "border-error" : isDragging && "border-primary"), onDragOver: (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
setIsDragging(true);
|
|
84
|
+
}, onDragLeave: () => setIsDragging(false), onDrop: handleDrop, onClick: () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: [_jsx("p", { className: "text-text-light", children: "Drag & Drop files here or click to select files" }), _jsx("input", { id: name, name: name, ref: inputRef, type: "file", className: "hidden", accept: acceptedTypes.join(","), multiple: multiple, onChange: (e) => handleFiles(e.target.files) })] })), _jsx("div", { className: "flex flex-nowrap gap-2 overflow-y-auto", children: files.map((f, i) => (_jsx(FileItem, { file: f, handleUploadFile: handleUploadFile, handleDeleteFile: handleDeleteFile }, `file-${name}-${i}`))) }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
|
|
85
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconifyIcon } from "@iconify/react";
|
|
2
|
+
export type Props = {
|
|
3
|
+
icon: string | IconifyIcon;
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export default function Icon({ icon, className }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,2CAEtD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { LegacyRef } from "react";
|
|
2
|
+
export type Props = {
|
|
3
|
+
ref?: LegacyRef<HTMLInputElement> | undefined;
|
|
4
|
+
errorMessage?: string | boolean;
|
|
5
|
+
start?: React.ReactNode | null;
|
|
6
|
+
end?: React.ReactNode | null;
|
|
7
|
+
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
8
|
+
export default function Input({ errorMessage, className, start, end, ref, type, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;CAC9B,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAChD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,YAAY,EACZ,SAAS,EACT,KAAY,EACZ,GAAU,EACV,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,KAAK,2CAoDP"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Icon } from "@iconify/react";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import { useState } from "react";
|
|
17
|
+
export default function Input(_a) {
|
|
18
|
+
var { errorMessage, className, start = null, end = null, ref, type } = _a, props = __rest(_a, ["errorMessage", "className", "start", "end", "ref", "type"]);
|
|
19
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
20
|
+
const [currentType, setCurrentType] = useState(type);
|
|
21
|
+
if (type === "password") {
|
|
22
|
+
end = (_jsx("button", { type: "button", onClick: () => {
|
|
23
|
+
setCurrentType(currentType === "password" ? "text" : "password");
|
|
24
|
+
}, children: _jsx(Icon, { icon: currentType === "password"
|
|
25
|
+
? "mdi:eye-outline"
|
|
26
|
+
: "mdi:eye-off-outline", className: "w-5 h-5 text-primary" }) }));
|
|
27
|
+
}
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: clsx("flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
|
|
29
|
+
? "border-error"
|
|
30
|
+
: isFocused
|
|
31
|
+
? "border-primary"
|
|
32
|
+
: "border-gray-200"), children: [start, _jsx("input", Object.assign({ ref: ref, type: currentType, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), className: clsx("outline-none text-text flex-1", className) }, props)), end] }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
page: number;
|
|
3
|
+
currentPage: number;
|
|
4
|
+
handleChangePage: (newPage: number) => void;
|
|
5
|
+
};
|
|
6
|
+
export default function PageButton({ page, currentPage, handleChangePage, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/list-item/components/page-button/index.tsx"],"names":[],"mappings":"AAIA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,EACJ,WAAW,EACX,gBAAgB,GACjB,EAAE,KAAK,2CAeP"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export default function PageButton({ page, currentPage, handleChangePage, }) {
|
|
5
|
+
return (_jsx("button", { type: "button", className: clsx("border-b-2 w-8 h-8 rounded-md flex items-center justify-center bg-opacity-30 overflow-hidden hover:bg-secondary hover:bg-opacity-10 hover:border-b-secondary transition-all duration-300 ease-in-out", page === currentPage
|
|
6
|
+
? "border-b-secondary bg-secondary"
|
|
7
|
+
: "border-b-gray-200 bg-gray-200"), onClick: () => handleChangePage(page), children: _jsxs("p", { className: "truncate text-sm", children: [" ", page] }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
totalPages: number;
|
|
4
|
+
page: number;
|
|
5
|
+
setPage: (newPage: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export default function Pagination({ name, totalPages, page, setPage }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/list-item/components/pagination/index.tsx"],"names":[],"mappings":"AAOA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,2CAoI5E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import PageButton from "../page-button";
|
|
4
|
+
import { Icon } from "@iconify/react";
|
|
5
|
+
const AROUND_BUTTONS_COUNT = 3;
|
|
6
|
+
export default function Pagination({ name, totalPages, page, setPage }) {
|
|
7
|
+
const handleChangePage = (newPage) => {
|
|
8
|
+
if (newPage < 1)
|
|
9
|
+
newPage = 1;
|
|
10
|
+
else if (newPage > totalPages)
|
|
11
|
+
newPage = totalPages;
|
|
12
|
+
setPage(newPage);
|
|
13
|
+
};
|
|
14
|
+
const previousDisabled = page === 1 || totalPages === 0;
|
|
15
|
+
const nextDisabled = page === totalPages || totalPages === 0;
|
|
16
|
+
const renderPageNumbers = () => {
|
|
17
|
+
if (totalPages <= AROUND_BUTTONS_COUNT) {
|
|
18
|
+
// Show all pages if totalPages <= AROUND_BUTTONS_COUNT
|
|
19
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => (_jsx(PageButton, { currentPage: page, page: p, handleChangePage: handleChangePage }, `table-${name}-page-${p}`)));
|
|
20
|
+
}
|
|
21
|
+
const pages = [];
|
|
22
|
+
const showLeftEllipsis = page > AROUND_BUTTONS_COUNT;
|
|
23
|
+
const showRightEllipsis = page <= totalPages - AROUND_BUTTONS_COUNT;
|
|
24
|
+
// Add first page
|
|
25
|
+
pages.push(_jsx(PageButton, { currentPage: page, page: 1, handleChangePage: handleChangePage }, `table-${name}-page-1`));
|
|
26
|
+
// Add left ellipsis
|
|
27
|
+
if (showLeftEllipsis) {
|
|
28
|
+
pages.push(_jsx("span", { className: "text-gray-400", children: "..." }, `table-${name}-ellipsis-left`));
|
|
29
|
+
}
|
|
30
|
+
// Add middle pages
|
|
31
|
+
const startPage = Math.max(2, page - 1);
|
|
32
|
+
const endPage = Math.min(totalPages - 1, page + 1);
|
|
33
|
+
for (let p = startPage; p <= endPage; p++) {
|
|
34
|
+
pages.push(_jsx(PageButton, { currentPage: page, page: p, handleChangePage: handleChangePage }, `table-${name}-page-${p}`));
|
|
35
|
+
}
|
|
36
|
+
// Add right ellipsis
|
|
37
|
+
if (showRightEllipsis) {
|
|
38
|
+
pages.push(_jsx("span", { className: "text-gray-400", children: "..." }, `table-${name}-ellipsis-right`));
|
|
39
|
+
}
|
|
40
|
+
// Add last page
|
|
41
|
+
pages.push(_jsx(PageButton, { currentPage: page, page: totalPages, handleChangePage: handleChangePage }, `table-${name}-page-${totalPages}`));
|
|
42
|
+
return pages;
|
|
43
|
+
};
|
|
44
|
+
return (_jsxs("div", { className: "flex items-center justify-end gap-3", children: [_jsx("button", { disabled: previousDisabled, onClick: () => handleChangePage(page - 1), children: _jsx(Icon, { icon: "ooui:next-rtl", className: clsx("transition-all duration-300 ease-in-out", previousDisabled
|
|
45
|
+
? "text-gray-200"
|
|
46
|
+
: "text-secondary hover:text-opacity-50") }) }), renderPageNumbers(), _jsx("button", { disabled: nextDisabled, onClick: () => handleChangePage(page + 1), children: _jsx(Icon, { icon: "ooui:next-ltr", className: clsx("transition-all duration-300 ease-in-out", nextDisabled
|
|
47
|
+
? "text-gray-200"
|
|
48
|
+
: "text-secondary hover:text-opacity-50") }) })] }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Props as InputProps } from "../../../input";
|
|
2
|
+
export type Props = {
|
|
3
|
+
onDebouncedChange: (newValue: string) => void;
|
|
4
|
+
QueryDebouncedTime?: number;
|
|
5
|
+
} & InputProps;
|
|
6
|
+
export default function SearchInput({ value, onDebouncedChange, QueryDebouncedTime, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/list-item/components/search-input/index.tsx"],"names":[],"mappings":"AAGA,OAAc,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,MAAM,KAAK,GAAG;IAClB,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,UAAU,CAAC;AACf,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAK,EACL,iBAAiB,EACjB,kBAAwB,EACxB,GAAG,KAAK,EACT,EAAE,KAAK,2CAiCP"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Icon } from "@iconify/react";
|
|
15
|
+
import { useEffect, useState } from "react";
|
|
16
|
+
import Input from "../../../input";
|
|
17
|
+
export default function SearchInput(_a) {
|
|
18
|
+
var { value, onDebouncedChange, QueryDebouncedTime = 500 } = _a, props = __rest(_a, ["value", "onDebouncedChange", "QueryDebouncedTime"]);
|
|
19
|
+
const [currentValue, setCurrentValue] = useState(value);
|
|
20
|
+
const [debouncedQuery, setDebouncedQuery] = useState("");
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setCurrentValue((value || "").toString());
|
|
23
|
+
}, [value]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const handler = setTimeout(() => {
|
|
26
|
+
setDebouncedQuery(currentValue);
|
|
27
|
+
}, QueryDebouncedTime);
|
|
28
|
+
// Cleanup the timeout on every keystroke
|
|
29
|
+
return () => clearTimeout(handler);
|
|
30
|
+
}, [currentValue, QueryDebouncedTime]);
|
|
31
|
+
// Trigger the callback when debouncedQuery changes
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (onDebouncedChange) {
|
|
34
|
+
onDebouncedChange(debouncedQuery);
|
|
35
|
+
}
|
|
36
|
+
}, [debouncedQuery, onDebouncedChange]);
|
|
37
|
+
return (_jsx(Input, Object.assign({ value: currentValue, onChange: (e) => setCurrentValue(e.target.value), end: _jsx(Icon, { icon: "material-symbols:search", className: "w-5 h-5 text-primary" }) }, props)));
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SelectOption } from "../select";
|
|
3
|
+
import { BulkActionFeature, Filter } from "../../hooks/list-items-hook/types";
|
|
4
|
+
export type Props<K> = {
|
|
5
|
+
title?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
filters?: Filter<K>[];
|
|
8
|
+
totalPages: number;
|
|
9
|
+
query: string;
|
|
10
|
+
setQuery: (newQuery: string) => void;
|
|
11
|
+
page: number;
|
|
12
|
+
setPage: (newPage: number) => void;
|
|
13
|
+
rowsPerPage: number;
|
|
14
|
+
setRowsPerPage: (newRowsPerPage: number) => void;
|
|
15
|
+
rowsPerPageOptions: SelectOption<number>[];
|
|
16
|
+
QueryDebouncedTime?: number;
|
|
17
|
+
updateParams?: (updates: Record<string, string>) => void;
|
|
18
|
+
getParam?: (name: string) => string | null | undefined;
|
|
19
|
+
bulkActionFeature?: BulkActionFeature | undefined;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
showPaginationRow?: boolean;
|
|
22
|
+
showFiltersRow?: boolean;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export default function ListItem<K>({ title, name, filters, totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime, bulkActionFeature, loading, showPaginationRow, showFiltersRow, children, }: Props<K>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEP,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,EAClC,KAAK,EACL,IAAI,EACJ,OAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,kBAAwB,EACxB,iBAA6B,EAC7B,OAAe,EACf,iBAAwB,EACxB,cAAqB,EACrB,QAAQ,GACT,EAAE,KAAK,CAAC,CAAC,CAAC,2CAoGV"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import Select from "../select";
|
|
5
|
+
import Button from "../button";
|
|
6
|
+
import SearchInput from "./components/search-input";
|
|
7
|
+
import Pagination from "./components/pagination";
|
|
8
|
+
import { DEFAULT_FILTER_VALUE, } from "../../hooks/list-items-hook/types";
|
|
9
|
+
import { useFilters } from "../..//hooks/list-items-hook/useFilters";
|
|
10
|
+
import { usePagination } from "../../hooks/list-items-hook/usePagination";
|
|
11
|
+
import { useBulkActions } from "../../hooks/list-items-hook/useBulkActions";
|
|
12
|
+
import Loader from "../loader";
|
|
13
|
+
export default function ListItem({ title, name, filters = [], totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime = 500, bulkActionFeature = undefined, loading = false, showPaginationRow = true, showFiltersRow = true, children, }) {
|
|
14
|
+
useFilters(name, filters, updateParams, getParam);
|
|
15
|
+
usePagination(name, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam);
|
|
16
|
+
useBulkActions(bulkActionFeature, filters, query);
|
|
17
|
+
return (_jsxs("div", { className: "flex flex-col gap-5", children: [title && (_jsx("h3", { className: "text-2xl font-semibold text-primary", children: title })), _jsxs("div", { className: clsx("flex items-center gap-5 flex-wrap", showFiltersRow && bulkActionFeature
|
|
18
|
+
? "justify-between"
|
|
19
|
+
: "justify-end"), children: [showFiltersRow && (_jsxs("div", { className: "flex items-end gap-2 flex-wrap", children: [_jsx(SearchInput, { placeholder: `search about ${name}`, value: query, onDebouncedChange: setQuery, QueryDebouncedTime: QueryDebouncedTime }), filters.map((f, i) => (_jsxs("div", { className: "flex flex-col gap-1", children: [f.label && (_jsx("p", { className: "text-text font-semibold", children: f.label })), _jsx(Select, { name: `table-${name}-filter-${f.label}-${i}`, values: [f.value], setValues: (newValues) => f.setValue(newValues[0]), options: [
|
|
20
|
+
{ label: "All", value: DEFAULT_FILTER_VALUE },
|
|
21
|
+
...f.options,
|
|
22
|
+
], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, Object.assign({}, a, { disabled: bulkActionFeature.selectedRowIds.length === 0 }), `table-${name}-bulk-action-${i}`))) }))] }), _jsx("div", { className: "overflow-x-auto", children: loading ? _jsx(Loader, {}) : _jsx(_Fragment, { children: children }) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/loader/index.tsx"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,SAAoC,GACrC,EAAE,KAAK,2CAEP"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MenuProps } from "@szhsin/react-menu";
|
|
3
|
+
export type Props = {
|
|
4
|
+
menuButton: React.ReactNode;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
} & MenuProps;
|
|
8
|
+
export default function Menu({ menuButton, children, className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/menu/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA6B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG1E,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,GAAG,SAAS,CAAC;AACd,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,UAAU,EACV,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,2CAQP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Menu as SMenu, MenuButton } from "@szhsin/react-menu";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
export default function Menu(_a) {
|
|
17
|
+
var { menuButton, children, className } = _a, props = __rest(_a, ["menuButton", "children", "className"]);
|
|
18
|
+
return (_jsx(SMenu, Object.assign({ menuButton: _jsx(MenuButton, { children: menuButton }) }, props, { children: _jsx("div", { className: clsx("bg-white rounded-xl shadow-lg", className), children: children }) })));
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type Props = {
|
|
3
|
+
key: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string | undefined;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
export default function MenuItem({ children, className, selected, disabled, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AACzC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,QAAgB,EAChB,QAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,2CAcP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import { MenuItem as SMenuItem } from "@szhsin/react-menu";
|
|
16
|
+
export default function MenuItem(_a) {
|
|
17
|
+
var { children, className, selected = false, disabled = false } = _a, props = __rest(_a, ["children", "className", "selected", "disabled"]);
|
|
18
|
+
return (_jsx("div", Object.assign({ className: clsx("rounded-md transition-all duration-300 ease-in-out", selected && "bg-primary", !disabled ? "hover:bg-primary hover:bg-opacity-50" : "bg-gray-200", className) }, props, { children: _jsx(SMenuItem, { disabled: disabled, children: children }) })));
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export type ModalPosition = "center" | "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "right";
|
|
3
|
+
export type ModalSize = "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type Props = {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
size?: ModalSize;
|
|
9
|
+
position?: ModalPosition;
|
|
10
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
11
|
+
export default function Modal({ isOpen, onClose, children, position, size, className, onClick, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,KAAK,GACL,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,GACb,cAAc,GACd,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAqBlD,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AACzC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAmB,EACnB,IAAW,EACX,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,2CAiCP"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Icon } from "@iconify/react";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
const sizeClasses = {
|
|
16
|
+
sm: "w-1/2 md:w-1/4 h-auto",
|
|
17
|
+
md: "w-1/2 md:w-1/3 h-auto",
|
|
18
|
+
lg: "w-5/6 md:w-1/2 h-auto",
|
|
19
|
+
xl: "w-5/6 md:w-3/4 h-auto",
|
|
20
|
+
};
|
|
21
|
+
const positionClasses = {
|
|
22
|
+
center: "top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",
|
|
23
|
+
top: "top-5 left-1/2 transform -translate-x-1/2",
|
|
24
|
+
"top-left": "top-5 left-5",
|
|
25
|
+
"top-right": "top-5 right-5",
|
|
26
|
+
bottom: "bottom-5 left-1/2 transform -translate-x-1/2",
|
|
27
|
+
"bottom-left": "bottom-5 left-5",
|
|
28
|
+
"bottom-right": "bottom-5 right-5",
|
|
29
|
+
left: "top-1/2 left-5 transform -translate-y-1/2",
|
|
30
|
+
right: "top-1/2 right-5 transform -translate-y-1/2",
|
|
31
|
+
};
|
|
32
|
+
export default function Modal(_a) {
|
|
33
|
+
var { isOpen, onClose, children, position = "center", size = "md", className, onClick } = _a, props = __rest(_a, ["isOpen", "onClose", "children", "position", "size", "className", "onClick"]);
|
|
34
|
+
if (!isOpen)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 z-50 flex justify-center items-center", onClick: onClose, children: _jsxs("div", Object.assign({ className: clsx("absolute bg-white rounded-lg shadow-lg p-6", sizeClasses[size], positionClasses[position], className), onClick: (e) => {
|
|
37
|
+
e.stopPropagation(); // Prevent closing when clicking inside the modal
|
|
38
|
+
if (onClick)
|
|
39
|
+
onClick(e);
|
|
40
|
+
} }, props, { children: [_jsx("button", { onClick: onClose, className: "absolute top-2 right-2 text-secondary-dark", children: _jsx(Icon, { icon: "line-md:close-small", className: "h-5 w-5 hover:scale-110 transition-all duration-300 ease-in-out" }) }), children] })) }));
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/not-authorized/index.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,aAAa,4CAWpC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Icon from "../icon";
|
|
3
|
+
export default function NotAuthorized() {
|
|
4
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-10", children: [_jsx(Icon, { icon: "fluent-mdl2:protect-restrict", className: "text-warning text-opacity-80 h-56 w-56" }), _jsx("h3", { className: "text-warning text-4xl font-bold", children: "Not Authorized!" })] }));
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/otp-input/index.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,KAAK,2CAwDzE"}
|