@okjt/dashboard 0.0.0-stage → 0.1.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.
Files changed (46) hide show
  1. package/README.md +144 -2
  2. package/dist/ActivityPanel.js +48 -0
  3. package/dist/AdminBulkActions.js +109 -0
  4. package/dist/AdminCard.js +7 -0
  5. package/dist/AdminChromeContext.js +16 -0
  6. package/dist/AdminFloatingToolbar.js +147 -0
  7. package/dist/AdminInput.js +66 -0
  8. package/dist/AdminListPanel.js +26 -0
  9. package/dist/AdminModal.js +23 -0
  10. package/dist/AdminPageHero.js +101 -0
  11. package/dist/AdminPageLayout.js +54 -0
  12. package/dist/AdminPagination.js +92 -0
  13. package/dist/AdminSidePanel.js +479 -0
  14. package/dist/AdminSummaryCards.js +51 -0
  15. package/dist/AdminToolbarFilters.js +168 -0
  16. package/dist/AdminToolbarSearch.js +61 -0
  17. package/dist/AdminTutorial.js +221 -0
  18. package/dist/AuthContext.js +189 -0
  19. package/dist/CollaborationContext.js +84 -0
  20. package/dist/CollaboratorAvatars.js +36 -0
  21. package/dist/DashboardHeader.js +140 -0
  22. package/dist/DashboardProvider.js +45 -0
  23. package/dist/DashboardShell.js +93 -0
  24. package/dist/DashboardSidebar.js +97 -0
  25. package/dist/DeleteButton.js +21 -0
  26. package/dist/EditableFieldset.js +9 -0
  27. package/dist/EmptyState.js +22 -0
  28. package/dist/GoogleButton.js +22 -0
  29. package/dist/NotificationsBell.js +149 -0
  30. package/dist/QueryError.js +23 -0
  31. package/dist/SearchContext.js +16 -0
  32. package/dist/ShareModal.js +228 -0
  33. package/dist/StatCard.js +33 -0
  34. package/dist/ToggleButton.js +26 -0
  35. package/dist/UnsavedChangesStatus.js +13 -0
  36. package/dist/VersionHistoryDrawer.js +172 -0
  37. package/dist/index.js +110 -0
  38. package/dist/modules.js +32 -0
  39. package/dist/passkeys.js +84 -0
  40. package/dist/useActivityPanel.js +34 -0
  41. package/dist/useAdminAction.js +77 -0
  42. package/dist/useCrudHandlers.js +54 -0
  43. package/dist/useFilteredItems.js +19 -0
  44. package/dist/useSavedViews.js +30 -0
  45. package/dist/useUnsavedChangesGuard.js +41 -0
  46. package/package.json +39 -4
@@ -0,0 +1,84 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
+ import { useLocation } from "react-router-dom";
4
+ import { useDashboard } from "./DashboardProvider.js";
5
+ import { useModules } from "./modules.js";
6
+ const HEARTBEAT_MS = 2e4;
7
+ const CollaborationContext = createContext({
8
+ presence: [],
9
+ badges: {},
10
+ module: null,
11
+ othersHere: [],
12
+ historyOpen: false,
13
+ openHistory: () => {
14
+ },
15
+ closeHistory: () => {
16
+ },
17
+ shareOpen: false,
18
+ setShareOpen: () => {
19
+ },
20
+ dataVersion: 0,
21
+ notifyDataRestored: () => {
22
+ },
23
+ refresh: () => {
24
+ }
25
+ });
26
+ function CollaborationProvider({ children }) {
27
+ const { pathname } = useLocation();
28
+ const { api } = useDashboard();
29
+ const { moduleForPath } = useModules();
30
+ const module = moduleForPath(pathname)?.key || null;
31
+ const [state, setState] = useState({ presence: [], badges: {} });
32
+ const [historyOpen, setHistoryOpen] = useState(false);
33
+ const [shareOpen, setShareOpen] = useState(false);
34
+ const [dataVersion, setDataVersion] = useState(0);
35
+ const latest = useRef({ module, pathname });
36
+ latest.current = { module, pathname };
37
+ const beat = useCallback(async () => {
38
+ if (document.visibilityState === "hidden") return;
39
+ try {
40
+ const res = await api.post("/collaboration/heartbeat", { module: latest.current.module, path: latest.current.pathname });
41
+ setState({ presence: res.data?.presence || [], badges: res.data?.badges || {} });
42
+ } catch {
43
+ }
44
+ }, [api]);
45
+ useEffect(() => {
46
+ beat();
47
+ }, [module, pathname, beat]);
48
+ useEffect(() => {
49
+ const timer = setInterval(beat, HEARTBEAT_MS);
50
+ const onVisible = () => {
51
+ if (document.visibilityState === "visible") beat();
52
+ };
53
+ document.addEventListener("visibilitychange", onVisible);
54
+ return () => {
55
+ clearInterval(timer);
56
+ document.removeEventListener("visibilitychange", onVisible);
57
+ };
58
+ }, [beat]);
59
+ const value = useMemo(() => ({
60
+ ...state,
61
+ module,
62
+ othersHere: state.presence.filter((p) => module && p.current_module === module),
63
+ historyOpen,
64
+ openHistory: () => setHistoryOpen(true),
65
+ closeHistory: () => setHistoryOpen(false),
66
+ shareOpen,
67
+ setShareOpen,
68
+ dataVersion,
69
+ notifyDataRestored: () => {
70
+ setDataVersion((v) => v + 1);
71
+ beat();
72
+ },
73
+ refresh: beat
74
+ }), [state, module, historyOpen, shareOpen, dataVersion, beat]);
75
+ return /* @__PURE__ */ jsx(CollaborationContext.Provider, { value, children });
76
+ }
77
+ function useCollaboration() {
78
+ return useContext(CollaborationContext);
79
+ }
80
+ export {
81
+ CollaborationProvider,
82
+ HEARTBEAT_MS,
83
+ useCollaboration
84
+ };
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { collaboratorColor, initials, useModules } from "./modules.js";
3
+ const SIZES = {
4
+ xs: "w-5 h-5 text-[9px]",
5
+ sm: "w-7 h-7 text-[11px]",
6
+ md: "w-9 h-9 text-xs"
7
+ };
8
+ function CollaboratorAvatar({ person, size = "sm", className = "" }) {
9
+ const { moduleByKey } = useModules();
10
+ const where = moduleByKey(person.current_module)?.label;
11
+ return /* @__PURE__ */ jsx(
12
+ "span",
13
+ {
14
+ className: `${SIZES[size]} rounded-full ring-2 ring-paper text-white font-semibold flex items-center justify-center shrink-0 ${className}`,
15
+ style: { background: collaboratorColor(person.id) },
16
+ title: where ? `${person.name} \u2014 on ${where}` : person.name,
17
+ children: initials(person.name)
18
+ }
19
+ );
20
+ }
21
+ function CollaboratorAvatars({ people = [], max = 3, size = "sm" }) {
22
+ if (!people.length) return null;
23
+ const shown = people.slice(0, max);
24
+ const extra = people.length - shown.length;
25
+ return /* @__PURE__ */ jsxs("span", { className: "flex items-center -space-x-1.5", children: [
26
+ shown.map((person) => /* @__PURE__ */ jsx(CollaboratorAvatar, { person, size }, person.id)),
27
+ extra > 0 && /* @__PURE__ */ jsxs("span", { className: `${SIZES[size]} rounded-full ring-2 ring-paper bg-tone-200 text-tone-700 font-semibold flex items-center justify-center`, children: [
28
+ "+",
29
+ extra
30
+ ] })
31
+ ] });
32
+ }
33
+ export {
34
+ CollaboratorAvatar,
35
+ CollaboratorAvatars as default
36
+ };
@@ -0,0 +1,140 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Link, useLocation } from "react-router-dom";
3
+ import { Menu, Info, History, Share2 } from "lucide-react";
4
+ import { usePermissions } from "@okjt/ui";
5
+ import { useCollaboration } from "./CollaborationContext.js";
6
+ import CollaboratorAvatars from "./CollaboratorAvatars.js";
7
+ import { useDashboard } from "./DashboardProvider.js";
8
+ function DashboardHeader({ onMenuClick, onRestartTutorial, titleSlotRef, statusSlotRef }) {
9
+ const { pathname } = useLocation();
10
+ const { presence, othersHere, openHistory, setShareOpen, badges } = useCollaboration();
11
+ const hasNews = Object.values(badges).some(Boolean);
12
+ const { canEdit } = usePermissions();
13
+ const { shell } = useDashboard();
14
+ const quickLinks = shell.quickLinks;
15
+ return /* @__PURE__ */ jsxs(
16
+ "header",
17
+ {
18
+ id: "header",
19
+ className: "sticky top-0 z-30 h-16 px-3 sm:px-6 flex items-center justify-between gap-3",
20
+ style: {
21
+ background: shell.headerBackground,
22
+ backdropFilter: "blur(10px)",
23
+ borderBottom: shell.headerBorder
24
+ },
25
+ children: [
26
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:gap-4 min-w-0 flex-1", children: [
27
+ /* @__PURE__ */ jsxs(
28
+ "button",
29
+ {
30
+ onClick: onMenuClick,
31
+ "aria-label": hasNews ? "Open sidebar menu (new changes)" : "Open sidebar menu",
32
+ className: "lg:hidden relative p-2 rounded-lg hover:bg-black/5 shrink-0",
33
+ children: [
34
+ /* @__PURE__ */ jsx(Menu, { className: "w-6 h-6 text-body" }),
35
+ hasNews && /* @__PURE__ */ jsx("span", { className: "absolute top-1.5 right-1.5 w-2 h-2 rounded-full bg-accent ring-2 ring-paper", "aria-hidden": "true" })
36
+ ]
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx("div", { ref: titleSlotRef, className: "min-w-0 flex-1" }),
40
+ othersHere.length > 0 && /* @__PURE__ */ jsxs(
41
+ "button",
42
+ {
43
+ type: "button",
44
+ onClick: () => setShareOpen(true),
45
+ className: "hidden sm:flex items-center gap-2 shrink-0 pl-1 pr-3 py-1 rounded-full bg-amber-50 border border-amber-200 text-xs text-amber-800",
46
+ title: "Others editing here may overwrite each other's unsaved changes",
47
+ children: [
48
+ /* @__PURE__ */ jsx(CollaboratorAvatars, { people: othersHere, size: "xs", max: 2 }),
49
+ /* @__PURE__ */ jsx("span", { className: "max-w-[14rem] truncate", children: othersHere.length === 1 ? `${othersHere[0].name} is here too` : `${othersHere.length} others are here too` })
50
+ ]
51
+ }
52
+ )
53
+ ] }),
54
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:gap-2 shrink-0", children: [
55
+ !canEdit && /* @__PURE__ */ jsx(
56
+ "span",
57
+ {
58
+ className: "px-2.5 py-1 rounded-full bg-tone-100 border border-tone-200 text-xs font-medium text-tone-600 whitespace-nowrap",
59
+ title: "You can look around, but changes won't be saved. Ask an owner for edit access.",
60
+ children: "View only"
61
+ }
62
+ ),
63
+ /* @__PURE__ */ jsx("div", { ref: statusSlotRef, className: "flex items-center empty:hidden mr-1" }),
64
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Quick links", className: "hidden md:flex items-center gap-1 pr-2 mr-1 border-r border-tone-200/70", children: quickLinks.map((link) => {
65
+ const active = pathname.startsWith(link.path);
66
+ return /* @__PURE__ */ jsxs(
67
+ Link,
68
+ {
69
+ id: link.id,
70
+ to: link.path,
71
+ title: link.label,
72
+ "aria-label": link.label,
73
+ "aria-current": active ? "page" : void 0,
74
+ className: `flex items-center gap-2 p-2 2xl:px-3 rounded-xl text-sm font-medium transition-colors ${active ? "bg-accent text-white" : "text-soft hover:bg-accent/10 hover:text-accent"}`,
75
+ children: [
76
+ /* @__PURE__ */ jsx(link.icon, { className: "w-5 h-5" }),
77
+ /* @__PURE__ */ jsx("span", { className: "hidden 2xl:inline", children: link.label })
78
+ ]
79
+ },
80
+ link.path
81
+ );
82
+ }) }),
83
+ presence.length > 0 && /* @__PURE__ */ jsx(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ onClick: () => setShareOpen(true),
88
+ className: "hidden md:flex p-1 rounded-full hover:bg-black/5",
89
+ "aria-label": `${presence.length} collaborator${presence.length === 1 ? "" : "s"} online`,
90
+ children: /* @__PURE__ */ jsx(CollaboratorAvatars, { people: presence, max: 3 })
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsxs(
94
+ "button",
95
+ {
96
+ id: "header-share",
97
+ type: "button",
98
+ onClick: () => setShareOpen(true),
99
+ "aria-label": "Share dashboard",
100
+ title: "Share \u2014 invite collaborators",
101
+ className: "flex items-center gap-2 p-2 xl:px-3 rounded-xl text-sm font-medium text-soft hover:bg-accent/10 hover:text-accent transition-colors",
102
+ children: [
103
+ /* @__PURE__ */ jsx(Share2, { className: "w-5 h-5" }),
104
+ /* @__PURE__ */ jsx("span", { className: "hidden xl:inline", children: "Share" })
105
+ ]
106
+ }
107
+ ),
108
+ /* @__PURE__ */ jsx(
109
+ "button",
110
+ {
111
+ id: "header-history",
112
+ type: "button",
113
+ onClick: openHistory,
114
+ "aria-label": "Version history",
115
+ title: "Version history",
116
+ className: "p-2 rounded-xl text-soft hover:bg-accent/10 hover:text-accent transition-colors",
117
+ children: /* @__PURE__ */ jsx(History, { className: "w-5 h-5" })
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsx(
121
+ "button",
122
+ {
123
+ "aria-label": "Restart Dashboard Tour",
124
+ id: "header-restart",
125
+ onClick: onRestartTutorial,
126
+ className: "hidden sm:block p-2 rounded-xl text-muted hover:bg-black/5 transition-colors",
127
+ title: "Restart Dashboard Tour",
128
+ children: /* @__PURE__ */ jsx(Info, { className: "w-5 h-5" })
129
+ }
130
+ ),
131
+ shell.Notifications && /* @__PURE__ */ jsx(shell.Notifications, {}),
132
+ shell.AccountMenu && /* @__PURE__ */ jsx(shell.AccountMenu, { compactLinks: quickLinks })
133
+ ] })
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ export {
139
+ DashboardHeader as default
140
+ };
@@ -0,0 +1,45 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ const DashboardContext = createContext(null);
4
+ const DEFAULT_ROLES = [
5
+ { value: "owner", label: "Owner", description: "Everything, including people and roles" },
6
+ { value: "editor", label: "Editor", description: "Changes what is in the dashboard" },
7
+ { value: "viewer", label: "Viewer", description: "Can look around but not change anything" }
8
+ ];
9
+ const DEFAULTS = {
10
+ home: { label: "Dashboard", path: "/" },
11
+ useDefaultPanel: () => null,
12
+ useAfterChange: () => void 0,
13
+ api: null,
14
+ modules: [],
15
+ roles: DEFAULT_ROLES,
16
+ roleLabel: (role) => DEFAULT_ROLES.find((r) => r.value === role)?.label || role,
17
+ anonymousName: "Someone",
18
+ removeCollaborator: null,
19
+ tutorialSteps: []
20
+ };
21
+ const DEFAULT_SHELL = {
22
+ logo: { src: "", alt: "", to: "/" },
23
+ nav: [],
24
+ quickLinks: [],
25
+ background: "linear-gradient(180deg, var(--color-paper) 0%, var(--color-tint) 100%)",
26
+ sidebarBackground: "linear-gradient(180deg, var(--color-body) 0%, var(--color-ink) 100%)",
27
+ sidebarScrollbar: "var(--color-soft) var(--color-body)",
28
+ headerBackground: "color-mix(in srgb, var(--color-paper) 95%, transparent)",
29
+ headerBorder: "1px solid color-mix(in srgb, var(--color-accent) 10%, transparent)",
30
+ badgeClass: "bg-accent-soft text-body",
31
+ Banner: null,
32
+ Notifications: null,
33
+ AccountMenu: null
34
+ };
35
+ function DashboardProvider({ dashboard, children }) {
36
+ return /* @__PURE__ */ jsx(DashboardContext.Provider, { value: dashboard, children });
37
+ }
38
+ function useDashboard() {
39
+ const settings = useContext(DashboardContext);
40
+ return { ...DEFAULTS, ...settings, shell: { ...DEFAULT_SHELL, ...settings?.shell, logo: { ...DEFAULT_SHELL.logo, ...settings?.shell?.logo } } };
41
+ }
42
+ export {
43
+ DashboardProvider,
44
+ useDashboard
45
+ };
@@ -0,0 +1,93 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { useLocation } from "react-router-dom";
4
+ import { AnimatePresence, motion, MotionConfig } from "framer-motion";
5
+ import { ConfirmHost } from "@okjt/ui";
6
+ import { SearchProvider, useSearch } from "./SearchContext.js";
7
+ import { AdminChromeProvider } from "./AdminChromeContext.js";
8
+ import AdminTutorial from "./AdminTutorial.js";
9
+ import { CollaborationProvider, useCollaboration } from "./CollaborationContext.js";
10
+ import ShareModal from "./ShareModal.js";
11
+ import VersionHistoryDrawer from "./VersionHistoryDrawer.js";
12
+ import DashboardSidebar from "./DashboardSidebar.js";
13
+ import DashboardHeader from "./DashboardHeader.js";
14
+ import { useDashboard } from "./DashboardProvider.js";
15
+ function ResetSearchOnNavigate({ pathname }) {
16
+ const { setSearchQuery } = useSearch();
17
+ useEffect(() => {
18
+ setSearchQuery("");
19
+ }, [pathname, setSearchQuery]);
20
+ return null;
21
+ }
22
+ function CollaborationPanels() {
23
+ const { shareOpen, setShareOpen, historyOpen, closeHistory, module, notifyDataRestored } = useCollaboration();
24
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsx(ShareModal, { isOpen: shareOpen, onClose: () => setShareOpen(false) }),
26
+ /* @__PURE__ */ jsx(AnimatePresence, { children: historyOpen && /* @__PURE__ */ jsx(VersionHistoryDrawer, { module, onClose: closeHistory, onRestored: notifyDataRestored }) })
27
+ ] });
28
+ }
29
+ function PageContent({ pathname, children }) {
30
+ const { dataVersion } = useCollaboration();
31
+ return /* @__PURE__ */ jsx(
32
+ motion.div,
33
+ {
34
+ initial: { opacity: 0, y: 20 },
35
+ animate: { opacity: 1, y: 0 },
36
+ transition: { duration: 0.3 },
37
+ children
38
+ },
39
+ `${pathname}#${dataVersion}`
40
+ );
41
+ }
42
+ function DashboardShell({ children }) {
43
+ const { shell, tutorialSteps } = useDashboard();
44
+ const [sidebarOpen, setSidebarOpen] = useState(false);
45
+ const [restartTutorial, setRestartTutorial] = useState(false);
46
+ const location = useLocation();
47
+ const [titleSlot, setTitleSlot] = useState(null);
48
+ const [statusSlot, setStatusSlot] = useState(null);
49
+ useEffect(() => {
50
+ document.documentElement.classList.add("admin-theme");
51
+ return () => document.documentElement.classList.remove("admin-theme");
52
+ }, []);
53
+ return /* @__PURE__ */ jsx(MotionConfig, { reducedMotion: "user", children: /* @__PURE__ */ jsx(SearchProvider, { children: /* @__PURE__ */ jsx(AdminChromeProvider, { value: { titleSlot, statusSlot }, children: /* @__PURE__ */ jsxs(CollaborationProvider, { children: [
54
+ /* @__PURE__ */ jsx(ResetSearchOnNavigate, { pathname: location.pathname }),
55
+ /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ className: "min-h-screen",
59
+ style: { background: shell.background },
60
+ children: [
61
+ /* @__PURE__ */ jsx(DashboardSidebar, { isOpen: sidebarOpen, onClose: () => setSidebarOpen(false) }),
62
+ /* @__PURE__ */ jsxs("div", { className: "lg:ml-[280px]", children: [
63
+ /* @__PURE__ */ jsx(
64
+ DashboardHeader,
65
+ {
66
+ onMenuClick: () => setSidebarOpen(true),
67
+ onRestartTutorial: () => setRestartTutorial((prev) => !prev),
68
+ titleSlotRef: setTitleSlot,
69
+ statusSlotRef: setStatusSlot
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx(ConfirmHost, {}),
73
+ /* @__PURE__ */ jsx(CollaborationPanels, {}),
74
+ shell.Banner && /* @__PURE__ */ jsx(shell.Banner, {}),
75
+ /* @__PURE__ */ jsx(
76
+ AdminTutorial,
77
+ {
78
+ isRestarted: restartTutorial,
79
+ onComplete: () => setRestartTutorial(false),
80
+ steps: tutorialSteps
81
+ },
82
+ restartTutorial ? "restarted" : "initial"
83
+ ),
84
+ /* @__PURE__ */ jsx("main", { className: "p-4 sm:p-6", children: /* @__PURE__ */ jsx(PageContent, { pathname: location.pathname, children }) })
85
+ ] })
86
+ ]
87
+ }
88
+ )
89
+ ] }) }) }) });
90
+ }
91
+ export {
92
+ DashboardShell as default
93
+ };
@@ -0,0 +1,97 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Link, useLocation } from "react-router-dom";
3
+ import { motion, AnimatePresence } from "framer-motion";
4
+ import { X } from "lucide-react";
5
+ import { useCollaboration } from "./CollaborationContext.js";
6
+ import CollaboratorAvatars from "./CollaboratorAvatars.js";
7
+ import { useDashboard } from "./DashboardProvider.js";
8
+ import { useModules } from "./modules.js";
9
+ function DashboardSidebar({ isOpen, onClose }) {
10
+ const location = useLocation();
11
+ const { home, shell } = useDashboard();
12
+ const { moduleForPath } = useModules();
13
+ const { badges, presence } = useCollaboration();
14
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(
16
+ motion.div,
17
+ {
18
+ initial: { opacity: 0 },
19
+ animate: { opacity: 1 },
20
+ exit: { opacity: 0 },
21
+ className: "fixed inset-0 bg-black/50 z-40 lg:hidden",
22
+ onClick: onClose
23
+ }
24
+ ) }),
25
+ /* @__PURE__ */ jsx(
26
+ motion.aside,
27
+ {
28
+ className: `admin-sidebar fixed left-0 top-0 h-full z-50 lg:translate-x-0 ${isOpen ? "translate-x-0" : "-translate-x-full"} transition-transform lg:transition-none`,
29
+ style: {
30
+ width: 280,
31
+ background: shell.sidebarBackground
32
+ },
33
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
34
+ /* @__PURE__ */ jsxs("div", { className: "p-4 flex items-center justify-center relative", children: [
35
+ /* @__PURE__ */ jsx(Link, { to: shell.logo.to, className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
36
+ "img",
37
+ {
38
+ src: shell.logo.src,
39
+ alt: shell.logo.alt,
40
+ className: "h-10 w-auto"
41
+ }
42
+ ) }),
43
+ /* @__PURE__ */ jsx(
44
+ "button",
45
+ {
46
+ "aria-label": "Close menu",
47
+ onClick: onClose,
48
+ className: "lg:hidden absolute right-4 top-1/2 -translate-y-1/2 text-white/60 hover:text-white",
49
+ children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
50
+ }
51
+ )
52
+ ] }),
53
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex-1 py-2 px-3 overflow-y-auto", style: { scrollbarWidth: "thin", scrollbarColor: shell.sidebarScrollbar }, children: shell.nav.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", { className: sectionIndex > 0 ? "mt-4" : "", children: [
54
+ section.title && /* @__PURE__ */ jsx("p", { className: "px-3 mb-1 text-[10px] font-bold uppercase tracking-[0.18em] text-white/50", children: section.title }),
55
+ /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: section.items.map((item) => {
56
+ const isActive = location.pathname === item.path || item.path !== home.path && location.pathname.startsWith(item.path);
57
+ const moduleKey = moduleForPath(item.path)?.key;
58
+ const newCount = isActive ? 0 : badges[moduleKey] || 0;
59
+ const here = presence.filter((p) => p.current_module === moduleKey);
60
+ const label = [item.label, newCount && `${newCount} new`, here.length && `${here.map((p) => p.name).join(", ")} here`].filter(Boolean).join(", ");
61
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
62
+ Link,
63
+ {
64
+ id: item.id,
65
+ to: item.path,
66
+ onClick: () => onClose(),
67
+ "aria-current": isActive ? "page" : void 0,
68
+ "aria-label": label !== item.label ? label : void 0,
69
+ className: `flex items-center gap-3 px-3 py-2 rounded-lg transition-all text-sm focus-visible:outline-2 focus-visible:outline-white ${isActive ? "text-accent-dark bg-white shadow-sm" : "text-white/75 hover:text-accent-dark hover:bg-white"}`,
70
+ children: [
71
+ /* @__PURE__ */ jsx(item.icon, { className: "w-4 h-4 flex-shrink-0", "aria-hidden": "true" }),
72
+ /* @__PURE__ */ jsx("span", { className: "font-medium truncate", children: item.label }),
73
+ (here.length > 0 || newCount > 0) && /* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1.5 shrink-0", "aria-hidden": "true", children: [
74
+ /* @__PURE__ */ jsx(CollaboratorAvatars, { people: here, size: "xs", max: 2 }),
75
+ newCount > 0 && /* @__PURE__ */ jsx("span", { className: `min-w-[1.25rem] h-5 px-1.5 rounded-full ${shell.badgeClass} text-[10px] font-bold flex items-center justify-center`, children: newCount > 99 ? "99+" : newCount })
76
+ ] }),
77
+ isActive && /* @__PURE__ */ jsx(
78
+ motion.div,
79
+ {
80
+ layoutId: "sidebar-indicator",
81
+ className: `${here.length ? "" : "ml-auto"} w-1.5 h-1.5 rounded-full flex-shrink-0`,
82
+ style: { background: "var(--color-accent)" }
83
+ }
84
+ )
85
+ ]
86
+ }
87
+ ) }, item.path);
88
+ }) })
89
+ ] }, section.title || sectionIndex)) })
90
+ ] })
91
+ }
92
+ )
93
+ ] });
94
+ }
95
+ export {
96
+ DashboardSidebar as default
97
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Trash2 } from "lucide-react";
3
+ import { Button } from "@okjt/ui";
4
+ function DeleteButton({ onClick, processing, title = "Delete" }) {
5
+ return /* @__PURE__ */ jsx(
6
+ Button,
7
+ {
8
+ variant: "danger",
9
+ size: "icon",
10
+ icon: Trash2,
11
+ loading: processing,
12
+ onClick,
13
+ edit: true,
14
+ title,
15
+ "aria-label": title
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ DeleteButton as default
21
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { usePermissions } from "@okjt/ui";
3
+ function EditableFieldset({ children, className = "contents", allow = false }) {
4
+ const { canEdit } = usePermissions();
5
+ return /* @__PURE__ */ jsx("fieldset", { disabled: !canEdit && !allow, className: `min-w-0 border-0 p-0 m-0 ${className}`, children });
6
+ }
7
+ export {
8
+ EditableFieldset as default
9
+ };
@@ -0,0 +1,22 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Skeleton } from "@okjt/ui";
3
+ function EmptyState({ icon: Icon, message, searchQuery, loading, rows = 5, action }) {
4
+ if (loading) {
5
+ return /* @__PURE__ */ jsx("div", { className: "p-6 space-y-4", role: "status", "aria-label": "Loading", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
6
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circle", width: "36px", height: "36px" }),
7
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
8
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: `${60 - i % 3 * 12}%` }),
9
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "35%", height: "10px" })
10
+ ] })
11
+ ] }, i)) });
12
+ }
13
+ return /* @__PURE__ */ jsxs("div", { className: "p-12 text-center text-tone-500", children: [
14
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "w-12 h-12 mx-auto mb-4 opacity-20", "aria-hidden": "true" }),
15
+ /* @__PURE__ */ jsx("p", { children: searchQuery ? `Nothing matches \u201C${searchQuery}\u201D` : message || "No items yet" }),
16
+ searchQuery && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-tone-500", children: "Try a different search or clear the filters." }),
17
+ !searchQuery && action && /* @__PURE__ */ jsx(Button, { variant: "secondary", icon: action.icon, onClick: action.onClick, className: "mt-4", edit: !action.readOnly, children: action.label })
18
+ ] });
19
+ }
20
+ export {
21
+ EmptyState as default
22
+ };
@@ -0,0 +1,22 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ function GoogleButton({ href = "/api/auth/google", label = "Continue with Google" }) {
3
+ return /* @__PURE__ */ jsxs(
4
+ "a",
5
+ {
6
+ href,
7
+ className: "flex w-full items-center justify-center gap-3 rounded-full border border-tone-200 bg-white px-4 py-3 text-sm font-semibold text-ink shadow-sm transition-colors hover:bg-tone-50",
8
+ children: [
9
+ /* @__PURE__ */ jsxs("svg", { className: "h-5 w-5", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
10
+ /* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
11
+ /* @__PURE__ */ jsx("path", { fill: "#34A853", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
12
+ /* @__PURE__ */ jsx("path", { fill: "#FBBC05", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
13
+ /* @__PURE__ */ jsx("path", { fill: "#EA4335", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
14
+ ] }),
15
+ label
16
+ ]
17
+ }
18
+ );
19
+ }
20
+ export {
21
+ GoogleButton as default
22
+ };