uibee 3.1.5 → 3.2.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/dist/src/components/index.d.ts +165 -2
- package/dist/src/components/index.js +455 -10
- package/dist/style.css +252 -72
- package/package.json +1 -1
- package/src/components/badge/badge.tsx +44 -0
- package/src/components/buttons/button.tsx +2 -1
- package/src/components/code/code.tsx +55 -0
- package/src/components/container/accordion.tsx +5 -1
- package/src/components/container/expandableCard.tsx +80 -0
- package/src/components/container/glassCard.tsx +14 -0
- package/src/components/container/tabs.tsx +3 -3
- package/src/components/empty/emptyState.tsx +26 -0
- package/src/components/index.ts +17 -0
- package/src/components/inputs/fileInput.tsx +100 -0
- package/src/components/inputs/input.tsx +2 -2
- package/src/components/inputs/multiSelect.tsx +8 -2
- package/src/components/inputs/shared/colorPickerPopup.tsx +1 -1
- package/src/components/inputs/shared/dateTimePickerPopup.tsx +1 -1
- package/src/components/inputs/switch.tsx +5 -1
- package/src/components/modal/modal.tsx +74 -0
- package/src/components/sidebar/sidebar.tsx +177 -0
- package/src/components/spinner/spinner.tsx +20 -0
- package/src/components/table/body.tsx +37 -31
- package/src/components/table/constants.ts +1 -3
- package/src/components/table/header.tsx +32 -22
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { t as useClickOutside$1 } from "../../useClickOutside-Cmp-RsP3.js";
|
|
3
3
|
import { D as Facebook, Kt as Wikijs, N as Github, W as Linkedin, x as Discord } from "../../icons-lZYQ6Vlr.js";
|
|
4
4
|
import React, { Suspense, createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { AlertCircle, AlertTriangle, ArrowUpRight, Calendar, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsUpDown, CircleAlert, CircleHelp, Clock, EllipsisVertical, ExternalLink, Eye, Globe, Info, LogIn, LogOut, Pencil, Search, TableIcon, TriangleAlert, User, X } from "lucide-react";
|
|
5
|
+
import { AlertCircle, AlertTriangle, ArrowUpRight, Calendar, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsUpDown, CircleAlert, CircleHelp, Clock, Copy, EllipsisVertical, ExternalLink, Eye, FileIcon, Globe, Info, LogIn, LogOut, Pencil, Search, TableIcon, TriangleAlert, UploadCloud, User, X } from "lucide-react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import Markdown from "react-markdown";
|
|
8
8
|
import remarkGfm from "remark-gfm";
|
|
@@ -1242,7 +1242,7 @@ function MultiSelect({ label, name, options, value = [], onChange, placeholder =
|
|
|
1242
1242
|
const option = options.find((o) => o.value === val);
|
|
1243
1243
|
if (!option) return null;
|
|
1244
1244
|
return /* @__PURE__ */ jsxs("span", {
|
|
1245
|
-
className: "flex items-center gap-1 px-2 py-0.5
|
|
1245
|
+
className: "\n flex items-center gap-1 rounded px-2 py-0.5 text-sm\n border border-login-500 bg-login-600 text-login-100\n ",
|
|
1246
1246
|
children: [option.label, !disabled && /* @__PURE__ */ jsx("button", {
|
|
1247
1247
|
type: "button",
|
|
1248
1248
|
onClick: (e) => {
|
|
@@ -1260,7 +1260,7 @@ function MultiSelect({ label, name, options, value = [], onChange, placeholder =
|
|
|
1260
1260
|
})]
|
|
1261
1261
|
}),
|
|
1262
1262
|
open && options.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1263
|
-
className: "absolute z-50 mt-1 w-full max-h-60 overflow-auto
|
|
1263
|
+
className: "\n absolute z-50 mt-1 w-full max-h-60 overflow-auto\n rounded-md border border-login-500/50 bg-login-800 shadow-lg\n ",
|
|
1264
1264
|
children: options.map((option) => {
|
|
1265
1265
|
const selected = value.includes(option.value);
|
|
1266
1266
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1314,7 +1314,7 @@ function Switch(props) {
|
|
|
1314
1314
|
${inputProps.disabled ? "opacity-40 cursor-not-allowed" : ""}
|
|
1315
1315
|
${error ? "ring-1 ring-red-500/60" : ""}
|
|
1316
1316
|
`,
|
|
1317
|
-
children: /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 my-auto left-0.5 h-5 w-5
|
|
1317
|
+
children: /* @__PURE__ */ jsx("span", { className: "\n absolute inset-y-0 my-auto left-0.5 h-5 w-5\n rounded-full bg-white shadow-sm transition-all\n group-has-[input:checked]/sw:translate-x-full\n " })
|
|
1318
1318
|
})]
|
|
1319
1319
|
})
|
|
1320
1320
|
});
|
|
@@ -2358,7 +2358,7 @@ function Accordion({ title, children, defaultOpen = false, className = "" }) {
|
|
|
2358
2358
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
2359
2359
|
type: "button",
|
|
2360
2360
|
onClick: () => setOpen((o) => !o),
|
|
2361
|
-
className: "flex w-full cursor-pointer items-center justify-between
|
|
2361
|
+
className: "\n flex w-full cursor-pointer items-center justify-between\n bg-login-800 px-4 py-3 text-left select-none\n transition-colors duration-150 hover:bg-login-700\n ",
|
|
2362
2362
|
children: [/* @__PURE__ */ jsx("div", {
|
|
2363
2363
|
className: "text-sm font-medium text-login-50",
|
|
2364
2364
|
children: title
|
|
@@ -2641,7 +2641,7 @@ function Toaster() {
|
|
|
2641
2641
|
}
|
|
2642
2642
|
//#endregion
|
|
2643
2643
|
//#region src/components/buttons/button.tsx
|
|
2644
|
-
const variants = {
|
|
2644
|
+
const variants$1 = {
|
|
2645
2645
|
primary: "bg-login text-white hover:brightness-110",
|
|
2646
2646
|
secondary: "bg-login-500 text-login-50 hover:bg-login-400",
|
|
2647
2647
|
warning: "bg-yellow-500 text-black hover:brightness-110",
|
|
@@ -2658,7 +2658,7 @@ const iconWrap = (icon) => icon ? /* @__PURE__ */ jsx("span", {
|
|
|
2658
2658
|
children: icon
|
|
2659
2659
|
}) : null;
|
|
2660
2660
|
function Button({ text, className, icon, path, variant = "primary", type, onClick, disabled }) {
|
|
2661
|
-
const color = variants[variant];
|
|
2661
|
+
const color = variants$1[variant];
|
|
2662
2662
|
const sizing = icon && !text ? iconOnly : withText;
|
|
2663
2663
|
const cls = `${base} ${sizing} ${color} ${disabled ? disabledCls : ""} ${className || ""}`;
|
|
2664
2664
|
if (!path) return /* @__PURE__ */ jsxs("button", {
|
|
@@ -2735,7 +2735,7 @@ const VARIANT_THEAD = {
|
|
|
2735
2735
|
};
|
|
2736
2736
|
const VARIANT_HEAD_BG = {
|
|
2737
2737
|
original: "bg-login-700",
|
|
2738
|
-
modern: "
|
|
2738
|
+
modern: ""
|
|
2739
2739
|
};
|
|
2740
2740
|
const VARIANT_HEAD_BORDER = {
|
|
2741
2741
|
original: "border-b border-login-600",
|
|
@@ -2846,7 +2846,11 @@ function Header({ columns, sort, onSort, hasMenu, hasSelect, hasExpand, allSelec
|
|
|
2846
2846
|
minWidth: "2.5rem"
|
|
2847
2847
|
},
|
|
2848
2848
|
children: /* @__PURE__ */ jsx("span", {
|
|
2849
|
-
className: `
|
|
2849
|
+
className: `
|
|
2850
|
+
flex items-center justify-center
|
|
2851
|
+
text-xs font-medium tracking-wider uppercase opacity-50
|
|
2852
|
+
${VARIANT_THEAD_TH[variant]}
|
|
2853
|
+
`,
|
|
2850
2854
|
children: "+"
|
|
2851
2855
|
})
|
|
2852
2856
|
}),
|
|
@@ -3713,4 +3717,445 @@ function Toggle({ value, onChange, left, right }) {
|
|
|
3713
3717
|
});
|
|
3714
3718
|
}
|
|
3715
3719
|
//#endregion
|
|
3716
|
-
|
|
3720
|
+
//#region src/components/inputs/fileInput.tsx
|
|
3721
|
+
function FileInput({ name, label, accept, multiple = false, onChange, className = "" }) {
|
|
3722
|
+
const [files, setFiles] = useState([]);
|
|
3723
|
+
const [dragging, setDragging] = useState(false);
|
|
3724
|
+
const inputRef = useRef(null);
|
|
3725
|
+
function handleFiles(incoming) {
|
|
3726
|
+
if (!incoming) return;
|
|
3727
|
+
const arr = multiple ? Array.from(incoming) : [incoming[0]];
|
|
3728
|
+
setFiles(arr);
|
|
3729
|
+
onChange(arr);
|
|
3730
|
+
}
|
|
3731
|
+
function removeFile(index) {
|
|
3732
|
+
const next = files.filter((_, i) => i !== index);
|
|
3733
|
+
setFiles(next);
|
|
3734
|
+
onChange(next);
|
|
3735
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
3736
|
+
}
|
|
3737
|
+
function onDrop(e) {
|
|
3738
|
+
e.preventDefault();
|
|
3739
|
+
setDragging(false);
|
|
3740
|
+
handleFiles(e.dataTransfer.files);
|
|
3741
|
+
}
|
|
3742
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3743
|
+
className: `flex flex-col gap-2 ${className}`,
|
|
3744
|
+
children: [
|
|
3745
|
+
label && /* @__PURE__ */ jsx("label", {
|
|
3746
|
+
className: "text-sm font-medium text-login-200",
|
|
3747
|
+
children: label
|
|
3748
|
+
}),
|
|
3749
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3750
|
+
role: "button",
|
|
3751
|
+
tabIndex: 0,
|
|
3752
|
+
onClick: () => inputRef.current?.click(),
|
|
3753
|
+
onKeyDown: (e) => {
|
|
3754
|
+
if (e.key === "Enter" || e.key === " ") inputRef.current?.click();
|
|
3755
|
+
},
|
|
3756
|
+
onDragOver: (e) => {
|
|
3757
|
+
e.preventDefault();
|
|
3758
|
+
setDragging(true);
|
|
3759
|
+
},
|
|
3760
|
+
onDragLeave: () => setDragging(false),
|
|
3761
|
+
onDrop,
|
|
3762
|
+
className: `
|
|
3763
|
+
flex cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed p-6
|
|
3764
|
+
transition-all duration-150
|
|
3765
|
+
${dragging ? "scale-[1.01] border-login bg-login/5" : "border-login-500/50 bg-login-800/30 hover:border-login/50 hover:bg-login/5"}
|
|
3766
|
+
`,
|
|
3767
|
+
children: [
|
|
3768
|
+
/* @__PURE__ */ jsx("input", {
|
|
3769
|
+
ref: inputRef,
|
|
3770
|
+
type: "file",
|
|
3771
|
+
name,
|
|
3772
|
+
accept,
|
|
3773
|
+
multiple,
|
|
3774
|
+
className: "hidden",
|
|
3775
|
+
onChange: (e) => handleFiles(e.target.files)
|
|
3776
|
+
}),
|
|
3777
|
+
/* @__PURE__ */ jsx(UploadCloud, { className: "h-7 w-7 text-login-400" }),
|
|
3778
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3779
|
+
className: "text-center",
|
|
3780
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3781
|
+
className: "text-sm text-login-200",
|
|
3782
|
+
children: ["Drop files here or ", /* @__PURE__ */ jsx("span", {
|
|
3783
|
+
className: "text-login",
|
|
3784
|
+
children: "browse"
|
|
3785
|
+
})]
|
|
3786
|
+
}), accept && /* @__PURE__ */ jsx("p", {
|
|
3787
|
+
className: "mt-0.5 text-xs text-login-400",
|
|
3788
|
+
children: accept
|
|
3789
|
+
})]
|
|
3790
|
+
})
|
|
3791
|
+
]
|
|
3792
|
+
}),
|
|
3793
|
+
files.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
3794
|
+
className: "flex flex-col gap-1.5",
|
|
3795
|
+
children: files.map((file, i) => /* @__PURE__ */ jsxs("li", {
|
|
3796
|
+
className: "\n flex items-center gap-2 rounded-lg\n border border-login-500/25 bg-login-800/50 px-3 py-2 text-sm\n ",
|
|
3797
|
+
children: [
|
|
3798
|
+
/* @__PURE__ */ jsx(FileIcon, { className: "h-4 w-4 shrink-0 text-login-400" }),
|
|
3799
|
+
/* @__PURE__ */ jsx("span", {
|
|
3800
|
+
className: "flex-1 truncate text-login-200",
|
|
3801
|
+
children: file.name
|
|
3802
|
+
}),
|
|
3803
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3804
|
+
className: "shrink-0 text-xs text-login-400",
|
|
3805
|
+
children: [(file.size / 1024).toFixed(1), " KB"]
|
|
3806
|
+
}),
|
|
3807
|
+
/* @__PURE__ */ jsx("button", {
|
|
3808
|
+
type: "button",
|
|
3809
|
+
onClick: (e) => {
|
|
3810
|
+
e.stopPropagation();
|
|
3811
|
+
removeFile(i);
|
|
3812
|
+
},
|
|
3813
|
+
className: "cursor-pointer text-login-400 transition-colors hover:text-red-400",
|
|
3814
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
3815
|
+
})
|
|
3816
|
+
]
|
|
3817
|
+
}, i))
|
|
3818
|
+
})
|
|
3819
|
+
]
|
|
3820
|
+
});
|
|
3821
|
+
}
|
|
3822
|
+
//#endregion
|
|
3823
|
+
//#region src/components/container/glassCard.tsx
|
|
3824
|
+
function GlassCard({ children, className = "" }) {
|
|
3825
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3826
|
+
className: `rounded-xl border border-login-500/20 bg-login-800/60 backdrop-blur-sm ${className}`,
|
|
3827
|
+
children
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
//#endregion
|
|
3831
|
+
//#region src/components/container/expandableCard.tsx
|
|
3832
|
+
function ExpandableCard({ icon, iconTone = "orange", title, subtitle, pulse, trailing, isExpanded, onToggle, children }) {
|
|
3833
|
+
return /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs("div", {
|
|
3834
|
+
role: "button",
|
|
3835
|
+
tabIndex: 0,
|
|
3836
|
+
onClick: onToggle,
|
|
3837
|
+
onKeyDown: (e) => {
|
|
3838
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3839
|
+
e.preventDefault();
|
|
3840
|
+
onToggle();
|
|
3841
|
+
}
|
|
3842
|
+
},
|
|
3843
|
+
"aria-expanded": isExpanded,
|
|
3844
|
+
className: "group flex cursor-pointer select-none items-center gap-4 px-5 py-4",
|
|
3845
|
+
children: [
|
|
3846
|
+
/* @__PURE__ */ jsx(IconBubble, {
|
|
3847
|
+
icon,
|
|
3848
|
+
tone: iconTone,
|
|
3849
|
+
size: "sm"
|
|
3850
|
+
}),
|
|
3851
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3852
|
+
className: "min-w-0 flex-1",
|
|
3853
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
3854
|
+
className: "flex flex-wrap items-center gap-3",
|
|
3855
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3856
|
+
className: "font-semibold text-login-50 transition group-hover:text-login",
|
|
3857
|
+
children: title
|
|
3858
|
+
}), pulse && /* @__PURE__ */ jsxs("span", {
|
|
3859
|
+
className: "flex items-center gap-2 text-xs text-login-300",
|
|
3860
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3861
|
+
className: "flex h-3 w-3 shrink-0 items-center justify-center",
|
|
3862
|
+
children: /* @__PURE__ */ jsx(PulseDot, {
|
|
3863
|
+
variant: pulse.variant,
|
|
3864
|
+
size: "sm"
|
|
3865
|
+
})
|
|
3866
|
+
}), pulse.label]
|
|
3867
|
+
})]
|
|
3868
|
+
}), subtitle && /* @__PURE__ */ jsx("div", {
|
|
3869
|
+
className: "mt-0.5 text-xs text-login-300",
|
|
3870
|
+
children: subtitle
|
|
3871
|
+
})]
|
|
3872
|
+
}),
|
|
3873
|
+
trailing && /* @__PURE__ */ jsx("div", {
|
|
3874
|
+
className: "flex shrink-0 items-center gap-3",
|
|
3875
|
+
onClick: (e) => e.stopPropagation(),
|
|
3876
|
+
children: trailing
|
|
3877
|
+
}),
|
|
3878
|
+
/* @__PURE__ */ jsx(Button, {
|
|
3879
|
+
variant: "secondary",
|
|
3880
|
+
icon: /* @__PURE__ */ jsx(ChevronDown, { className: `h-4 w-4 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}` }),
|
|
3881
|
+
onClick: (e) => {
|
|
3882
|
+
e.stopPropagation();
|
|
3883
|
+
onToggle();
|
|
3884
|
+
}
|
|
3885
|
+
})
|
|
3886
|
+
]
|
|
3887
|
+
}), isExpanded && children && /* @__PURE__ */ jsx("div", {
|
|
3888
|
+
className: "border-t border-white/5 px-5 pb-5 pt-4",
|
|
3889
|
+
children
|
|
3890
|
+
})] });
|
|
3891
|
+
}
|
|
3892
|
+
//#endregion
|
|
3893
|
+
//#region src/components/modal/modal.tsx
|
|
3894
|
+
const sizes$2 = {
|
|
3895
|
+
sm: "max-w-sm",
|
|
3896
|
+
md: "max-w-md",
|
|
3897
|
+
lg: "max-w-lg"
|
|
3898
|
+
};
|
|
3899
|
+
function Modal({ isOpen, onClose, title, children, footer, size = "md" }) {
|
|
3900
|
+
useEffect(() => {
|
|
3901
|
+
if (!isOpen) return;
|
|
3902
|
+
const handler = (e) => {
|
|
3903
|
+
if (e.key === "Escape") onClose();
|
|
3904
|
+
};
|
|
3905
|
+
document.addEventListener("keydown", handler);
|
|
3906
|
+
return () => document.removeEventListener("keydown", handler);
|
|
3907
|
+
}, [isOpen, onClose]);
|
|
3908
|
+
if (!isOpen) return null;
|
|
3909
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3910
|
+
role: "dialog",
|
|
3911
|
+
"aria-modal": "true",
|
|
3912
|
+
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
3913
|
+
onClick: onClose,
|
|
3914
|
+
children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50 backdrop-blur-sm" }), /* @__PURE__ */ jsxs("div", {
|
|
3915
|
+
className: `
|
|
3916
|
+
relative z-10 mx-4 w-full ${sizes$2[size]}
|
|
3917
|
+
flex flex-col rounded-xl border border-login-500/50
|
|
3918
|
+
bg-login-800 shadow-2xl
|
|
3919
|
+
`,
|
|
3920
|
+
onClick: (e) => e.stopPropagation(),
|
|
3921
|
+
children: [
|
|
3922
|
+
title && /* @__PURE__ */ jsxs("div", {
|
|
3923
|
+
className: "flex items-center justify-between px-6 pt-5 pb-4 border-b border-login-500/25",
|
|
3924
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
3925
|
+
className: "text-login-50 text-base font-semibold leading-snug",
|
|
3926
|
+
children: title
|
|
3927
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3928
|
+
type: "button",
|
|
3929
|
+
onClick: onClose,
|
|
3930
|
+
className: "\n cursor-pointer rounded-md p-1.5\n text-login-400 hover:text-login-100 hover:bg-login-600\n transition-colors\n ",
|
|
3931
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
3932
|
+
})]
|
|
3933
|
+
}),
|
|
3934
|
+
/* @__PURE__ */ jsx("div", {
|
|
3935
|
+
className: "p-6",
|
|
3936
|
+
children
|
|
3937
|
+
}),
|
|
3938
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
3939
|
+
className: "px-6 pb-5 pt-4 border-t border-login-500/25",
|
|
3940
|
+
children: footer
|
|
3941
|
+
})
|
|
3942
|
+
]
|
|
3943
|
+
})]
|
|
3944
|
+
});
|
|
3945
|
+
}
|
|
3946
|
+
//#endregion
|
|
3947
|
+
//#region src/components/sidebar/sidebar.tsx
|
|
3948
|
+
const ITEM_HEIGHT = 48;
|
|
3949
|
+
const GAP = 4;
|
|
3950
|
+
const SUB_STRIDE = 40;
|
|
3951
|
+
function Sidebar({ items, header, bottomAction, mobile = false, initialExpanded = true }) {
|
|
3952
|
+
const [expanded, setExpanded] = useState(initialExpanded);
|
|
3953
|
+
const pathname = usePathname();
|
|
3954
|
+
function isItemActive(item) {
|
|
3955
|
+
return pathname === item.path || !!item.items?.some((sub) => pathname === sub.path || pathname.startsWith(sub.path + "/"));
|
|
3956
|
+
}
|
|
3957
|
+
const activeIndex = items.findIndex(isItemActive);
|
|
3958
|
+
const activeOffset = items.slice(0, Math.max(activeIndex, 0)).reduce((acc, item) => acc + ITEM_HEIGHT + (item.items ? GAP : 0) + GAP, 0);
|
|
3959
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
3960
|
+
className: `
|
|
3961
|
+
flex flex-col border-r border-login-100/10 bg-login-900
|
|
3962
|
+
transition-all duration-300 ease-in-out
|
|
3963
|
+
${mobile ? "w-full" : `h-full ${expanded ? "w-64" : "w-20"}`}
|
|
3964
|
+
`,
|
|
3965
|
+
children: [
|
|
3966
|
+
!mobile && /* @__PURE__ */ jsxs("div", {
|
|
3967
|
+
className: `relative mb-2 p-4 transition-all duration-300 ${expanded ? "h-16" : "h-20"}`,
|
|
3968
|
+
children: [header && /* @__PURE__ */ jsx("div", {
|
|
3969
|
+
className: `
|
|
3970
|
+
absolute top-4 flex items-center transition-all duration-300
|
|
3971
|
+
${expanded ? "left-4 gap-3" : "left-1/2 -translate-x-1/2 gap-0"}
|
|
3972
|
+
`,
|
|
3973
|
+
children: header
|
|
3974
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3975
|
+
onClick: () => setExpanded(!expanded),
|
|
3976
|
+
className: `
|
|
3977
|
+
absolute cursor-pointer rounded-lg p-1.5
|
|
3978
|
+
text-login-200 transition-all duration-300 hover:bg-login-800
|
|
3979
|
+
${expanded ? "right-4 top-4" : "left-1/2 top-12 -translate-x-1/2"}
|
|
3980
|
+
`,
|
|
3981
|
+
children: expanded ? /* @__PURE__ */ jsx(ChevronLeft, { size: 20 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 20 })
|
|
3982
|
+
})]
|
|
3983
|
+
}),
|
|
3984
|
+
mobile && /* @__PURE__ */ jsx("div", { className: "h-4" }),
|
|
3985
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3986
|
+
className: "relative flex flex-1 flex-col gap-1 overflow-x-hidden overflow-y-auto px-3",
|
|
3987
|
+
children: [activeIndex >= 0 && /* @__PURE__ */ jsx("span", {
|
|
3988
|
+
"aria-hidden": true,
|
|
3989
|
+
className: "absolute left-3 right-3 top-0 h-12 rounded-lg bg-login-800 transition-transform duration-300 ease-in-out",
|
|
3990
|
+
style: { transform: `translateY(${activeOffset}px)` }
|
|
3991
|
+
}), items.map((item, index) => {
|
|
3992
|
+
const isActive = isItemActive(item);
|
|
3993
|
+
const Icon = item.icon;
|
|
3994
|
+
const activeSubIndex = item.items ? item.items.findIndex((sub) => pathname === sub.path || pathname.startsWith(sub.path + "/")) : -1;
|
|
3995
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3996
|
+
className: "flex flex-col gap-1",
|
|
3997
|
+
children: [/* @__PURE__ */ jsxs(Link, {
|
|
3998
|
+
href: item.path,
|
|
3999
|
+
title: !expanded ? item.name : void 0,
|
|
4000
|
+
className: `
|
|
4001
|
+
group relative z-10 flex items-center
|
|
4002
|
+
overflow-hidden rounded-lg p-3 transition-all duration-200
|
|
4003
|
+
${isActive ? "text-login" : "text-login-200 hover:bg-login-800/50 hover:text-login-100"}
|
|
4004
|
+
`,
|
|
4005
|
+
children: [
|
|
4006
|
+
/* @__PURE__ */ jsx("div", {
|
|
4007
|
+
className: `
|
|
4008
|
+
flex min-w-6 w-6 items-center justify-center transition-all duration-300
|
|
4009
|
+
${expanded ? "" : "translate-x-1"}
|
|
4010
|
+
${isActive ? "[&>svg]:stroke-login" : "group-hover:[&>svg]:stroke-login-100"}
|
|
4011
|
+
`,
|
|
4012
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5" })
|
|
4013
|
+
}),
|
|
4014
|
+
/* @__PURE__ */ jsx("span", {
|
|
4015
|
+
className: `
|
|
4016
|
+
whitespace-nowrap overflow-hidden transition-all duration-300
|
|
4017
|
+
${expanded ? "ml-3 max-w-48 opacity-100" : "ml-0 max-w-0 opacity-0"}
|
|
4018
|
+
`,
|
|
4019
|
+
children: item.name
|
|
4020
|
+
}),
|
|
4021
|
+
item.status && /* @__PURE__ */ jsx("div", {
|
|
4022
|
+
className: `
|
|
4023
|
+
flex items-center justify-center
|
|
4024
|
+
${expanded ? "ml-auto" : "absolute right-1 top-1 scale-75"}
|
|
4025
|
+
`,
|
|
4026
|
+
children: item.status
|
|
4027
|
+
})
|
|
4028
|
+
]
|
|
4029
|
+
}), item.items && /* @__PURE__ */ jsxs("div", {
|
|
4030
|
+
className: `
|
|
4031
|
+
relative ml-6 flex flex-col gap-1 overflow-hidden
|
|
4032
|
+
border-l border-login-800 pl-2
|
|
4033
|
+
transition-all duration-300 ease-in-out
|
|
4034
|
+
${expanded && isActive ? "max-h-96 opacity-100" : "max-h-0 opacity-0"}
|
|
4035
|
+
`,
|
|
4036
|
+
children: [activeSubIndex >= 0 && /* @__PURE__ */ jsx("span", {
|
|
4037
|
+
"aria-hidden": true,
|
|
4038
|
+
className: "\n absolute left-2 right-0 top-0 h-9 rounded-lg\n bg-login-800/50 transition-transform duration-300 ease-in-out\n ",
|
|
4039
|
+
style: { transform: `translateY(${activeSubIndex * SUB_STRIDE}px)` }
|
|
4040
|
+
}), item.items.map((sub, subIndex) => {
|
|
4041
|
+
const isSubActive = pathname === sub.path || pathname.startsWith(sub.path + "/");
|
|
4042
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
4043
|
+
href: sub.path,
|
|
4044
|
+
className: `
|
|
4045
|
+
relative z-10 rounded-lg p-2 text-sm
|
|
4046
|
+
transition-all duration-200
|
|
4047
|
+
${isSubActive ? "text-login" : "text-login-300 hover:bg-login-800/30 hover:text-login-100"}
|
|
4048
|
+
`,
|
|
4049
|
+
children: sub.name
|
|
4050
|
+
}, `${index}-${subIndex}`);
|
|
4051
|
+
})]
|
|
4052
|
+
})]
|
|
4053
|
+
}, index);
|
|
4054
|
+
})]
|
|
4055
|
+
}),
|
|
4056
|
+
bottomAction && /* @__PURE__ */ jsx("div", {
|
|
4057
|
+
className: "border-t border-login-100/10 p-3",
|
|
4058
|
+
children: bottomAction(expanded)
|
|
4059
|
+
})
|
|
4060
|
+
]
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
//#endregion
|
|
4064
|
+
//#region src/components/badge/badge.tsx
|
|
4065
|
+
const variants = {
|
|
4066
|
+
default: "bg-login-600 text-login-100",
|
|
4067
|
+
success: "bg-emerald-500/15 text-emerald-400",
|
|
4068
|
+
warning: "bg-yellow-500/15 text-yellow-400",
|
|
4069
|
+
danger: "bg-red-500/15 text-red-400",
|
|
4070
|
+
info: "bg-sky-500/15 text-sky-400",
|
|
4071
|
+
amber: "bg-amber-500/15 text-amber-400",
|
|
4072
|
+
violet: "bg-violet-500/15 text-violet-400",
|
|
4073
|
+
blue: "bg-blue-500/15 text-blue-400",
|
|
4074
|
+
emerald: "bg-emerald-500/15 text-emerald-400",
|
|
4075
|
+
orange: "bg-login/15 text-login"
|
|
4076
|
+
};
|
|
4077
|
+
const sizes$1 = {
|
|
4078
|
+
sm: "px-2 py-0.5 text-xs",
|
|
4079
|
+
md: "px-2.5 py-1 text-sm"
|
|
4080
|
+
};
|
|
4081
|
+
function Badge({ text, variant = "default", size = "sm", className = "" }) {
|
|
4082
|
+
return /* @__PURE__ */ jsx("span", {
|
|
4083
|
+
className: `inline-flex items-center rounded-full font-medium ${variants[variant]} ${sizes$1[size]} ${className}`,
|
|
4084
|
+
children: text
|
|
4085
|
+
});
|
|
4086
|
+
}
|
|
4087
|
+
//#endregion
|
|
4088
|
+
//#region src/components/empty/emptyState.tsx
|
|
4089
|
+
function EmptyState({ icon: Icon, title, description, action, className = "" }) {
|
|
4090
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4091
|
+
className: `flex flex-col items-center justify-center gap-3 py-12 text-center ${className}`,
|
|
4092
|
+
children: [
|
|
4093
|
+
Icon && /* @__PURE__ */ jsx("div", {
|
|
4094
|
+
className: "mb-1 rounded-xl bg-login-600/30 p-3 text-login-400",
|
|
4095
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-7 w-7" })
|
|
4096
|
+
}),
|
|
4097
|
+
/* @__PURE__ */ jsx("p", {
|
|
4098
|
+
className: "text-sm font-semibold text-login-100",
|
|
4099
|
+
children: title
|
|
4100
|
+
}),
|
|
4101
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
4102
|
+
className: "max-w-xs text-xs leading-relaxed text-login-400",
|
|
4103
|
+
children: description
|
|
4104
|
+
}),
|
|
4105
|
+
action && /* @__PURE__ */ jsx("div", {
|
|
4106
|
+
className: "mt-2",
|
|
4107
|
+
children: action
|
|
4108
|
+
})
|
|
4109
|
+
]
|
|
4110
|
+
});
|
|
4111
|
+
}
|
|
4112
|
+
//#endregion
|
|
4113
|
+
//#region src/components/spinner/spinner.tsx
|
|
4114
|
+
const sizes = {
|
|
4115
|
+
sm: "w-4 h-4 border-2",
|
|
4116
|
+
md: "w-6 h-6 border-2",
|
|
4117
|
+
lg: "w-9 h-9 border-[3px]"
|
|
4118
|
+
};
|
|
4119
|
+
function Spinner({ size = "md", className = "" }) {
|
|
4120
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4121
|
+
role: "status",
|
|
4122
|
+
"aria-label": "Loading",
|
|
4123
|
+
className: `rounded-full border-login-500 border-t-login animate-spin ${sizes[size]} ${className}`
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
//#endregion
|
|
4127
|
+
//#region src/components/code/code.tsx
|
|
4128
|
+
function Code({ children, className = "" }) {
|
|
4129
|
+
return /* @__PURE__ */ jsx("code", {
|
|
4130
|
+
className: `font-mono text-xs bg-login-700 text-login px-1.5 py-0.5 rounded ${className}`,
|
|
4131
|
+
children
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
function CodeBlock({ code, language, className = "" }) {
|
|
4135
|
+
const [copied, setCopied] = useState(false);
|
|
4136
|
+
function copy() {
|
|
4137
|
+
navigator.clipboard.writeText(code);
|
|
4138
|
+
setCopied(true);
|
|
4139
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
4140
|
+
}
|
|
4141
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4142
|
+
className: `relative group rounded-xl border border-login-500/30 bg-login-900 overflow-hidden ${className}`,
|
|
4143
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4144
|
+
className: "flex items-center justify-between px-4 py-2 border-b border-login-500/20 bg-login-800",
|
|
4145
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4146
|
+
className: "text-xs font-mono text-login-400",
|
|
4147
|
+
children: language ?? ""
|
|
4148
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
4149
|
+
type: "button",
|
|
4150
|
+
onClick: copy,
|
|
4151
|
+
className: "flex cursor-pointer items-center gap-1.5 text-xs text-login-400 hover:text-login-100 transition-colors",
|
|
4152
|
+
children: [copied ? /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 stroke-emerald-400" }) : /* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5" }), copied ? "Copied" : "Copy"]
|
|
4153
|
+
})]
|
|
4154
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
4155
|
+
className: "overflow-x-auto p-4 text-xs font-mono leading-relaxed text-login-100",
|
|
4156
|
+
children: /* @__PURE__ */ jsx("code", { children: code })
|
|
4157
|
+
})]
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
//#endregion
|
|
4161
|
+
export { Accordion, AccordionGroup, Alert, Badge, Button, Card, Checkbox, Code, CodeBlock, ConfirmPopup, EmptyState, ExpandableCard, FileInput, Footer, GlassCard, Highlight, IconBubble, Input, LanguageToggle, LeftBarPanel, LoginPage, Logo, LogoSmall, MarkdownRender, MenuButton, Modal, MultiSelect, NavDropdown, NavItem, Navbar, PageContainer, Pagination, PulseDot, Radio, Range, SearchInput, Select, SeverityPill, Sidebar, Spinner, StatCard, Switch, TabPanel, Table, Tabs, TagInput, Textarea, ThemeToggle, Toaster, Toggle, VersionTag, loginAddress, loginCopyright, loginEmail, loginSocialLinks, loginSponsor, toast };
|