uibee 2.17.4 → 3.0.0
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/README.md +34 -0
- package/dist/icons-lZYQ6Vlr.js +125 -0
- package/dist/src/components/index.d.ts +706 -30
- package/dist/src/components/index.js +3243 -44
- package/dist/src/hooks/index.d.ts +15 -3
- package/dist/src/hooks/index.js +44 -3
- package/dist/src/icons/index.d.ts +420 -0
- package/dist/src/icons/index.js +3 -0
- package/dist/src/styles/index.d.ts +1 -1
- package/dist/src/styles/index.js +2 -1
- package/dist/src/utils/index.d.ts +38 -5
- package/dist/src/utils/index.js +125 -6
- package/dist/{src/globals.css → style.css} +1226 -607
- package/dist/useClickOutside-Cmp-RsP3.js +13 -0
- package/index.d.ts +0 -1
- package/package.json +22 -23
- package/src/components/alert/alert.tsx +20 -18
- package/src/components/buttons/button.tsx +28 -35
- package/src/components/confirm/confirmPopup.tsx +15 -17
- package/src/components/container/accordion.tsx +54 -0
- package/src/components/container/glassCard.tsx +14 -0
- package/src/components/container/iconBubble.tsx +30 -0
- package/src/components/container/leftBarPanel.tsx +15 -0
- package/src/components/container/pulseDot.tsx +31 -0
- package/src/components/container/statCard.tsx +24 -0
- package/src/components/container/tabs.tsx +64 -0
- package/src/components/footer/footer.tsx +124 -0
- package/src/components/footer/loginContent.tsx +70 -0
- package/src/components/index.ts +15 -0
- package/src/components/inputs/checkbox.tsx +4 -4
- package/src/components/inputs/input.tsx +11 -13
- package/src/components/inputs/multiSelect.tsx +144 -0
- package/src/components/inputs/radio.tsx +4 -4
- package/src/components/inputs/range.tsx +6 -5
- package/src/components/inputs/searchInput.tsx +1 -1
- package/src/components/inputs/select.tsx +19 -18
- package/src/components/inputs/shared/colorPickerPopup.tsx +5 -5
- package/src/components/inputs/shared/dateTimePickerPopup.tsx +9 -9
- package/src/components/inputs/shared/inputError.tsx +1 -1
- package/src/components/inputs/switch.tsx +7 -7
- package/src/components/inputs/tagInput.tsx +6 -7
- package/src/components/inputs/textarea.tsx +8 -10
- package/src/components/inputs/toggle.tsx +6 -6
- package/src/components/markdownrender/markdownRender.tsx +4 -2
- package/src/components/table/body.tsx +6 -6
- package/src/components/table/format.ts +1 -1
- package/src/components/table/header.tsx +1 -1
- package/src/components/table/pagination.tsx +17 -31
- package/src/components/table/table.tsx +2 -2
- package/src/components/version/version.tsx +1 -1
- package/src/components/vulnerability/constants.ts +6 -6
- package/src/components/vulnerability/severityPill.tsx +6 -7
- package/src/globals.css +12 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useClickOutside.ts +5 -22
- package/src/icons/icons.tsx +431 -0
- package/src/icons/index.ts +2 -0
- package/src/index.ts +0 -1
- package/src/types/hooks.d.ts +8 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/logoConsoleOutput/logoConsoleOutput.ts +31 -0
- package/tsconfig.json +3 -2
- package/tsdown.config.ts +26 -0
- package/Readme.md +0 -29
- package/bun.lock +0 -662
- package/dist/src/components/alert/alert.d.ts +0 -8
- package/dist/src/components/alert/alert.js +0 -15
- package/dist/src/components/buttons/button.d.ts +0 -13
- package/dist/src/components/buttons/button.js +0 -30
- package/dist/src/components/confirm/confirmPopup.d.ts +0 -12
- package/dist/src/components/confirm/confirmPopup.js +0 -18
- package/dist/src/components/container/highlight.d.ts +0 -4
- package/dist/src/components/container/highlight.js +0 -4
- package/dist/src/components/container/page.d.ts +0 -8
- package/dist/src/components/container/page.js +0 -4
- package/dist/src/components/inputs/checkbox.d.ts +0 -17
- package/dist/src/components/inputs/checkbox.js +0 -37
- package/dist/src/components/inputs/input.d.ts +0 -12
- package/dist/src/components/inputs/input.js +0 -124
- package/dist/src/components/inputs/radio.d.ts +0 -17
- package/dist/src/components/inputs/radio.js +0 -27
- package/dist/src/components/inputs/range.d.ts +0 -11
- package/dist/src/components/inputs/range.js +0 -22
- package/dist/src/components/inputs/searchInput.d.ts +0 -6
- package/dist/src/components/inputs/searchInput.js +0 -42
- package/dist/src/components/inputs/select.d.ts +0 -23
- package/dist/src/components/inputs/select.js +0 -70
- package/dist/src/components/inputs/shared/colorPickerPopup.d.ts +0 -8
- package/dist/src/components/inputs/shared/colorPickerPopup.js +0 -191
- package/dist/src/components/inputs/shared/dateTimePickerPopup.d.ts +0 -9
- package/dist/src/components/inputs/shared/dateTimePickerPopup.js +0 -128
- package/dist/src/components/inputs/shared/fieldWrapper.d.ts +0 -14
- package/dist/src/components/inputs/shared/fieldWrapper.js +0 -8
- package/dist/src/components/inputs/shared/index.d.ts +0 -5
- package/dist/src/components/inputs/shared/index.js +0 -5
- package/dist/src/components/inputs/shared/inputError.d.ts +0 -6
- package/dist/src/components/inputs/shared/inputError.js +0 -6
- package/dist/src/components/inputs/shared/inputInfo.d.ts +0 -5
- package/dist/src/components/inputs/shared/inputInfo.js +0 -5
- package/dist/src/components/inputs/shared/inputLabel.d.ts +0 -9
- package/dist/src/components/inputs/shared/inputLabel.js +0 -4
- package/dist/src/components/inputs/switch.d.ts +0 -11
- package/dist/src/components/inputs/switch.js +0 -14
- package/dist/src/components/inputs/tagInput.d.ts +0 -15
- package/dist/src/components/inputs/tagInput.js +0 -40
- package/dist/src/components/inputs/textarea.d.ts +0 -11
- package/dist/src/components/inputs/textarea.js +0 -36
- package/dist/src/components/inputs/toggle.d.ts +0 -14
- package/dist/src/components/inputs/toggle.js +0 -12
- package/dist/src/components/login/loginPage.d.ts +0 -2
- package/dist/src/components/login/loginPage.js +0 -18
- package/dist/src/components/logo/logo.d.ts +0 -5
- package/dist/src/components/logo/logo.js +0 -6
- package/dist/src/components/logo/logoSmall.d.ts +0 -1
- package/dist/src/components/logo/logoSmall.js +0 -6
- package/dist/src/components/markdownrender/markdownRender.d.ts +0 -6
- package/dist/src/components/markdownrender/markdownRender.js +0 -25
- package/dist/src/components/navbar/bubble.d.ts +0 -14
- package/dist/src/components/navbar/bubble.js +0 -8
- package/dist/src/components/navbar/navbar.d.ts +0 -34
- package/dist/src/components/navbar/navbar.js +0 -36
- package/dist/src/components/navbar/navbarDropdown.d.ts +0 -7
- package/dist/src/components/navbar/navbarDropdown.js +0 -19
- package/dist/src/components/navbar/navbarItem.d.ts +0 -11
- package/dist/src/components/navbar/navbarItem.js +0 -12
- package/dist/src/components/table/body.d.ts +0 -15
- package/dist/src/components/table/body.js +0 -116
- package/dist/src/components/table/format.d.ts +0 -1
- package/dist/src/components/table/format.js +0 -27
- package/dist/src/components/table/header.d.ts +0 -8
- package/dist/src/components/table/header.js +0 -47
- package/dist/src/components/table/menu.d.ts +0 -17
- package/dist/src/components/table/menu.js +0 -30
- package/dist/src/components/table/pagination.d.ts +0 -6
- package/dist/src/components/table/pagination.js +0 -86
- package/dist/src/components/table/table.d.ts +0 -14
- package/dist/src/components/table/table.js +0 -14
- package/dist/src/components/toast/toastItem.d.ts +0 -2
- package/dist/src/components/toast/toastItem.js +0 -38
- package/dist/src/components/toast/toaster.d.ts +0 -9
- package/dist/src/components/toast/toaster.js +0 -86
- package/dist/src/components/toggle/language.d.ts +0 -4
- package/dist/src/components/toggle/language.js +0 -29
- package/dist/src/components/toggle/theme.d.ts +0 -3
- package/dist/src/components/toggle/theme.js +0 -30
- package/dist/src/components/version/version.d.ts +0 -7
- package/dist/src/components/version/version.js +0 -12
- package/dist/src/components/vulnerability/constants.d.ts +0 -4
- package/dist/src/components/vulnerability/constants.js +0 -14
- package/dist/src/components/vulnerability/severityPill.d.ts +0 -8
- package/dist/src/components/vulnerability/severityPill.js +0 -8
- package/dist/src/hooks/useClickOutside.d.ts +0 -2
- package/dist/src/hooks/useClickOutside.js +0 -27
- package/dist/src/hooks/useDarkMode.d.ts +0 -1
- package/dist/src/hooks/useDarkMode.js +0 -17
- package/dist/src/hooks/useVisibility.d.ts +0 -4
- package/dist/src/hooks/useVisibility.js +0 -23
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -5
- package/dist/src/scripts/buildCss.d.ts +0 -1
- package/dist/src/scripts/buildCss.js +0 -22
- package/dist/src/scripts/index.d.ts +0 -1
- package/dist/src/scripts/index.js +0 -1
- package/dist/src/scripts/rewriteAlias.d.ts +0 -1
- package/dist/src/scripts/rewriteAlias.js +0 -31
- package/dist/src/utils/LogoConsoleOutput/LogoConsoleOutput.d.ts +0 -1
- package/dist/src/utils/LogoConsoleOutput/LogoConsoleOutput.js +0 -44
- package/dist/src/utils/auth/callback.d.ts +0 -2
- package/dist/src/utils/auth/callback.js +0 -63
- package/dist/src/utils/auth/getDomain.d.ts +0 -2
- package/dist/src/utils/auth/getDomain.js +0 -6
- package/dist/src/utils/auth/login.d.ts +0 -3
- package/dist/src/utils/auth/login.js +0 -14
- package/dist/src/utils/auth/logout.d.ts +0 -3
- package/dist/src/utils/auth/logout.js +0 -18
- package/dist/src/utils/auth/token.d.ts +0 -3
- package/dist/src/utils/auth/token.js +0 -33
- package/dist/tailwind.config.d.ts +0 -3
- package/dist/tailwind.config.js +0 -7
- package/src/scripts/buildCss.ts +0 -25
- package/src/scripts/index.ts +0 -1
- package/src/scripts/rewriteAlias.ts +0 -39
- package/src/utils/LogoConsoleOutput/LogoConsoleOutput.ts +0 -61
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import Body from './body';
|
|
4
|
-
import Header from './header';
|
|
5
|
-
export default function Table({ data, columns, menuItems, redirectPath, variant = 'default', idKey }) {
|
|
6
|
-
if (data.length === 0) {
|
|
7
|
-
return _jsx("div", { className: 'p-4 text-center text-login-200', children: "No data found" });
|
|
8
|
-
}
|
|
9
|
-
return (_jsx("div", { className: `
|
|
10
|
-
flex-1 flex flex-col min-h-0 overflow-x-auto overflow-y-hidden h-full w-full
|
|
11
|
-
${variant === 'default' ? 'bg-login-500/50 rounded-lg shadow border border-login-600' : ''}
|
|
12
|
-
${variant === 'minimal' ? 'bg-transparent' : ''}
|
|
13
|
-
`, children: _jsxs("table", { className: 'min-w-full w-max divide-y divide-login-600 flex flex-col flex-1 min-h-0', children: [_jsx(Header, { columns: columns, hideMenu: !menuItems, variant: variant }), _jsx(Body, { list: data, columns: columns, menuItems: menuItems, redirectPath: redirectPath, variant: variant, idKey: idKey })] }) }));
|
|
14
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from 'lucide-react';
|
|
3
|
-
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
export default function ToastItem({ toast, index, expanded, onRemove, onHeight, offset, frontHeight }) {
|
|
5
|
-
const [mounted, setMounted] = useState(false);
|
|
6
|
-
const ref = useRef(null);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
requestAnimationFrame(() => setMounted(true));
|
|
9
|
-
}, []);
|
|
10
|
-
useLayoutEffect(() => {
|
|
11
|
-
if (ref.current) {
|
|
12
|
-
onHeight(toast.id, ref.current.offsetHeight);
|
|
13
|
-
}
|
|
14
|
-
}, [toast.message, onHeight, toast.id, expanded]);
|
|
15
|
-
const isVisible = mounted && !toast.exiting;
|
|
16
|
-
const isFront = index === 0;
|
|
17
|
-
const collapsedOffset = index * 10 + (index > 0 ? (frontHeight - 60) : 0);
|
|
18
|
-
return (_jsx("li", { ref: ref, className: 'absolute bottom-0 right-0 w-full transition-all duration-300 ease-out pointer-events-auto', style: {
|
|
19
|
-
transform: isVisible
|
|
20
|
-
? `translateY(${expanded ? -offset : -collapsedOffset}px) scale(${expanded ? 1 : 1 - index * 0.05})`
|
|
21
|
-
: 'translateY(20px) scale(0.9)',
|
|
22
|
-
opacity: isVisible ? 1 : 0,
|
|
23
|
-
zIndex: toast.id
|
|
24
|
-
}, children: _jsxs("div", { className: 'flex items-center space-x-4 rounded-lg p-4 shadow-lg border-2 border-login-400 bg-login-700', children: [_jsx("div", { className: 'shrink-0', children: Icon(toast.type) }), _jsx("p", { className: `flex-1 text-sm font-semibold text-login-800 dark:text-login-100 min-w-0
|
|
25
|
-
${!expanded && !isFront ? 'truncate' : ''}`, children: toast.message }), _jsx("button", { onClick: onRemove, className: 'hover:text-login-200 text-login-400', children: _jsx(X, { className: 'h-5 w-5' }) })] }) }));
|
|
26
|
-
}
|
|
27
|
-
function Icon(type) {
|
|
28
|
-
switch (type) {
|
|
29
|
-
case 'info':
|
|
30
|
-
return _jsx(Info, { className: 'h-6 w-6 text-blue-500' });
|
|
31
|
-
case 'success':
|
|
32
|
-
return _jsx(CheckCircle, { className: 'h-6 w-6 text-green-500' });
|
|
33
|
-
case 'warning':
|
|
34
|
-
return _jsx(AlertTriangle, { className: 'h-6 w-6 text-yellow-500' });
|
|
35
|
-
case 'error':
|
|
36
|
-
return _jsx(AlertCircle, { className: 'h-6 w-6 text-red-500' });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ToastType } from 'uibee/components';
|
|
2
|
-
export declare function toast(message: string, type: ToastType, duration?: number): void;
|
|
3
|
-
export declare namespace toast {
|
|
4
|
-
var info: (message: string, duration?: number) => void;
|
|
5
|
-
var success: (message: string, duration?: number) => void;
|
|
6
|
-
var warning: (message: string, duration?: number) => void;
|
|
7
|
-
var error: (message: string, duration?: number) => void;
|
|
8
|
-
}
|
|
9
|
-
export default function Toaster(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useMemo } from 'react';
|
|
4
|
-
import ToastItem from './toastItem';
|
|
5
|
-
const listeners = new Set();
|
|
6
|
-
let idCounter = 0;
|
|
7
|
-
export function toast(message, type, duration = 4000) {
|
|
8
|
-
const id = ++idCounter;
|
|
9
|
-
listeners.forEach(listener => listener({ id, message, type, expiresAt: Date.now() + duration }));
|
|
10
|
-
}
|
|
11
|
-
toast.info = (message, duration) => toast(message, 'info', duration);
|
|
12
|
-
toast.success = (message, duration) => toast(message, 'success', duration);
|
|
13
|
-
toast.warning = (message, duration) => toast(message, 'warning', duration);
|
|
14
|
-
toast.error = (message, duration) => toast(message, 'error', duration);
|
|
15
|
-
export default function Toaster() {
|
|
16
|
-
const [toasts, setToasts] = useState([]);
|
|
17
|
-
const [expanded, setExpanded] = useState(false);
|
|
18
|
-
const [heights, setHeights] = useState({});
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
function addToast(toast) {
|
|
21
|
-
setToasts(prev => [toast, ...prev]);
|
|
22
|
-
}
|
|
23
|
-
listeners.add(addToast);
|
|
24
|
-
return () => {
|
|
25
|
-
listeners.delete(addToast);
|
|
26
|
-
};
|
|
27
|
-
}, []);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const now = Date.now();
|
|
30
|
-
setToasts(prev => prev.map(toast => {
|
|
31
|
-
if (expanded)
|
|
32
|
-
return { ...toast, pausedAt: toast.pausedAt || now };
|
|
33
|
-
if (!toast.pausedAt)
|
|
34
|
-
return toast;
|
|
35
|
-
return { ...toast, expiresAt: toast.expiresAt + (now - toast.pausedAt), pausedAt: undefined };
|
|
36
|
-
}));
|
|
37
|
-
}, [expanded]);
|
|
38
|
-
function removeToast(id) {
|
|
39
|
-
setToasts(prev => prev.map(toast => toast.id === id ? { ...toast, exiting: true } : toast));
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
setToasts(prev => prev.filter(toast => toast.id !== id));
|
|
42
|
-
}, 300);
|
|
43
|
-
}
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
const timer = setInterval(() => {
|
|
46
|
-
if (expanded)
|
|
47
|
-
return;
|
|
48
|
-
const now = Date.now();
|
|
49
|
-
setToasts(prev => {
|
|
50
|
-
const toastsToExit = prev.filter(toast => !toast.exiting && !toast.pausedAt && toast.expiresAt <= now);
|
|
51
|
-
if (toastsToExit.length === 0)
|
|
52
|
-
return prev;
|
|
53
|
-
toastsToExit.forEach(toast => {
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
setToasts(current => current.filter(item => item.id !== toast.id));
|
|
56
|
-
}, 300);
|
|
57
|
-
});
|
|
58
|
-
return prev.map(toast => toastsToExit.find(exitToast => exitToast.id === toast.id) ? { ...toast, exiting: true } : toast);
|
|
59
|
-
});
|
|
60
|
-
}, 100);
|
|
61
|
-
return () => clearInterval(timer);
|
|
62
|
-
}, [expanded]);
|
|
63
|
-
function onHeight(id, height) {
|
|
64
|
-
setHeights(prev => {
|
|
65
|
-
if (prev[id] === height)
|
|
66
|
-
return prev;
|
|
67
|
-
return { ...prev, [id]: height };
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
const visibleToasts = toasts.slice(0, expanded ? 10 : 3);
|
|
71
|
-
const frontHeight = heights[visibleToasts[0]?.id] || 60;
|
|
72
|
-
const offsets = useMemo(() => {
|
|
73
|
-
let currentOffset = 0;
|
|
74
|
-
return visibleToasts.map(toast => {
|
|
75
|
-
const height = heights[toast.id] || 60;
|
|
76
|
-
const offset = currentOffset;
|
|
77
|
-
currentOffset += height + 16;
|
|
78
|
-
return offset;
|
|
79
|
-
});
|
|
80
|
-
}, [visibleToasts, heights]);
|
|
81
|
-
const totalHeight = offsets.length > 0
|
|
82
|
-
? offsets[offsets.length - 1] + (heights[visibleToasts[visibleToasts.length - 1]?.id] || 60)
|
|
83
|
-
: 0;
|
|
84
|
-
return (_jsx("ul", { className: `fixed bottom-4 right-4 z-9999 w-full max-w-sm flex flex-col items-end transition-all duration-300 ease-out
|
|
85
|
-
${expanded ? 'pointer-events-auto' : 'pointer-events-none'}`, style: { height: expanded ? totalHeight + 'px' : 'auto' }, onMouseEnter: () => setExpanded(true), onMouseLeave: () => setExpanded(false), children: visibleToasts.map((toast, index) => (_jsx(ToastItem, { toast: toast, index: index, expanded: expanded, onRemove: () => removeToast(toast.id), onHeight: onHeight, offset: offsets[index], frontHeight: frontHeight }, toast.id))) }));
|
|
86
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { getCookie, setCookie } from 'utilbee';
|
|
5
|
-
import { useRouter } from 'next/navigation';
|
|
6
|
-
import { Globe } from 'lucide-react';
|
|
7
|
-
export default function LanguageToggle({ language }) {
|
|
8
|
-
const [lang, setLang] = useState(language || 'en');
|
|
9
|
-
const [jump, setJump] = useState(false);
|
|
10
|
-
const router = useRouter();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const savedLang = getCookie('lang');
|
|
13
|
-
if (savedLang) {
|
|
14
|
-
setLang(savedLang);
|
|
15
|
-
}
|
|
16
|
-
}, []);
|
|
17
|
-
function handleClick() {
|
|
18
|
-
const newLang = lang === 'no' ? 'en' : 'no';
|
|
19
|
-
setCookie('lang', newLang);
|
|
20
|
-
setLang(newLang);
|
|
21
|
-
language = newLang;
|
|
22
|
-
setJump(true);
|
|
23
|
-
setTimeout(() => setJump(false), 400);
|
|
24
|
-
router.refresh();
|
|
25
|
-
}
|
|
26
|
-
const buttonClasses = `cursor-pointer p-2 leading-8 text-base w-[4.3rem] text-center rounded
|
|
27
|
-
bg-transparent border-none hover:bg-gray-400/10 flex flex-row items-center justify-center gap-1`;
|
|
28
|
-
return (_jsxs("button", { value: lang, onClick: handleClick, className: buttonClasses, children: [_jsx(Globe, { className: `text-xl leading-8 -mt-0.5 ${jump ? 'animate-jump' : ''}` }), ' ' + lang] }));
|
|
29
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { getCookie, setCookie } from 'utilbee';
|
|
5
|
-
import { useRouter } from 'next/navigation';
|
|
6
|
-
export default function ThemeToggle({ className }) {
|
|
7
|
-
const router = useRouter();
|
|
8
|
-
const [theme, setTheme] = useState('dark');
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const savedTheme = getCookie('theme');
|
|
11
|
-
if (savedTheme) {
|
|
12
|
-
setTheme(savedTheme);
|
|
13
|
-
}
|
|
14
|
-
document.documentElement.classList.remove('dark', 'light');
|
|
15
|
-
document.documentElement.classList.add(theme);
|
|
16
|
-
}, [theme]);
|
|
17
|
-
function toggleTheme() {
|
|
18
|
-
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
19
|
-
setCookie('theme', newTheme);
|
|
20
|
-
setTheme(newTheme);
|
|
21
|
-
router.refresh();
|
|
22
|
-
}
|
|
23
|
-
return (_jsx("div", { className: `grid place-items-center justify-end rounded-md hover:bg-login-300/20 w-fit ${className}`, children: _jsxs("label", { className: 'cursor-pointer', children: [_jsx("input", { type: 'checkbox', checked: theme === 'light', onChange: toggleTheme, className: 'sr-only' }), _jsx(ThemeIcon, { theme: theme })] }) }));
|
|
24
|
-
}
|
|
25
|
-
function ThemeIcon({ theme }) {
|
|
26
|
-
const sunrayClass = `fill-white transition-opacity duration-400 ${theme === 'light' ? 'opacity-0' : 'opacity-100'}`;
|
|
27
|
-
return (_jsxs("svg", { className: 'h-12 p-3', viewBox: '0 0 100 100', xmlns: 'http://www.w3.org/2000/svg', children: [_jsx("defs", { children: _jsxs("mask", { id: 'theme-toggle_clip-path', children: [_jsx("rect", { x: '0', y: '0', width: '100', height: '100', fill: 'white' }), _jsx("circle", { className: `transition-transform duration-400 ${theme === 'dark' ? 'translate-x-8 -translate-y-4' : ''}`, cx: '68', cy: '40', r: '18' })] }) }), _jsx("circle", { className: `origin-center transition-all duration-400 ${theme === 'light'
|
|
28
|
-
? 'scale-[1.9] fill-black'
|
|
29
|
-
: 'scale-100 fill-white'}`, mask: 'url(#theme-toggle_clip-path)', cx: '50', cy: '50', r: '23' }), _jsx("rect", { className: sunrayClass, x: '86', y: '47', width: '14', height: '6', rx: '3' }), _jsx("rect", { className: sunrayClass, y: '47', width: '14', height: '6', rx: '3' }), _jsx("rect", { className: sunrayClass, x: '47', y: '86', width: '6', height: '14', rx: '3' }), _jsx("rect", { className: sunrayClass, x: '75', y: '75', width: '6', height: '14', rx: '3', transform: 'rotate(-45 78 78)' }), _jsx("rect", { className: sunrayClass, x: '84.8995', y: '12', width: '6', height: '14', rx: '3', transform: 'rotate(45 84.8995 12)' }), _jsx("rect", { className: sunrayClass, x: '22.8995', y: '74', width: '6', height: '14', rx: '3', transform: 'rotate(45 22.8995 74)' }), _jsx("rect", { className: sunrayClass, x: '13', y: '16.2426', width: '6', height: '14', rx: '3', transform: 'rotate(-45 13 16.2426)' }), _jsx("rect", { className: sunrayClass, x: '47', y: '0', width: '6', height: '14', rx: '3' })] }));
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Link from 'next/link';
|
|
3
|
-
export default function VersionTag({ version, url, className }) {
|
|
4
|
-
if (!version) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
const style = `w-fit bg-login-600 px-2 py-1 rounded-md text-white tracking-[0.05em] font-semibold text-lg ${className}`;
|
|
8
|
-
if (url) {
|
|
9
|
-
return (_jsxs(Link, { className: style, target: '_blank', href: url, children: ["v", version] }));
|
|
10
|
-
}
|
|
11
|
-
return (_jsxs("div", { className: style, children: ["v", version] }));
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const severityLabel = {
|
|
2
|
-
critical: 'Critical',
|
|
3
|
-
high: 'High',
|
|
4
|
-
medium: 'Medium',
|
|
5
|
-
low: 'Low',
|
|
6
|
-
unknown: 'Unknown',
|
|
7
|
-
};
|
|
8
|
-
export const severityClasses = {
|
|
9
|
-
critical: 'border-red-400/25 bg-red-500/10 text-red-200',
|
|
10
|
-
high: 'border-orange-400/25 bg-orange-500/10 text-orange-200',
|
|
11
|
-
medium: 'border-amber-400/25 bg-amber-500/10 text-amber-200',
|
|
12
|
-
low: 'border-sky-400/25 bg-sky-500/10 text-sky-200',
|
|
13
|
-
unknown: 'border-login-100/10 bg-login-50/5 text-login-200',
|
|
14
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type SeverityLevel = 'critical' | 'high' | 'medium' | 'low' | 'unknown';
|
|
2
|
-
type SeverityPillProps = {
|
|
3
|
-
severity: SeverityLevel;
|
|
4
|
-
count: number;
|
|
5
|
-
compact?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export default function SeverityPill({ severity, count, compact }: SeverityPillProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { severityClasses, severityLabel } from './constants';
|
|
3
|
-
export default function SeverityPill({ severity, count, compact = false }) {
|
|
4
|
-
if (count === 0) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
return (_jsxs("div", { className: `rounded-xl border ${compact ? 'px-3 py-2' : 'p-3'} ${severityClasses[severity]}`, children: [_jsx("div", { className: 'text-[11px] font-medium uppercase tracking-[0.18em]', children: severityLabel[severity] }), _jsx("div", { className: `${compact ? 'mt-1 text-sm' : 'mt-2 text-lg'} font-semibold`, children: count })] }));
|
|
8
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
export default function useClickOutside(refOrCallback, maybeCallback) {
|
|
3
|
-
let ref;
|
|
4
|
-
let callback;
|
|
5
|
-
if (typeof refOrCallback === 'function') {
|
|
6
|
-
ref = useRef(null);
|
|
7
|
-
callback = refOrCallback;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
ref = refOrCallback;
|
|
11
|
-
callback = maybeCallback;
|
|
12
|
-
}
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
function handleClickOutside(event) {
|
|
15
|
-
if (ref && ref.current && !ref.current.contains(event.target)) {
|
|
16
|
-
callback();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
20
|
-
return () => {
|
|
21
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
22
|
-
};
|
|
23
|
-
}, [ref, callback]);
|
|
24
|
-
if (typeof refOrCallback === 'function')
|
|
25
|
-
return ref;
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useDarkMode(): boolean;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
export default function useDarkMode() {
|
|
3
|
-
const [isDark, setIsDark] = useState(false);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const darkClassExists = document.documentElement.classList.contains('dark');
|
|
6
|
-
setIsDark(darkClassExists);
|
|
7
|
-
const observer = new MutationObserver(() => {
|
|
8
|
-
setIsDark(document.documentElement.classList.contains('dark'));
|
|
9
|
-
});
|
|
10
|
-
observer.observe(document.documentElement, {
|
|
11
|
-
attributes: true,
|
|
12
|
-
attributeFilter: ['class'],
|
|
13
|
-
});
|
|
14
|
-
return () => observer.disconnect();
|
|
15
|
-
}, []);
|
|
16
|
-
return isDark;
|
|
17
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
export default function useVisibility(onVisible, rootMargin = '200px') {
|
|
3
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
4
|
-
const ref = useRef(null);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (typeof window === 'undefined')
|
|
7
|
-
return;
|
|
8
|
-
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
9
|
-
if (!isTouchDevice)
|
|
10
|
-
return;
|
|
11
|
-
const observer = new IntersectionObserver((entries) => {
|
|
12
|
-
if (entries[0].isIntersecting) {
|
|
13
|
-
setIsVisible(true);
|
|
14
|
-
onVisible();
|
|
15
|
-
observer.disconnect();
|
|
16
|
-
}
|
|
17
|
-
}, { rootMargin });
|
|
18
|
-
if (ref.current)
|
|
19
|
-
observer.observe(ref.current);
|
|
20
|
-
return () => observer.disconnect();
|
|
21
|
-
}, [onVisible, rootMargin]);
|
|
22
|
-
return { ref, isVisible };
|
|
23
|
-
}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function buildCss(): Promise<void>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import postcss from 'postcss';
|
|
4
|
-
export default async function buildCss() {
|
|
5
|
-
const tailwindModule = await import(new URL('../../tailwind.config.ts', import.meta.url).href);
|
|
6
|
-
const tailwindConfig = tailwindModule.default ?? tailwindModule;
|
|
7
|
-
const tailwindPostcss = (await import('@tailwindcss/postcss')).default;
|
|
8
|
-
const inputPath = path.resolve('./src/globals.css');
|
|
9
|
-
const outputPath = path.resolve('./dist/src/globals.css');
|
|
10
|
-
const inputCss = readFileSync(inputPath, 'utf-8');
|
|
11
|
-
const result = await postcss([tailwindPostcss(tailwindConfig)]).process(inputCss, {
|
|
12
|
-
from: inputPath,
|
|
13
|
-
to: outputPath,
|
|
14
|
-
});
|
|
15
|
-
mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
16
|
-
writeFileSync(outputPath, result.css);
|
|
17
|
-
console.log('🐝 CSS generated successfully');
|
|
18
|
-
}
|
|
19
|
-
buildCss().catch(err => {
|
|
20
|
-
console.error(err);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as buildCss } from './buildCss';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as buildCss } from './buildCss';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { globSync } from 'glob';
|
|
4
|
-
const DIST_DIR = path.resolve('dist');
|
|
5
|
-
const SRC_DIR = path.join(DIST_DIR, 'src');
|
|
6
|
-
const jsFiles = globSync(`${DIST_DIR}/**/*.js`, { nodir: true });
|
|
7
|
-
jsFiles.forEach((file) => {
|
|
8
|
-
let content = fs.readFileSync(file, 'utf-8');
|
|
9
|
-
const fileDir = path.dirname(file);
|
|
10
|
-
// Handle @utils/* imports
|
|
11
|
-
content = content.replace(/from ['"]@utils\/(.*?)['"]/g, (_, p1) => {
|
|
12
|
-
const targetPath = path.join(SRC_DIR, 'utils', p1);
|
|
13
|
-
const relative = path.relative(fileDir, targetPath).replace(/\\/g, '/');
|
|
14
|
-
return `from '${relative}'`;
|
|
15
|
-
});
|
|
16
|
-
// Handle @components/* imports
|
|
17
|
-
content = content.replace(/from ['"]@components\/(.*?)['"]/g, (_, p1) => {
|
|
18
|
-
const targetPath = path.join(SRC_DIR, 'components', p1);
|
|
19
|
-
const relative = path.relative(fileDir, targetPath).replace(/\\/g, '/');
|
|
20
|
-
return `from '${relative}'`;
|
|
21
|
-
});
|
|
22
|
-
// Handle @hooks/* imports
|
|
23
|
-
content = content.replace(/from ['"]@hooks\/(.*?)['"]/g, (_, p1) => {
|
|
24
|
-
const targetPath = path.join(SRC_DIR, 'hooks', p1);
|
|
25
|
-
const relative = path.relative(fileDir, targetPath).replace(/\\/g, '/');
|
|
26
|
-
return `from '${relative}'`;
|
|
27
|
-
});
|
|
28
|
-
fs.writeFileSync(file, content, 'utf-8');
|
|
29
|
-
});
|
|
30
|
-
console.log('🐝 All path aliases rewritten');
|
|
31
|
-
console.log('🐝 Build complete');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function LogoConsoleOutput(): void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export function LogoConsoleOutput() {
|
|
2
|
-
const chromeStr = '%c███████╗ ███████╗\n' +
|
|
3
|
-
'██╔════╝ ╚════██║\n' +
|
|
4
|
-
'██║%c ██╗ ██████╗ ██████╗ ██╗███╗ ██╗ %c██║\n' +
|
|
5
|
-
'╚═╝%c ██║ ██╔═══██╗██╔════╝ ██║████╗ ██║ %c╚═╝%c\n' +
|
|
6
|
-
' ██║ ██║ ██║██║ ███╗██║██╔██╗ ██║\n' +
|
|
7
|
-
' ██║ ██║ ██║██║ ██║██║██║╚██╗██║\n' +
|
|
8
|
-
'%c██╗%c ██████╗╚██████╔╝╚██████╔╝██║██║ ╚████║ %c██╗\n' +
|
|
9
|
-
'██║%c ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝ %c██║\n' +
|
|
10
|
-
'███████╗%c %c███████║\n' +
|
|
11
|
-
'╚══════╝ ╚══════╝%c\n\n' +
|
|
12
|
-
' - Laget av TekKom med 🍕 og ❤️';
|
|
13
|
-
const safariStr = '\n' +
|
|
14
|
-
'%c███████╗\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ███████╗\n' +
|
|
15
|
-
'██╔═════╝\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t╚════██║\n' +
|
|
16
|
-
'██║%c ██╗\t\t\t\t ██████╗\t \t ╔██████╗\t ██╗ \t ███╗ \t\t ██╗%c\t ██║\n' +
|
|
17
|
-
' ╚═╝%c \t██║\t\t\t ██╔════██╗\t ██╔════╝\t ██║ \t ████╗\t ██║%c\t ╚═╝%c\n' +
|
|
18
|
-
' \t\t██║\t\t\t ██║\t\t\t ██║\t ██║\t ███╗ ██║\t\t ██╔██╗ ██║\n' +
|
|
19
|
-
' \t\t██║\t\t\t ██║\t\t\t ██║\t ██║\t\t ██║ ██║\t\t ██║╚██╗ ██║\n' +
|
|
20
|
-
'%c██╗%c ██████╗\t╚██████╝\t\t ╚██████╝\t ██║ ██║\t\t ╚███║ \t %c██╗\n' +
|
|
21
|
-
'██║%c\t ╚═════╝\t\t ╚════╝\t\t\t\t╚═════╝\t\t ╚═╝\t\t ╚═╝\t\t ╚═══╝\t\t %c██║\n' +
|
|
22
|
-
'███████╗%c\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t %c███████║\n' +
|
|
23
|
-
' ╚══════╝\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t╚══════╝%c\n\n' +
|
|
24
|
-
'\t\t\t\t\t\t\t\t\t\t\t\t\t- Laget av TekKom med 🍕 og ❤️';
|
|
25
|
-
let str = '';
|
|
26
|
-
if (navigator.userAgent.indexOf('Chrome') != -1) {
|
|
27
|
-
str = chromeStr;
|
|
28
|
-
}
|
|
29
|
-
else if (navigator.userAgent.indexOf('Firefox') != -1) {
|
|
30
|
-
str = chromeStr;
|
|
31
|
-
}
|
|
32
|
-
else if (navigator.userAgent.indexOf('Safari') != -1) {
|
|
33
|
-
str = safariStr;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return (console.log('Login - Linjeforeningen for IT'));
|
|
37
|
-
}
|
|
38
|
-
// each string is the CSS to apply for each consecutive %c
|
|
39
|
-
console.log(str,
|
|
40
|
-
// applies orange color
|
|
41
|
-
'color: #fd8738',
|
|
42
|
-
// clears the style for every non orange part
|
|
43
|
-
'', 'color: #fd8738', '', 'color: #fd8738', '', 'color: #fd8738', '', 'color: #fd8738', '', 'color: #fd8738', '', 'color: #fd8738', '');
|
|
44
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { getDomain } from './getDomain';
|
|
3
|
-
export default async function authCallback({ req, tokenURL, clientID, clientSecret, redirectPath, userInfoURL, tokenRedirectPath }) {
|
|
4
|
-
const domain = getDomain(req);
|
|
5
|
-
const searchParams = new URL(req.url).searchParams;
|
|
6
|
-
if (!searchParams) {
|
|
7
|
-
return NextResponse.json({ error: 'No search parameters found.' }, { status: 400 });
|
|
8
|
-
}
|
|
9
|
-
const code = searchParams.get('code');
|
|
10
|
-
if (!code) {
|
|
11
|
-
return NextResponse.json({ error: 'No authorization code found.' }, { status: 400 });
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
// Exchanges callback code for access token
|
|
15
|
-
const tokenResponse = await fetch(tokenURL, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
18
|
-
body: new URLSearchParams({
|
|
19
|
-
client_id: clientID,
|
|
20
|
-
client_secret: clientSecret,
|
|
21
|
-
code: code,
|
|
22
|
-
redirect_uri: `${domain}${redirectPath}`,
|
|
23
|
-
grant_type: 'authorization_code',
|
|
24
|
-
}).toString()
|
|
25
|
-
});
|
|
26
|
-
const tokenResponseBody = await tokenResponse.text();
|
|
27
|
-
if (!tokenResponse.ok) {
|
|
28
|
-
return new Response(JSON.stringify(`Failed to obtain token: ${tokenResponseBody}`), {
|
|
29
|
-
status: 500,
|
|
30
|
-
headers: { 'Content-Type': 'application/json' }
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const token = JSON.parse(tokenResponseBody);
|
|
34
|
-
// Fetches user info using access token
|
|
35
|
-
const userInfoResponse = await fetch(userInfoURL, {
|
|
36
|
-
headers: { Authorization: `Bearer ${token.access_token}` }
|
|
37
|
-
});
|
|
38
|
-
if (!userInfoResponse.ok) {
|
|
39
|
-
const userInfoError = await userInfoResponse.text();
|
|
40
|
-
return new Response(`No user info found: ${userInfoError}`, {
|
|
41
|
-
status: 500,
|
|
42
|
-
headers: { 'Content-Type': 'application/json' }
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
const userInfo = await userInfoResponse.json();
|
|
46
|
-
const redirectUrl = new URL(`${domain}${tokenRedirectPath}`);
|
|
47
|
-
const params = new URLSearchParams({
|
|
48
|
-
id: userInfo.sub,
|
|
49
|
-
name: userInfo.name,
|
|
50
|
-
username: userInfo.nickname,
|
|
51
|
-
email: userInfo.email,
|
|
52
|
-
groups: userInfo.groups.join(','),
|
|
53
|
-
access_token: token.access_token,
|
|
54
|
-
});
|
|
55
|
-
redirectUrl.search = params.toString();
|
|
56
|
-
return NextResponse.redirect(redirectUrl.toString());
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
const error = err;
|
|
60
|
-
console.error('Error during OAuth flow:', error.message);
|
|
61
|
-
return NextResponse.json({ error: 'Authentication failed' }, { status: 500 });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export function getDomain(req) {
|
|
2
|
-
const clientProto = req.headers.get('x-forwarded-proto');
|
|
3
|
-
const proto = clientProto ?? new URL(req.url).protocol.replace(':', '');
|
|
4
|
-
const host = req.headers.get('host') ?? req.headers.get('x-forwarded-host') ?? new URL(req.url).host;
|
|
5
|
-
return `${proto}://${host}`;
|
|
6
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { getDomain } from './getDomain';
|
|
3
|
-
export default async function AuthLogin({ req, clientID, redirectPath, authURL }) {
|
|
4
|
-
const domain = getDomain(req);
|
|
5
|
-
const state = Math.random().toString(36).substring(5);
|
|
6
|
-
const authQueryParams = new URLSearchParams({
|
|
7
|
-
client_id: clientID,
|
|
8
|
-
redirect_uri: `${domain}${redirectPath}`,
|
|
9
|
-
response_type: 'code',
|
|
10
|
-
scope: 'openid profile email',
|
|
11
|
-
state: state,
|
|
12
|
-
}).toString();
|
|
13
|
-
return NextResponse.redirect(`${authURL}?${authQueryParams}`);
|
|
14
|
-
}
|