@okjt/dashboard 0.0.0-stage → 0.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/README.md +149 -2
- package/dist/AcceptInvitePage.js +86 -0
- package/dist/AccountMenu.js +73 -0
- package/dist/ActivityPanel.js +48 -0
- package/dist/AdminBulkActions.js +109 -0
- package/dist/AdminCard.js +7 -0
- package/dist/AdminChromeContext.js +16 -0
- package/dist/AdminFloatingToolbar.js +147 -0
- package/dist/AdminInput.js +66 -0
- package/dist/AdminListPanel.js +26 -0
- package/dist/AdminModal.js +23 -0
- package/dist/AdminPageHero.js +101 -0
- package/dist/AdminPageLayout.js +54 -0
- package/dist/AdminPagination.js +92 -0
- package/dist/AdminSidePanel.js +479 -0
- package/dist/AdminSummaryCards.js +51 -0
- package/dist/AdminToolbarFilters.js +168 -0
- package/dist/AdminToolbarSearch.js +61 -0
- package/dist/AdminTutorial.js +221 -0
- package/dist/AuthContext.js +194 -0
- package/dist/AuthLayout.js +94 -0
- package/dist/CollaborationContext.js +84 -0
- package/dist/CollaboratorAvatars.js +36 -0
- package/dist/DashboardHeader.js +140 -0
- package/dist/DashboardProvider.js +45 -0
- package/dist/DashboardShell.js +93 -0
- package/dist/DashboardSidebar.js +97 -0
- package/dist/DeleteButton.js +21 -0
- package/dist/EditableFieldset.js +9 -0
- package/dist/EmptyState.js +22 -0
- package/dist/GoogleButton.js +22 -0
- package/dist/GoogleCallbackPage.js +81 -0
- package/dist/NotificationsBell.js +149 -0
- package/dist/QueryError.js +23 -0
- package/dist/SearchContext.js +16 -0
- package/dist/ShareModal.js +228 -0
- package/dist/SignInPage.js +198 -0
- package/dist/StatCard.js +33 -0
- package/dist/ToggleButton.js +26 -0
- package/dist/TwoFactorForm.js +26 -0
- package/dist/UnsavedChangesStatus.js +13 -0
- package/dist/VerifyEmailPage.js +42 -0
- package/dist/VersionHistoryDrawer.js +172 -0
- package/dist/index.js +125 -0
- package/dist/modules.js +32 -0
- package/dist/passkeys.js +84 -0
- package/dist/useActivityPanel.js +34 -0
- package/dist/useAdminAction.js +77 -0
- package/dist/useCrudHandlers.js +54 -0
- package/dist/useFilteredItems.js +19 -0
- package/dist/useSavedViews.js +30 -0
- package/dist/useUnsavedChangesGuard.js +41 -0
- package/package.json +40 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
const baseInputClasses = "w-full px-4 py-2 rounded-lg border border-tone-200 focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent transition-colors";
|
|
4
|
+
function AdminInput({ label, error, className = "", id, ...props }) {
|
|
5
|
+
const generatedId = useId();
|
|
6
|
+
const inputId = id || generatedId;
|
|
7
|
+
const errorId = `${inputId}-error`;
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "block text-sm font-medium text-tone-600 mb-1", children: label }),
|
|
10
|
+
/* @__PURE__ */ jsx(
|
|
11
|
+
"input",
|
|
12
|
+
{
|
|
13
|
+
id: inputId,
|
|
14
|
+
"aria-invalid": error ? true : void 0,
|
|
15
|
+
"aria-describedby": error ? errorId : void 0,
|
|
16
|
+
className: `${baseInputClasses} ${error ? "border-red-400" : ""} ${className}`,
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
),
|
|
20
|
+
error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-red-500 text-xs mt-1", children: error })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function AdminTextarea({ label, error, className = "", id, ...props }) {
|
|
24
|
+
const generatedId = useId();
|
|
25
|
+
const inputId = id || generatedId;
|
|
26
|
+
const errorId = `${inputId}-error`;
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
28
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "block text-sm font-medium text-tone-600 mb-1", children: label }),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"textarea",
|
|
31
|
+
{
|
|
32
|
+
id: inputId,
|
|
33
|
+
"aria-invalid": error ? true : void 0,
|
|
34
|
+
"aria-describedby": error ? errorId : void 0,
|
|
35
|
+
className: `${baseInputClasses} resize-none ${error ? "border-red-400" : ""} ${className}`,
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-red-500 text-xs mt-1", children: error })
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
function AdminSelect({ label, error, children, className = "", id, ...props }) {
|
|
43
|
+
const generatedId = useId();
|
|
44
|
+
const inputId = id || generatedId;
|
|
45
|
+
const errorId = `${inputId}-error`;
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
47
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "block text-sm font-medium text-tone-600 mb-1", children: label }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"select",
|
|
50
|
+
{
|
|
51
|
+
id: inputId,
|
|
52
|
+
"aria-invalid": error ? true : void 0,
|
|
53
|
+
"aria-describedby": error ? errorId : void 0,
|
|
54
|
+
className: `${baseInputClasses} ${error ? "border-red-400" : ""} ${className}`,
|
|
55
|
+
...props,
|
|
56
|
+
children
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-red-500 text-xs mt-1", children: error })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
AdminInput,
|
|
64
|
+
AdminSelect,
|
|
65
|
+
AdminTextarea
|
|
66
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function AdminListPanel({
|
|
3
|
+
children,
|
|
4
|
+
header,
|
|
5
|
+
footer,
|
|
6
|
+
plain = false,
|
|
7
|
+
className = "",
|
|
8
|
+
bodyClassName = ""
|
|
9
|
+
}) {
|
|
10
|
+
const chrome = plain ? "" : "bg-white rounded-2xl shadow-sm border border-tone-100 overflow-hidden";
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col fit:flex-1 fit:min-h-0 ${chrome} ${className}`, children: [
|
|
12
|
+
header && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: header }),
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: `fit:flex-1 fit:min-h-0 fit:overflow-y-auto overflow-x-auto overscroll-contain ${plain ? "fit:p-1 fit:-m-1" : ""} ${bodyClassName}`,
|
|
17
|
+
"data-scroll-region": true,
|
|
18
|
+
children
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
footer && /* @__PURE__ */ jsx("div", { className: `shrink-0 ${plain ? "pt-3" : "border-t border-tone-100"}`, children: footer })
|
|
22
|
+
] });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
AdminListPanel as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Overlay } from "@okjt/ui";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
function AdminModal({ isOpen, onClose, title, children, size = "md" }) {
|
|
5
|
+
if (!isOpen) return null;
|
|
6
|
+
const sizeClasses = {
|
|
7
|
+
sm: "max-w-sm",
|
|
8
|
+
md: "max-w-md",
|
|
9
|
+
lg: "max-w-lg",
|
|
10
|
+
xl: "max-w-xl",
|
|
11
|
+
"2xl": "max-w-2xl"
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ jsx(Overlay, { onClose, closeOnBackdrop: false, children: /* @__PURE__ */ jsxs("div", { className: `bg-white rounded-2xl w-full ${sizeClasses[size]} p-6 shadow-xl animate-in zoom-in duration-200`, children: [
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-6", children: [
|
|
15
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-medium text-body", children: title }),
|
|
16
|
+
/* @__PURE__ */ jsx("button", { onClick: onClose, "aria-label": "Close dialog", className: "p-1 hover:bg-tone-100 rounded-lg transition-colors", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5 text-tone-400" }) })
|
|
17
|
+
] }),
|
|
18
|
+
children
|
|
19
|
+
] }) });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
AdminModal as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import { motion } from "framer-motion";
|
|
7
|
+
import { useAdminChrome } from "./AdminChromeContext.js";
|
|
8
|
+
import { useDashboard } from "./DashboardProvider.js";
|
|
9
|
+
const HEADER_OFFSET = 64;
|
|
10
|
+
function useVisibleBelowHeader(ref) {
|
|
11
|
+
const [visible, setVisible] = useState(true);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el || typeof IntersectionObserver === "undefined") return void 0;
|
|
15
|
+
const observer = new IntersectionObserver(
|
|
16
|
+
([entry]) => setVisible(entry.isIntersecting),
|
|
17
|
+
{ rootMargin: `-${HEADER_OFFSET}px 0px 0px 0px`, threshold: 0 }
|
|
18
|
+
);
|
|
19
|
+
observer.observe(el);
|
|
20
|
+
return () => observer.disconnect();
|
|
21
|
+
}, [ref]);
|
|
22
|
+
return visible;
|
|
23
|
+
}
|
|
24
|
+
function AdminPageHero({ title, description, breadcrumb, icon }) {
|
|
25
|
+
const { home } = useDashboard();
|
|
26
|
+
const crumbs = Array.isArray(breadcrumb) ? breadcrumb : [home, { label: breadcrumb || title }];
|
|
27
|
+
const heroRef = useRef(null);
|
|
28
|
+
const heroVisible = useVisibleBelowHeader(heroRef);
|
|
29
|
+
const { titleSlot } = useAdminChrome();
|
|
30
|
+
const parent = crumbs.length > 1 ? crumbs[crumbs.length - 2] : null;
|
|
31
|
+
const compactTitle = titleSlot && !heroVisible && createPortal(
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
motion.div,
|
|
34
|
+
{
|
|
35
|
+
initial: { opacity: 0, y: -6 },
|
|
36
|
+
animate: { opacity: 1, y: 0 },
|
|
37
|
+
transition: { duration: 0.15 },
|
|
38
|
+
className: "flex items-center gap-2 min-w-0",
|
|
39
|
+
children: [
|
|
40
|
+
icon && /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg flex items-center justify-center shrink-0", style: { background: "rgba(166, 123, 91, 0.1)" }, children: icon }),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
42
|
+
parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[11px] text-tone-400 truncate", children: parent.path ? /* @__PURE__ */ jsx(Link, { to: parent.path, className: "hover:text-accent", children: parent.label }) : parent.label }),
|
|
43
|
+
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold text-body truncate", children: title })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
onClick: () => window.scrollTo({ top: 0, behavior: "smooth" }),
|
|
50
|
+
className: "hidden md:inline text-xs text-tone-400 hover:text-accent whitespace-nowrap",
|
|
51
|
+
title: "Back to top",
|
|
52
|
+
children: "\u2191 Top"
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
titleSlot
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: "admin-page-hero pt-2", ref: heroRef, children: [
|
|
61
|
+
compactTitle,
|
|
62
|
+
crumbs && crumbs.length > 0 && /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1.5 text-sm mb-2", children: crumbs.map((crumb, idx) => {
|
|
63
|
+
const isLast = idx === crumbs.length - 1;
|
|
64
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
65
|
+
idx > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "w-3.5 h-3.5 text-tone-300" }),
|
|
66
|
+
crumb.path && !isLast ? /* @__PURE__ */ jsx(
|
|
67
|
+
Link,
|
|
68
|
+
{
|
|
69
|
+
to: crumb.path,
|
|
70
|
+
className: "text-tone-400 hover:text-accent transition-colors",
|
|
71
|
+
children: crumb.label
|
|
72
|
+
}
|
|
73
|
+
) : /* @__PURE__ */ jsx("span", { className: isLast ? "text-tone-700 font-medium" : "text-tone-400", children: crumb.label })
|
|
74
|
+
] }, idx);
|
|
75
|
+
}) }),
|
|
76
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
77
|
+
icon && /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "w-10 h-10 rounded-xl flex items-center justify-center",
|
|
81
|
+
style: { background: "rgba(166, 123, 91, 0.1)" },
|
|
82
|
+
children: icon
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"h1",
|
|
88
|
+
{
|
|
89
|
+
className: "text-2xl md:text-3xl font-semibold",
|
|
90
|
+
style: { color: "#4A3F35" },
|
|
91
|
+
children: title
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm mt-0.5", style: { color: "#8B7B6B" }, children: description })
|
|
95
|
+
] })
|
|
96
|
+
] }) })
|
|
97
|
+
] });
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
AdminPageHero as default
|
|
101
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { motion } from "framer-motion";
|
|
3
|
+
import AdminFloatingToolbar from "./AdminFloatingToolbar.js";
|
|
4
|
+
import { SidePanelAside, SidePanelMobileBar } from "./AdminSidePanel.js";
|
|
5
|
+
import { useDashboard } from "./DashboardProvider.js";
|
|
6
|
+
function AdminPageLayout({
|
|
7
|
+
hero,
|
|
8
|
+
summary,
|
|
9
|
+
children,
|
|
10
|
+
actions,
|
|
11
|
+
search,
|
|
12
|
+
filters,
|
|
13
|
+
toolbarContent,
|
|
14
|
+
toolbarHidden = false,
|
|
15
|
+
fill = false,
|
|
16
|
+
panel: pagePanel
|
|
17
|
+
}) {
|
|
18
|
+
const defaultPanel = useDashboard().useDefaultPanel();
|
|
19
|
+
const panel = pagePanel || defaultPanel;
|
|
20
|
+
const showToolbar = !toolbarHidden && (actions && actions.length > 0 || search || filters || toolbarContent);
|
|
21
|
+
const fillBody = "space-y-6 fit:space-y-0 fit:flex fit:flex-col fit:gap-4 fit:flex-1 fit:min-h-0";
|
|
22
|
+
const fitPage = fill || !!pagePanel;
|
|
23
|
+
const bodyClass = fill ? fillBody : pagePanel ? "space-y-6 fit:overflow-y-auto fit:overscroll-contain fit:min-h-0 fit:pr-1 fit:pb-2" : "space-y-6";
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsxs(
|
|
26
|
+
motion.div,
|
|
27
|
+
{
|
|
28
|
+
initial: { opacity: 0, y: 12 },
|
|
29
|
+
animate: { opacity: 1, y: 0 },
|
|
30
|
+
transition: { duration: 0.25 },
|
|
31
|
+
className: `admin-page-layout space-y-5 pb-28 lg:pb-24 ${fitPage ? "fit:h-[calc(100dvh-7rem)] fit:flex fit:flex-col fit:overflow-hidden fit:space-y-0 fit:gap-5" : ""}`,
|
|
32
|
+
"data-layout": fitPage ? "fill" : "flow",
|
|
33
|
+
children: [
|
|
34
|
+
fitPage ? /* @__PURE__ */ jsxs("div", { className: "fit:shrink-0 space-y-5", children: [
|
|
35
|
+
hero,
|
|
36
|
+
summary
|
|
37
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
hero,
|
|
39
|
+
summary
|
|
40
|
+
] }),
|
|
41
|
+
panel && panel.mobile !== false && /* @__PURE__ */ jsx(SidePanelMobileBar, { panel }),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: `lg:flex lg:gap-5 ${fitPage ? "fit:flex-1 fit:min-h-0" : ""}`, children: [
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: `@container lg:flex-1 min-w-0 ${bodyClass}`, children }),
|
|
44
|
+
panel && /* @__PURE__ */ jsx(SidePanelAside, { panel }, panel.id || panel.title)
|
|
45
|
+
] })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
showToolbar && /* @__PURE__ */ jsx(AdminFloatingToolbar, { actions, search, filters, children: toolbarContent })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
AdminPageLayout as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
3
|
+
import { Button } from "@okjt/ui";
|
|
4
|
+
function pageWindow(current, total, radius = 1) {
|
|
5
|
+
const pages = /* @__PURE__ */ new Set([1, total]);
|
|
6
|
+
for (let p = current - radius; p <= current + radius; p++) {
|
|
7
|
+
if (p >= 1 && p <= total) pages.add(p);
|
|
8
|
+
}
|
|
9
|
+
const sorted = [...pages].sort((a, b) => a - b);
|
|
10
|
+
const out = [];
|
|
11
|
+
sorted.forEach((p, i) => {
|
|
12
|
+
if (i > 0 && p - sorted[i - 1] > 1) out.push(`gap-${p}`);
|
|
13
|
+
out.push(p);
|
|
14
|
+
});
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
function AdminPagination({
|
|
18
|
+
currentPage,
|
|
19
|
+
pageSize,
|
|
20
|
+
totalItems,
|
|
21
|
+
onPageChange,
|
|
22
|
+
pageSizeOptions,
|
|
23
|
+
onPageSizeChange
|
|
24
|
+
}) {
|
|
25
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
26
|
+
if (totalItems === 0) return null;
|
|
27
|
+
const from = (currentPage - 1) * pageSize + 1;
|
|
28
|
+
const to = Math.min(currentPage * pageSize, totalItems);
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 bg-white px-4 py-2.5", children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-sm text-tone-600", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: from }),
|
|
33
|
+
"\u2013",
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: to }),
|
|
35
|
+
" of",
|
|
36
|
+
" ",
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: totalItems })
|
|
38
|
+
] }),
|
|
39
|
+
pageSizeOptions && onPageSizeChange && /* @__PURE__ */ jsxs("label", { className: "hidden sm:flex items-center gap-2 text-tone-400", children: [
|
|
40
|
+
"Rows",
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"select",
|
|
43
|
+
{
|
|
44
|
+
value: pageSize,
|
|
45
|
+
onChange: (e) => onPageSizeChange(Number(e.target.value)),
|
|
46
|
+
className: "px-2 py-1 rounded-lg border border-tone-200 bg-tone-50 text-tone-700 text-sm focus:outline-none focus:ring-2 focus:ring-accent/20",
|
|
47
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx("option", { value: size, children: size }, size))
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] })
|
|
51
|
+
] }),
|
|
52
|
+
totalPages > 1 && /* @__PURE__ */ jsxs("nav", { className: "flex items-center gap-1", "aria-label": "Pagination", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
Button,
|
|
55
|
+
{
|
|
56
|
+
size: "icon-sm",
|
|
57
|
+
icon: ChevronLeft,
|
|
58
|
+
onClick: () => onPageChange(Math.max(1, currentPage - 1)),
|
|
59
|
+
disabled: currentPage === 1,
|
|
60
|
+
"aria-label": "Previous page"
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
pageWindow(currentPage, totalPages).map((p) => typeof p === "string" ? /* @__PURE__ */ jsx("span", { className: "px-1 text-tone-300", children: "\u2026" }, p) : /* @__PURE__ */ jsx(
|
|
64
|
+
Button,
|
|
65
|
+
{
|
|
66
|
+
size: "sm",
|
|
67
|
+
variant: p === currentPage ? "secondary" : "primary",
|
|
68
|
+
onClick: () => onPageChange(p),
|
|
69
|
+
"aria-current": p === currentPage ? "page" : void 0,
|
|
70
|
+
"aria-label": `Page ${p}`,
|
|
71
|
+
className: "min-w-8",
|
|
72
|
+
children: p
|
|
73
|
+
},
|
|
74
|
+
p
|
|
75
|
+
)),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
Button,
|
|
78
|
+
{
|
|
79
|
+
size: "icon-sm",
|
|
80
|
+
icon: ChevronRight,
|
|
81
|
+
onClick: () => onPageChange(Math.min(totalPages, currentPage + 1)),
|
|
82
|
+
disabled: currentPage === totalPages,
|
|
83
|
+
"aria-label": "Next page"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
AdminPagination as default,
|
|
91
|
+
pageWindow
|
|
92
|
+
};
|