uibee 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.d.ts +15 -0
- package/dist/components/alert/alert.js +29 -0
- package/dist/components/badge/badge.d.ts +16 -0
- package/dist/components/badge/badge.js +26 -0
- package/dist/components/buttons/button.d.ts +25 -0
- package/dist/components/buttons/button.js +44 -0
- package/dist/components/code/code.d.ts +23 -0
- package/dist/components/code/code.js +39 -0
- package/dist/components/confirm/confirmPopup.d.ts +23 -0
- package/dist/components/confirm/confirmPopup.js +52 -0
- package/dist/components/container/accordion.d.ts +25 -0
- package/dist/components/container/accordion.js +41 -0
- package/dist/components/container/card.d.ts +13 -0
- package/dist/components/container/card.js +10 -0
- package/dist/components/container/expandableCard.d.ts +32 -0
- package/dist/components/container/expandableCard.js +70 -0
- package/dist/components/container/glassCard.d.ts +13 -0
- package/dist/components/container/glassCard.js +10 -0
- package/dist/components/container/highlight.d.ts +10 -0
- package/dist/components/container/highlight.js +10 -0
- package/dist/components/container/iconBubble.d.ts +25 -0
- package/dist/components/container/iconBubble.js +21 -0
- package/dist/components/container/leftBarPanel.d.ts +15 -0
- package/dist/components/container/leftBarPanel.js +10 -0
- package/dist/components/container/page.d.ts +15 -0
- package/dist/components/container/page.js +16 -0
- package/dist/components/container/pulseDot.d.ts +12 -0
- package/dist/components/container/pulseDot.js +23 -0
- package/dist/components/container/statCard.d.ts +18 -0
- package/dist/components/container/statCard.js +25 -0
- package/dist/components/container/tabs.d.ts +35 -0
- package/dist/components/container/tabs.js +36 -0
- package/dist/components/empty/emptyState.d.ts +19 -0
- package/dist/components/empty/emptyState.js +27 -0
- package/dist/components/footer/footer.d.ts +49 -0
- package/dist/components/footer/footer.js +109 -0
- package/dist/components/footer/loginContent.d.ts +18 -0
- package/dist/components/footer/loginContent.js +138 -0
- package/dist/components/inputs/checkbox.d.ts +20 -0
- package/dist/components/inputs/checkbox.js +76 -0
- package/dist/components/inputs/fileInput.d.ts +19 -0
- package/dist/components/inputs/fileInput.js +108 -0
- package/dist/components/inputs/input.d.ts +16 -0
- package/dist/components/inputs/input.js +157 -0
- package/dist/components/inputs/multiSelect.d.ts +37 -0
- package/dist/components/inputs/multiSelect.js +99 -0
- package/dist/components/inputs/radio.d.ts +20 -0
- package/dist/components/inputs/radio.js +70 -0
- package/dist/components/inputs/range.d.ts +14 -0
- package/dist/components/inputs/range.js +60 -0
- package/dist/components/inputs/searchInput.d.ts +11 -0
- package/dist/components/inputs/searchInput.js +56 -0
- package/dist/components/inputs/select.d.ts +42 -0
- package/dist/components/inputs/select.js +164 -0
- package/dist/components/inputs/shared/colorPickerPopup.js +293 -0
- package/dist/components/inputs/shared/dateTimePickerPopup.js +225 -0
- package/dist/components/inputs/shared/fieldWrapper.js +33 -0
- package/dist/components/inputs/shared/index.js +6 -0
- package/dist/components/inputs/shared/inputError.js +17 -0
- package/dist/components/inputs/shared/inputInfo.js +13 -0
- package/dist/components/inputs/shared/inputLabel.js +19 -0
- package/dist/components/inputs/switch.d.ts +14 -0
- package/dist/components/inputs/switch.js +37 -0
- package/dist/components/inputs/tagInput.d.ts +31 -0
- package/dist/components/inputs/tagInput.js +72 -0
- package/dist/components/inputs/textarea.d.ts +14 -0
- package/dist/components/inputs/textarea.js +76 -0
- package/dist/components/inputs/toggle.d.ts +21 -0
- package/dist/components/inputs/toggle.js +33 -0
- package/dist/components/login/loginPage.d.ts +15 -0
- package/dist/components/login/loginPage.js +80 -0
- package/dist/components/logo/logo.d.ts +9 -0
- package/dist/components/logo/logo.js +138 -0
- package/dist/components/logo/logoSmall.d.ts +4 -0
- package/dist/components/logo/logoSmall.js +56 -0
- package/dist/components/markdownrender/markdownRender.d.ts +16 -0
- package/dist/components/markdownrender/markdownRender.js +59 -0
- package/dist/components/modal/modal.d.ts +22 -0
- package/dist/components/modal/modal.js +59 -0
- package/dist/components/navbar/bubble.js +36 -0
- package/dist/components/navbar/navbar.d.ts +50 -0
- package/dist/components/navbar/navbar.js +99 -0
- package/dist/components/navbar/navbarDropdown.d.ts +15 -0
- package/dist/components/navbar/navbarDropdown.js +63 -0
- package/dist/components/navbar/navbarItem.d.ts +23 -0
- package/dist/components/navbar/navbarItem.js +38 -0
- package/dist/components/sidebar/sidebar.d.ts +34 -0
- package/dist/components/sidebar/sidebar.js +135 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +16 -0
- package/dist/components/table/body.js +253 -0
- package/dist/components/table/constants.js +58 -0
- package/dist/components/table/empty.js +24 -0
- package/dist/components/table/format.js +39 -0
- package/dist/components/table/header.js +109 -0
- package/dist/components/table/menu.d.ts +18 -0
- package/dist/components/table/menu.js +76 -0
- package/dist/components/table/pagination.d.ts +14 -0
- package/dist/components/table/pagination.js +130 -0
- package/dist/components/table/skeleton.js +39 -0
- package/dist/components/table/table.d.ts +7 -0
- package/dist/components/table/table.js +213 -0
- package/dist/components/table/types.d.ts +52 -0
- package/dist/components/table/utils.js +9 -0
- package/dist/components/toast/toastItem.js +61 -0
- package/dist/components/toast/toaster.d.ts +13 -0
- package/dist/components/toast/toaster.js +117 -0
- package/dist/components/toggle/language.d.ts +10 -0
- package/dist/components/toggle/language.js +34 -0
- package/dist/components/toggle/theme.d.ts +8 -0
- package/dist/components/toggle/theme.js +135 -0
- package/dist/components/version/version.d.ts +13 -0
- package/dist/components/version/version.js +19 -0
- package/dist/components/vulnerability/constants.d.ts +4 -0
- package/dist/components/vulnerability/constants.js +17 -0
- package/dist/components/vulnerability/severityPill.d.ts +15 -0
- package/dist/components/vulnerability/severityPill.js +20 -0
- package/dist/{style.css → globals.css} +155 -226
- package/dist/hooks/useClickOutside.d.ts +6 -0
- package/dist/{useClickOutside-Cmp-RsP3.js → hooks/useClickOutside.js} +1 -1
- package/dist/hooks/useDarkMode.d.ts +4 -0
- package/dist/hooks/useDarkMode.js +19 -0
- package/dist/hooks/useVisibility.d.ts +7 -0
- package/dist/hooks/useVisibility.js +25 -0
- package/dist/icons/icons.d.ts +420 -0
- package/dist/{icons-lZYQ6Vlr.js → icons/icons.js} +1 -1
- package/dist/src/components/index.d.ts +51 -901
- package/dist/src/components/index.js +49 -4160
- package/dist/src/hooks/index.d.ts +3 -14
- package/dist/src/hooks/index.js +3 -42
- package/dist/src/icons/index.d.ts +1 -419
- package/dist/src/icons/index.js +1 -1
- package/dist/src/styles/index.js +1 -1
- package/dist/src/utils/index.d.ts +5 -37
- package/dist/src/utils/index.js +5 -124
- package/dist/utils/auth/callback.d.ts +14 -0
- package/dist/utils/auth/callback.js +53 -0
- package/dist/utils/auth/getDomain.js +6 -0
- package/dist/utils/auth/login.d.ts +12 -0
- package/dist/utils/auth/login.js +17 -0
- package/dist/utils/auth/logout.d.ts +10 -0
- package/dist/utils/auth/logout.js +20 -0
- package/dist/utils/auth/token.d.ts +10 -0
- package/dist/utils/auth/token.js +30 -0
- package/dist/utils/logoConsoleOutput/logoConsoleOutput.d.ts +4 -0
- package/dist/utils/logoConsoleOutput/logoConsoleOutput.js +11 -0
- package/package.json +1 -1
- package/src/components/buttons/button.tsx +2 -0
- package/src/components/footer/footer.tsx +65 -28
- package/src/components/index.ts +0 -1
- package/src/components/inputs/checkbox.tsx +2 -0
- package/src/components/inputs/input.tsx +2 -0
- package/src/components/inputs/radio.tsx +2 -0
- package/src/components/inputs/range.tsx +2 -0
- package/src/components/inputs/shared/colorPickerPopup.tsx +2 -0
- package/src/components/inputs/shared/dateTimePickerPopup.tsx +2 -0
- package/src/components/inputs/textarea.tsx +2 -0
- package/src/components/inputs/toggle.tsx +2 -0
- package/src/components/sidebar/sidebar.tsx +37 -10
- package/src/components/toast/toastItem.tsx +2 -0
- package/src/globals.css +6 -1
- package/tsdown.config.ts +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/table/types.d.ts
|
|
4
|
+
type TableColor = 'green' | 'yellow' | 'red' | 'blue' | 'gray' | 'orange' | 'purple';
|
|
5
|
+
type Column<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
6
|
+
key: keyof T & string;
|
|
7
|
+
label?: string;
|
|
8
|
+
sortable?: boolean;
|
|
9
|
+
width?: string;
|
|
10
|
+
align?: 'left' | 'center' | 'right';
|
|
11
|
+
highlight?: Record<string, TableColor>;
|
|
12
|
+
render?: (value: unknown, row: T) => ReactNode;
|
|
13
|
+
truncate?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type SortState = {
|
|
16
|
+
column: string;
|
|
17
|
+
order: 'asc' | 'desc';
|
|
18
|
+
};
|
|
19
|
+
type Density = 'compact' | 'comfortable' | 'spacious';
|
|
20
|
+
type TableVariant = 'original' | 'modern';
|
|
21
|
+
type TableProps<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
22
|
+
data: T[];
|
|
23
|
+
columns: Column<T>[];
|
|
24
|
+
idKey?: keyof T & string;
|
|
25
|
+
variant?: TableVariant;
|
|
26
|
+
density?: Density;
|
|
27
|
+
striped?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
loadingRows?: number;
|
|
31
|
+
emptyState?: ReactNode;
|
|
32
|
+
redirectPath?: string | {
|
|
33
|
+
path: string;
|
|
34
|
+
key?: string;
|
|
35
|
+
};
|
|
36
|
+
onRowClick?: (row: T, id: string) => void;
|
|
37
|
+
renderExpandedRow?: (row: T) => ReactNode;
|
|
38
|
+
selectable?: boolean;
|
|
39
|
+
selectedIds?: string[];
|
|
40
|
+
onSelectionChange?: (ids: string[]) => void;
|
|
41
|
+
urlState?: boolean;
|
|
42
|
+
sort?: SortState;
|
|
43
|
+
onSort?: (sort: SortState) => void;
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
totalRows?: number;
|
|
46
|
+
page?: number;
|
|
47
|
+
onPageChange?: (page: number) => void;
|
|
48
|
+
hidePagination?: boolean;
|
|
49
|
+
menuItems?: (row: T, id: string) => ReactNode;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Column, Density, SortState, TableColor, TableProps, TableVariant };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/table/utils.ts
|
|
2
|
+
function resolveId(row, idKey, columns) {
|
|
3
|
+
if (idKey && row[idKey] !== void 0) return String(row[idKey]);
|
|
4
|
+
if (row["id"] !== void 0) return String(row["id"]);
|
|
5
|
+
const firstKey = columns[0]?.key ?? Object.keys(row)[0];
|
|
6
|
+
return String(row[firstKey] ?? "");
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { resolveId };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/toast/toastItem.tsx
|
|
6
|
+
function ToastItem({ toast, index, expanded, onRemove, onHeight, offset, frontHeight }) {
|
|
7
|
+
const [mounted, setMounted] = useState(false);
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
requestAnimationFrame(() => setMounted(true));
|
|
11
|
+
}, []);
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
if (ref.current) onHeight(toast.id, ref.current.offsetHeight);
|
|
14
|
+
}, [
|
|
15
|
+
toast.message,
|
|
16
|
+
onHeight,
|
|
17
|
+
toast.id,
|
|
18
|
+
expanded
|
|
19
|
+
]);
|
|
20
|
+
const isVisible = mounted && !toast.exiting;
|
|
21
|
+
const isFront = index === 0;
|
|
22
|
+
const collapsedOffset = index * 10 + (index > 0 ? frontHeight - 60 : 0);
|
|
23
|
+
return /* @__PURE__ */ jsx("li", {
|
|
24
|
+
ref,
|
|
25
|
+
className: "absolute bottom-0 right-0 w-full transition-all duration-300 ease-out pointer-events-auto",
|
|
26
|
+
style: {
|
|
27
|
+
transform: isVisible ? `translateY(${expanded ? -offset : -collapsedOffset}px) scale(${expanded ? 1 : 1 - index * .05})` : "translateY(20px) scale(0.9)",
|
|
28
|
+
opacity: isVisible ? 1 : 0,
|
|
29
|
+
zIndex: toast.id
|
|
30
|
+
},
|
|
31
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "flex items-center space-x-4 rounded-lg p-4 shadow-lg border-2 border-login-400 bg-login-700",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "shrink-0",
|
|
36
|
+
children: Icon(toast.type)
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ jsx("p", {
|
|
39
|
+
className: `flex-1 text-sm font-semibold text-login-800 dark:text-login-100 min-w-0
|
|
40
|
+
${!expanded && !isFront ? "truncate" : ""}`,
|
|
41
|
+
children: toast.message
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx("button", {
|
|
44
|
+
onClick: onRemove,
|
|
45
|
+
className: "hover:text-login-200 text-login-400",
|
|
46
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function Icon(type) {
|
|
53
|
+
switch (type) {
|
|
54
|
+
case "info": return /* @__PURE__ */ jsx(Info, { className: "h-6 w-6 text-blue-500" });
|
|
55
|
+
case "success": return /* @__PURE__ */ jsx(CheckCircle, { className: "h-6 w-6 text-green-500" });
|
|
56
|
+
case "warning": return /* @__PURE__ */ jsx(AlertTriangle, { className: "h-6 w-6 text-yellow-500" });
|
|
57
|
+
case "error": return /* @__PURE__ */ jsx(AlertCircle, { className: "h-6 w-6 text-red-500" });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { ToastItem as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToastType } from "uibee/components";
|
|
2
|
+
|
|
3
|
+
//#region src/components/toast/toaster.d.ts
|
|
4
|
+
declare function toast(message: string, type: ToastType, duration?: number): void;
|
|
5
|
+
declare namespace toast {
|
|
6
|
+
var info: (message: string, duration?: number) => void;
|
|
7
|
+
var success: (message: string, duration?: number) => void;
|
|
8
|
+
var warning: (message: string, duration?: number) => void;
|
|
9
|
+
var error: (message: string, duration?: number) => void;
|
|
10
|
+
}
|
|
11
|
+
declare function Toaster(): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Toaster as default, toast };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import ToastItem from "./toastItem.js";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/toast/toaster.tsx
|
|
6
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
7
|
+
let idCounter = 0;
|
|
8
|
+
function toast(message, type, duration = 4e3) {
|
|
9
|
+
const id = ++idCounter;
|
|
10
|
+
listeners.forEach((listener) => listener({
|
|
11
|
+
id,
|
|
12
|
+
message,
|
|
13
|
+
type,
|
|
14
|
+
expiresAt: Date.now() + duration
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
toast.info = (message, duration) => toast(message, "info", duration);
|
|
18
|
+
toast.success = (message, duration) => toast(message, "success", duration);
|
|
19
|
+
toast.warning = (message, duration) => toast(message, "warning", duration);
|
|
20
|
+
toast.error = (message, duration) => toast(message, "error", duration);
|
|
21
|
+
function Toaster() {
|
|
22
|
+
const [toasts, setToasts] = useState([]);
|
|
23
|
+
const [expanded, setExpanded] = useState(false);
|
|
24
|
+
const [heights, setHeights] = useState({});
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
function addToast(toast) {
|
|
27
|
+
setToasts((prev) => [toast, ...prev]);
|
|
28
|
+
}
|
|
29
|
+
listeners.add(addToast);
|
|
30
|
+
return () => {
|
|
31
|
+
listeners.delete(addToast);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
setToasts((prev) => prev.map((toast) => {
|
|
37
|
+
if (expanded) return {
|
|
38
|
+
...toast,
|
|
39
|
+
pausedAt: toast.pausedAt || now
|
|
40
|
+
};
|
|
41
|
+
if (!toast.pausedAt) return toast;
|
|
42
|
+
return {
|
|
43
|
+
...toast,
|
|
44
|
+
expiresAt: toast.expiresAt + (now - toast.pausedAt),
|
|
45
|
+
pausedAt: void 0
|
|
46
|
+
};
|
|
47
|
+
}));
|
|
48
|
+
}, [expanded]);
|
|
49
|
+
function removeToast(id) {
|
|
50
|
+
setToasts((prev) => prev.map((toast) => toast.id === id ? {
|
|
51
|
+
...toast,
|
|
52
|
+
exiting: true
|
|
53
|
+
} : toast));
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
56
|
+
}, 300);
|
|
57
|
+
}
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const timer = setInterval(() => {
|
|
60
|
+
if (expanded) return;
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
setToasts((prev) => {
|
|
63
|
+
const toastsToExit = prev.filter((toast) => !toast.exiting && !toast.pausedAt && toast.expiresAt <= now);
|
|
64
|
+
if (toastsToExit.length === 0) return prev;
|
|
65
|
+
toastsToExit.forEach((toast) => {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
setToasts((current) => current.filter((item) => item.id !== toast.id));
|
|
68
|
+
}, 300);
|
|
69
|
+
});
|
|
70
|
+
return prev.map((toast) => toastsToExit.find((exitToast) => exitToast.id === toast.id) ? {
|
|
71
|
+
...toast,
|
|
72
|
+
exiting: true
|
|
73
|
+
} : toast);
|
|
74
|
+
});
|
|
75
|
+
}, 100);
|
|
76
|
+
return () => clearInterval(timer);
|
|
77
|
+
}, [expanded]);
|
|
78
|
+
function onHeight(id, height) {
|
|
79
|
+
setHeights((prev) => {
|
|
80
|
+
if (prev[id] === height) return prev;
|
|
81
|
+
return {
|
|
82
|
+
...prev,
|
|
83
|
+
[id]: height
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const visibleToasts = toasts.slice(0, expanded ? 10 : 3);
|
|
88
|
+
const frontHeight = heights[visibleToasts[0]?.id] || 60;
|
|
89
|
+
const offsets = useMemo(() => {
|
|
90
|
+
let currentOffset = 0;
|
|
91
|
+
return visibleToasts.map((toast) => {
|
|
92
|
+
const height = heights[toast.id] || 60;
|
|
93
|
+
const offset = currentOffset;
|
|
94
|
+
currentOffset += height + 16;
|
|
95
|
+
return offset;
|
|
96
|
+
});
|
|
97
|
+
}, [visibleToasts, heights]);
|
|
98
|
+
const totalHeight = offsets.length > 0 ? offsets[offsets.length - 1] + (heights[visibleToasts[visibleToasts.length - 1]?.id] || 60) : 0;
|
|
99
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
100
|
+
className: `fixed bottom-4 right-4 z-9999 w-full max-w-sm flex flex-col items-end transition-all duration-300 ease-out
|
|
101
|
+
${expanded ? "pointer-events-auto" : "pointer-events-none"}`,
|
|
102
|
+
style: { height: expanded ? totalHeight + "px" : "auto" },
|
|
103
|
+
onMouseEnter: () => setExpanded(true),
|
|
104
|
+
onMouseLeave: () => setExpanded(false),
|
|
105
|
+
children: visibleToasts.map((toast, index) => /* @__PURE__ */ jsx(ToastItem, {
|
|
106
|
+
toast,
|
|
107
|
+
index,
|
|
108
|
+
expanded,
|
|
109
|
+
onRemove: () => removeToast(toast.id),
|
|
110
|
+
onHeight,
|
|
111
|
+
offset: offsets[index],
|
|
112
|
+
frontHeight
|
|
113
|
+
}, toast.id))
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { Toaster as default, toast };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Language } from "uibee/components";
|
|
2
|
+
|
|
3
|
+
//#region src/components/toggle/language.d.ts
|
|
4
|
+
declare function LanguageToggle({
|
|
5
|
+
language
|
|
6
|
+
}: {
|
|
7
|
+
language?: Language;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LanguageToggle as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Globe } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useRouter } from "next/navigation.js";
|
|
6
|
+
import { getCookie, setCookie } from "utilbee";
|
|
7
|
+
//#region src/components/toggle/language.tsx
|
|
8
|
+
function LanguageToggle({ language }) {
|
|
9
|
+
const [lang, setLang] = useState(language || "en");
|
|
10
|
+
const [jump, setJump] = useState(false);
|
|
11
|
+
const router = useRouter();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const savedLang = getCookie("lang");
|
|
14
|
+
if (savedLang) setLang(savedLang);
|
|
15
|
+
}, []);
|
|
16
|
+
function handleClick() {
|
|
17
|
+
const newLang = lang === "no" ? "en" : "no";
|
|
18
|
+
setCookie("lang", newLang);
|
|
19
|
+
setLang(newLang);
|
|
20
|
+
language = newLang;
|
|
21
|
+
setJump(true);
|
|
22
|
+
setTimeout(() => setJump(false), 400);
|
|
23
|
+
router.refresh();
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
26
|
+
value: lang,
|
|
27
|
+
onClick: handleClick,
|
|
28
|
+
className: `cursor-pointer p-2 leading-8 text-base w-[4.3rem] text-center rounded
|
|
29
|
+
bg-transparent border-none hover:bg-gray-400/10 flex flex-row items-center justify-center gap-1`,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Globe, { className: `text-xl leading-8 -mt-0.5 ${jump ? "animate-jump" : ""}` }), " " + lang]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { LanguageToggle as default };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRouter } from "next/navigation.js";
|
|
5
|
+
import { getCookie, setCookie } from "utilbee";
|
|
6
|
+
//#region src/components/toggle/theme.tsx
|
|
7
|
+
function ThemeToggle({ className }) {
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
const [theme, setTheme] = useState("dark");
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const savedTheme = getCookie("theme");
|
|
12
|
+
if (savedTheme) setTheme(savedTheme);
|
|
13
|
+
document.documentElement.classList.remove("dark", "light");
|
|
14
|
+
document.documentElement.classList.add(theme);
|
|
15
|
+
}, [theme]);
|
|
16
|
+
function toggleTheme() {
|
|
17
|
+
const newTheme = theme === "dark" ? "light" : "dark";
|
|
18
|
+
setCookie("theme", newTheme);
|
|
19
|
+
setTheme(newTheme);
|
|
20
|
+
router.refresh();
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: `grid place-items-center justify-end rounded-md hover:bg-login-300/20 w-fit ${className}`,
|
|
24
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
25
|
+
className: "cursor-pointer",
|
|
26
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
27
|
+
type: "checkbox",
|
|
28
|
+
checked: theme === "light",
|
|
29
|
+
onChange: toggleTheme,
|
|
30
|
+
className: "sr-only"
|
|
31
|
+
}), /* @__PURE__ */ jsx(ThemeIcon, { theme })]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function ThemeIcon({ theme }) {
|
|
36
|
+
const sunrayClass = `fill-white transition-opacity duration-400 ${theme === "light" ? "opacity-0" : "opacity-100"}`;
|
|
37
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
38
|
+
className: "h-12 p-3",
|
|
39
|
+
viewBox: "0 0 100 100",
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("mask", {
|
|
43
|
+
id: "theme-toggle_clip-path",
|
|
44
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
45
|
+
x: "0",
|
|
46
|
+
y: "0",
|
|
47
|
+
width: "100",
|
|
48
|
+
height: "100",
|
|
49
|
+
fill: "white"
|
|
50
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
51
|
+
className: `transition-transform duration-400 ${theme === "dark" ? "translate-x-8 -translate-y-4" : ""}`,
|
|
52
|
+
cx: "68",
|
|
53
|
+
cy: "40",
|
|
54
|
+
r: "18"
|
|
55
|
+
})]
|
|
56
|
+
}) }),
|
|
57
|
+
/* @__PURE__ */ jsx("circle", {
|
|
58
|
+
className: `origin-center transition-all duration-400 ${theme === "light" ? "scale-[1.9] fill-black" : "scale-100 fill-white"}`,
|
|
59
|
+
mask: "url(#theme-toggle_clip-path)",
|
|
60
|
+
cx: "50",
|
|
61
|
+
cy: "50",
|
|
62
|
+
r: "23"
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx("rect", {
|
|
65
|
+
className: sunrayClass,
|
|
66
|
+
x: "86",
|
|
67
|
+
y: "47",
|
|
68
|
+
width: "14",
|
|
69
|
+
height: "6",
|
|
70
|
+
rx: "3"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx("rect", {
|
|
73
|
+
className: sunrayClass,
|
|
74
|
+
y: "47",
|
|
75
|
+
width: "14",
|
|
76
|
+
height: "6",
|
|
77
|
+
rx: "3"
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("rect", {
|
|
80
|
+
className: sunrayClass,
|
|
81
|
+
x: "47",
|
|
82
|
+
y: "86",
|
|
83
|
+
width: "6",
|
|
84
|
+
height: "14",
|
|
85
|
+
rx: "3"
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("rect", {
|
|
88
|
+
className: sunrayClass,
|
|
89
|
+
x: "75",
|
|
90
|
+
y: "75",
|
|
91
|
+
width: "6",
|
|
92
|
+
height: "14",
|
|
93
|
+
rx: "3",
|
|
94
|
+
transform: "rotate(-45 78 78)"
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx("rect", {
|
|
97
|
+
className: sunrayClass,
|
|
98
|
+
x: "84.8995",
|
|
99
|
+
y: "12",
|
|
100
|
+
width: "6",
|
|
101
|
+
height: "14",
|
|
102
|
+
rx: "3",
|
|
103
|
+
transform: "rotate(45 84.8995 12)"
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx("rect", {
|
|
106
|
+
className: sunrayClass,
|
|
107
|
+
x: "22.8995",
|
|
108
|
+
y: "74",
|
|
109
|
+
width: "6",
|
|
110
|
+
height: "14",
|
|
111
|
+
rx: "3",
|
|
112
|
+
transform: "rotate(45 22.8995 74)"
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx("rect", {
|
|
115
|
+
className: sunrayClass,
|
|
116
|
+
x: "13",
|
|
117
|
+
y: "16.2426",
|
|
118
|
+
width: "6",
|
|
119
|
+
height: "14",
|
|
120
|
+
rx: "3",
|
|
121
|
+
transform: "rotate(-45 13 16.2426)"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx("rect", {
|
|
124
|
+
className: sunrayClass,
|
|
125
|
+
x: "47",
|
|
126
|
+
y: "0",
|
|
127
|
+
width: "6",
|
|
128
|
+
height: "14",
|
|
129
|
+
rx: "3"
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { ThemeToggle as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/components/version/version.d.ts
|
|
2
|
+
type VersionTagProps = {
|
|
3
|
+
version?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function VersionTag({
|
|
8
|
+
version,
|
|
9
|
+
url,
|
|
10
|
+
className
|
|
11
|
+
}: VersionTagProps): import("react").JSX.Element | undefined;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { VersionTag as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from "next/link.js";
|
|
3
|
+
//#region src/components/version/version.tsx
|
|
4
|
+
function VersionTag({ version, url, className }) {
|
|
5
|
+
if (!version) return;
|
|
6
|
+
const style = `w-fit bg-login-700 text-login-100 border border-login-500/40 text-xs font-mono px-2 py-0.5 rounded ${className || ""}`;
|
|
7
|
+
if (url) return /* @__PURE__ */ jsxs(Link, {
|
|
8
|
+
className: style,
|
|
9
|
+
target: "_blank",
|
|
10
|
+
href: url,
|
|
11
|
+
children: ["v", version]
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
className: style,
|
|
15
|
+
children: ["v", version]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { VersionTag as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/components/vulnerability/constants.ts
|
|
2
|
+
const severityLabel = {
|
|
3
|
+
critical: "Critical",
|
|
4
|
+
high: "High",
|
|
5
|
+
medium: "Medium",
|
|
6
|
+
low: "Low",
|
|
7
|
+
unknown: "Unknown"
|
|
8
|
+
};
|
|
9
|
+
const severityClasses = {
|
|
10
|
+
critical: "border-l-red-500",
|
|
11
|
+
high: "border-l-orange-500",
|
|
12
|
+
medium: "border-l-amber-500",
|
|
13
|
+
low: "border-l-green-500",
|
|
14
|
+
unknown: "border-l-login-400"
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { severityClasses, severityLabel };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SeverityLevel } from "./constants.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/vulnerability/severityPill.d.ts
|
|
4
|
+
type SeverityPillProps = {
|
|
5
|
+
severity: SeverityLevel;
|
|
6
|
+
count: number;
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare function SeverityPill({
|
|
10
|
+
severity,
|
|
11
|
+
count,
|
|
12
|
+
compact
|
|
13
|
+
}: SeverityPillProps): import("react").JSX.Element | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SeverityPill as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import LeftBarPanel from "../container/leftBarPanel.js";
|
|
2
|
+
import { severityClasses, severityLabel } from "./constants.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/vulnerability/severityPill.tsx
|
|
5
|
+
function SeverityPill({ severity, count, compact = false }) {
|
|
6
|
+
if (count === 0) return null;
|
|
7
|
+
return /* @__PURE__ */ jsxs(LeftBarPanel, {
|
|
8
|
+
color: severityClasses[severity],
|
|
9
|
+
className: `flex items-center gap-2.5 ${compact ? "px-2.5 py-1.5" : "px-3 py-2"}`,
|
|
10
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: `${compact ? "text-sm" : "text-base"} font-bold text-login-50`,
|
|
12
|
+
children: count
|
|
13
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.15em] text-login-300",
|
|
15
|
+
children: severityLabel[severity]
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { SeverityPill as default };
|