@re-venue/ui-core-react 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.
@@ -0,0 +1,68 @@
1
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { ReactPortal } from 'react';
4
+
5
+ export declare function AppShell({ user, isAdmin, venues, activeVenueId, navItems, cookieDomain, onSwitchVenue, onLogout, headerSlot, sidebarPanel, scrollable, children, }: Props): JSX_2.Element;
6
+
7
+ export declare interface AuthUser {
8
+ id: string;
9
+ email: string;
10
+ globalPermissions: string[];
11
+ workspacePermissions?: Record<string, string[]>;
12
+ venuePermissions?: Record<string, string[]>;
13
+ }
14
+
15
+ export declare function ConfirmModal({ open, title, message, confirmLabel, loading, onConfirm, onCancel, }: Props_3): ReactPortal | null;
16
+
17
+ declare interface Props {
18
+ user: AuthUser | null;
19
+ isAdmin: boolean;
20
+ venues: Venue[];
21
+ activeVenueId: string | null;
22
+ navItems: SidebarNavItem[];
23
+ cookieDomain?: string;
24
+ onSwitchVenue?: (venueId: string) => void;
25
+ onLogout: () => void;
26
+ headerSlot?: ReactNode;
27
+ sidebarPanel?: ReactNode;
28
+ scrollable?: boolean;
29
+ children: ReactNode;
30
+ }
31
+
32
+ declare interface Props_2 {
33
+ value: string;
34
+ venues: Venue[];
35
+ onChange: (id: string) => void;
36
+ }
37
+
38
+ declare interface Props_3 {
39
+ open: boolean;
40
+ title?: string;
41
+ message?: string;
42
+ confirmLabel?: string;
43
+ loading?: boolean;
44
+ onConfirm: () => void;
45
+ onCancel: () => void;
46
+ }
47
+
48
+ export declare interface SidebarNavItem {
49
+ label: string;
50
+ url: string;
51
+ icon: string;
52
+ permission?: string;
53
+ active?: boolean;
54
+ }
55
+
56
+ export declare interface Venue {
57
+ id: string;
58
+ name: string;
59
+ workspace?: {
60
+ id: string;
61
+ name: string;
62
+ slug: string | null;
63
+ };
64
+ }
65
+
66
+ export declare function VenueSwitcher({ value, venues, onChange }: Props_2): JSX_2.Element;
67
+
68
+ export { }
@@ -0,0 +1 @@
1
+ .rv-app-shell{display:flex;height:100dvh;overflow:hidden;font-family:Host Grotesk,system-ui,sans-serif}.rv-sidebar{width:280px;flex-shrink:0;display:flex;flex-direction:column;background:var(--color-bg-panel, #ffffff);border-right:1px solid var(--color-border-subtle, #d1d5db);transition:width var(--transition-slow, .25s ease);overflow:hidden}.rv-sidebar.rv-collapsed{width:56px}.rv-sidebar.rv-collapsed .rv-sidebar-top{justify-content:center;padding:0}.rv-sidebar.rv-collapsed .rv-sidebar-nav{padding:.5rem 0;align-items:center}.rv-sidebar.rv-collapsed .rv-nav-item{justify-content:center;padding:.625rem 0;width:100%}.rv-sidebar.rv-collapsed .rv-sidebar-user{flex-direction:column;align-items:center;gap:.5rem;padding:.75rem 0}.rv-sidebar.rv-collapsed .rv-logout-btn{margin-left:0}.rv-sidebar-top{display:flex;align-items:center;gap:.5rem;padding:0 .875rem;border-bottom:1px solid var(--color-border-subtle, #d1d5db);height:64px;flex-shrink:0}.rv-sidebar-brand{flex:1;display:flex;flex-direction:column;gap:.25rem;min-width:0}.rv-sidebar-logo{width:90px;height:auto;color:var(--color-text-primary, #111111)}.rv-sidebar-workspace{font-size:.8rem;font-weight:600;color:var(--color-text-secondary, #444444);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rv-collapse-toggle{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;background:none;border-radius:var(--radius-sm, 4px);cursor:pointer;color:var(--color-text-muted, #777777);transition:background var(--transition-fast, .1s ease),color var(--transition-fast, .1s ease)}.rv-collapse-toggle:hover{background:var(--color-bg-surface, #f0f0f0);color:var(--color-text-secondary, #444444)}.rv-sidebar-panel{border-bottom:1px solid var(--color-border-subtle, #d1d5db);overflow:hidden}.rv-sidebar-nav{flex:1;display:flex;flex-direction:column;gap:2px;padding:.625rem .5rem;overflow-y:auto}.rv-nav-item{display:flex;align-items:center;gap:.625rem;padding:.5rem .625rem;border-radius:var(--radius-md, 8px);color:var(--color-text-secondary, #444444);text-decoration:none;font-size:.875rem;font-weight:400;transition:background var(--transition-fast, .1s ease),color var(--transition-fast, .1s ease);white-space:nowrap}.rv-nav-item:hover{background:var(--color-bg-surface, #f0f0f0);color:var(--color-text-primary, #111111)}.rv-nav-item.rv-active{background:var(--color-primary-focus, rgba(22, 163, 74, .1));color:var(--color-primary, #16a34a);font-weight:600}.rv-nav-icon{width:18px;height:18px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.rv-nav-icon svg{width:18px;height:18px}.rv-nav-label{flex:1;overflow:hidden;text-overflow:ellipsis}.rv-sidebar-user{display:flex;align-items:center;gap:.5rem;padding:.75rem;border-top:1px solid var(--color-border-subtle, #d1d5db);flex-shrink:0}.rv-user-avatar{width:28px;height:28px;border-radius:var(--radius-full, 999px);background:var(--color-primary-focus, rgba(22, 163, 74, .1));color:var(--color-primary, #16a34a);font-size:.65rem;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0;letter-spacing:.02em}.rv-user-info{flex:1;min-width:0;display:flex;flex-direction:column}.rv-user-email{font-size:.875rem;font-weight:400;color:var(--color-text-secondary, #444444);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rv-logout-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;margin-left:auto;border:none;background:none;cursor:pointer;color:var(--color-text-muted, #777777);border-radius:var(--radius-sm, 4px);padding:4px;transition:background var(--transition-fast, .1s ease),color var(--transition-fast, .1s ease)}.rv-logout-btn:hover{background:var(--color-bg-surface, #f0f0f0);color:var(--color-text-secondary, #444444)}.rv-shell-body{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0;min-height:0}.rv-shell-header{height:64px;flex-shrink:0;display:flex;align-items:center;padding:0 1.25rem;border-bottom:1px solid var(--color-border-subtle, #d1d5db);background:var(--color-bg-panel, #ffffff)}.rv-shell-content{flex:1;min-height:0;background:var(--color-bg-base, #f9f8f6)}.rv-shell-content--scroll{overflow-y:auto}.rv-shell-content--fill{overflow:hidden;display:flex;flex-direction:column}.rv-venue-switcher{position:relative}.rv-vs-trigger{display:flex;align-items:center;gap:.5rem;padding:.4rem .65rem;border:1px solid var(--color-border-subtle, #d1d5db);border-radius:8px;background:var(--color-bg-panel, #ffffff);cursor:pointer;font-size:.875rem;font-weight:400;color:var(--color-text-primary, #111111);transition:border-color .15s,background .15s;min-width:140px;max-width:220px;font-family:inherit}.rv-vs-trigger:hover{background:var(--color-bg-surface, #f0f0f0)}.rv-vs-trigger.rv-open{border-color:var(--color-primary, #16a34a);outline:none}.rv-vs-label{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:.05rem;overflow:hidden}.rv-vs-venue{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.rv-vs-workspace{font-size:.7rem;font-weight:400;color:var(--color-text-muted, #777777);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.rv-vs-chevron{flex-shrink:0;color:var(--color-text-muted, #777777);transition:transform .15s}.rv-vs-trigger.rv-open .rv-vs-chevron{transform:rotate(180deg)}.rv-vs-dropdown{position:absolute;top:calc(100% + 6px);left:0;min-width:100%;width:max-content;max-width:280px;background:var(--color-bg-panel, #ffffff);border:1px solid var(--color-border-subtle, #d1d5db);border-radius:10px;box-shadow:0 8px 24px #00000026;max-height:min(360px,80dvh);overflow-y:auto;overscroll-behavior:contain;z-index:200;padding:.3rem}.rv-vs-workspace-header{padding:.45rem .65rem .25rem;font-size:.7rem;font-weight:700;color:var(--color-text-muted, #777777);text-transform:uppercase;letter-spacing:.06em}.rv-vs-workspace-header+.rv-vs-workspace-header,.rv-vs-venue-option+.rv-vs-workspace-header{border-top:1px solid var(--color-border-muted, #e5e7eb);margin-top:.25rem;padding-top:.6rem}.rv-vs-venue-option{display:block;width:100%;text-align:left;padding:.5rem .65rem;font-size:.875rem;font-weight:400;color:var(--color-text-secondary, #444444);border:none;background:none;border-radius:6px;cursor:pointer;transition:background .1s;font-family:inherit}.rv-vs-venue-option:hover{background:var(--color-bg-surface, #f0f0f0)}.rv-vs-venue-option.rv-active{background:var(--color-primary-focus, rgba(22, 163, 74, .1));color:var(--color-primary, #16a34a);font-weight:600}.rv-modal-backdrop{position:fixed;inset:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:1000;padding:1rem;opacity:0;transition:opacity .2s ease}.rv-modal-backdrop.rv-modal-visible{opacity:1}.rv-modal-dialog{background:var(--color-bg-panel, #ffffff);border-radius:var(--radius-lg, 12px);padding:2rem;max-width:420px;width:100%;box-shadow:var(--shadow-lg, rgba(0, 0, 0, .32) 0px 8px 24px);transform:scale(.95) translateY(-8px);opacity:0;transition:transform .2s ease,opacity .2s ease;font-family:Host Grotesk,system-ui,sans-serif}.rv-modal-backdrop.rv-modal-visible .rv-modal-dialog{transform:scale(1) translateY(0);opacity:1}.rv-modal-title{font-size:1.15rem;font-weight:700;color:var(--color-text-primary, #111111);margin:0 0 .75rem}.rv-modal-body{font-size:.9rem;color:var(--color-text-secondary, #444444);margin:0 0 1.5rem;line-height:1.55}.rv-modal-actions{display:flex;justify-content:flex-end;gap:.75rem}.rv-modal-btn{display:inline-flex;align-items:center;justify-content:center;padding:.5rem 1rem;font-size:.875rem;font-weight:500;border-radius:var(--radius-md, 8px);cursor:pointer;border:none;font-family:inherit;transition:background .15s,color .15s}.rv-modal-btn-ghost{background:transparent;color:var(--color-text-secondary, #444444);border:1px solid var(--color-border-subtle, #d1d5db)}.rv-modal-btn-ghost:hover{background:var(--color-bg-surface, #f0f0f0)}.rv-modal-btn-danger{background:var(--color-error, #ef4444);color:#fff}.rv-modal-btn-danger:hover{background:var(--color-error-hover, #dc2626)}
@@ -0,0 +1,233 @@
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import { useState as f, useRef as L, useEffect as x, useMemo as p } from "react";
3
+ import { createPortal as Z } from "react-dom";
4
+ function E({
5
+ open: n,
6
+ title: i = "Are you sure?",
7
+ message: a = "This action cannot be undone.",
8
+ confirmLabel: c = "Confirm",
9
+ loading: d = !1,
10
+ onConfirm: h,
11
+ onCancel: m
12
+ }) {
13
+ const [v, C] = f(!1), [u, r] = f(!1), l = L(`rv-confirm-${Math.random().toString(36).slice(2)}`).current;
14
+ return x(() => {
15
+ if (n)
16
+ r(!0), requestAnimationFrame(() => C(!0));
17
+ else {
18
+ C(!1);
19
+ const s = setTimeout(() => r(!1), 200);
20
+ return () => clearTimeout(s);
21
+ }
22
+ }, [n]), u ? Z(
23
+ /* @__PURE__ */ e(
24
+ "div",
25
+ {
26
+ className: `rv-modal-backdrop${v ? " rv-modal-visible" : ""}`,
27
+ onClick: (s) => {
28
+ s.target === s.currentTarget && m();
29
+ },
30
+ children: /* @__PURE__ */ o("div", { className: "rv-modal-dialog", role: "dialog", "aria-modal": "true", "aria-labelledby": l, children: [
31
+ /* @__PURE__ */ e("h2", { id: l, className: "rv-modal-title", children: i }),
32
+ /* @__PURE__ */ e("p", { className: "rv-modal-body", children: a }),
33
+ /* @__PURE__ */ o("div", { className: "rv-modal-actions", children: [
34
+ /* @__PURE__ */ e("button", { className: "rv-modal-btn rv-modal-btn-ghost", onClick: m, disabled: d, children: "Cancel" }),
35
+ /* @__PURE__ */ e("button", { className: "rv-modal-btn rv-modal-btn-danger", onClick: h, disabled: d, children: c })
36
+ ] })
37
+ ] })
38
+ }
39
+ ),
40
+ document.body
41
+ ) : null;
42
+ }
43
+ function A({ value: n, venues: i, onChange: a }) {
44
+ const [c, d] = f(!1), h = L(null), m = p(() => i.find((r) => r.id === n), [i, n]), v = p(() => {
45
+ const r = /* @__PURE__ */ new Map();
46
+ for (const l of i) {
47
+ const s = l.workspace?.id ?? "__none__", g = l.workspace?.name ?? "";
48
+ r.has(s) || r.set(s, { workspaceName: g, venues: [] }), r.get(s).venues.push(l);
49
+ }
50
+ return [...r.values()];
51
+ }, [i]), C = v.length > 1;
52
+ x(() => {
53
+ if (!c) return;
54
+ function r(l) {
55
+ h.current && !h.current.contains(l.target) && d(!1);
56
+ }
57
+ return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
58
+ }, [c]);
59
+ function u(r) {
60
+ a(r), d(!1);
61
+ }
62
+ return /* @__PURE__ */ o("div", { ref: h, className: "rv-venue-switcher", children: [
63
+ /* @__PURE__ */ o("button", { className: `rv-vs-trigger${c ? " rv-open" : ""}`, onClick: () => d((r) => !r), children: [
64
+ /* @__PURE__ */ o("span", { className: "rv-vs-label", children: [
65
+ /* @__PURE__ */ e("span", { className: "rv-vs-venue", children: m?.name ?? "Select venue" }),
66
+ m?.workspace && C && /* @__PURE__ */ e("span", { className: "rv-vs-workspace", children: m.workspace.name })
67
+ ] }),
68
+ /* @__PURE__ */ e(
69
+ "svg",
70
+ {
71
+ className: "rv-vs-chevron",
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ width: "14",
74
+ height: "14",
75
+ viewBox: "0 0 24 24",
76
+ fill: "none",
77
+ stroke: "currentColor",
78
+ strokeWidth: "2.5",
79
+ strokeLinecap: "round",
80
+ strokeLinejoin: "round",
81
+ children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" })
82
+ }
83
+ )
84
+ ] }),
85
+ c && /* @__PURE__ */ e("div", { className: "rv-vs-dropdown", children: v.map((r) => /* @__PURE__ */ o("div", { children: [
86
+ C && /* @__PURE__ */ e("div", { className: "rv-vs-workspace-header", children: r.workspaceName }),
87
+ r.venues.map((l) => /* @__PURE__ */ e(
88
+ "button",
89
+ {
90
+ className: `rv-vs-venue-option${l.id === n ? " rv-active" : ""}`,
91
+ onClick: () => u(l.id),
92
+ children: l.name
93
+ },
94
+ l.id
95
+ ))
96
+ ] }, r.workspaceName)) })
97
+ ] });
98
+ }
99
+ const M = "rv_sidebar_collapsed", B = 3600 * 24 * 365;
100
+ function H() {
101
+ const n = `${M}=`;
102
+ for (const i of document.cookie.split(";")) {
103
+ const a = i.trim();
104
+ if (a.startsWith(n)) return decodeURIComponent(a.slice(n.length)) === "true";
105
+ }
106
+ return !1;
107
+ }
108
+ function P(n, i) {
109
+ const a = i ? `; Domain=${i}` : "";
110
+ document.cookie = `${M}=${n}; Path=/; Max-Age=${B}; SameSite=Lax${a}`;
111
+ }
112
+ function R({
113
+ user: n,
114
+ isAdmin: i,
115
+ venues: a,
116
+ activeVenueId: c,
117
+ navItems: d,
118
+ cookieDomain: h,
119
+ onSwitchVenue: m,
120
+ onLogout: v,
121
+ headerSlot: C,
122
+ sidebarPanel: u,
123
+ scrollable: r = !0,
124
+ children: l
125
+ }) {
126
+ const [s, g] = f(() => H()), [y, b] = f(!1);
127
+ function S() {
128
+ const t = !s;
129
+ g(t), P(t, h);
130
+ }
131
+ const k = p(() => a.find((t) => t.id === c), [a, c]), N = k?.workspace?.name ?? "", V = p(() => n?.email ? n.email.slice(0, 2).toUpperCase() : "?", [n?.email]), $ = p(() => {
132
+ const t = k?.workspace?.id;
133
+ return d.filter((w) => !!(!w.permission || i || n?.globalPermissions.includes(w.permission) || t && n?.workspacePermissions?.[t]?.includes(w.permission) || c && n?.venuePermissions?.[c]?.includes(w.permission)));
134
+ }, [d, i, n, k, c]), _ = a.length > 0 || C !== void 0;
135
+ return /* @__PURE__ */ o("div", { className: "rv-app-shell", children: [
136
+ /* @__PURE__ */ o("aside", { className: `rv-sidebar${s ? " rv-collapsed" : ""}`, children: [
137
+ /* @__PURE__ */ o("div", { className: "rv-sidebar-top", children: [
138
+ !s && /* @__PURE__ */ o("div", { className: "rv-sidebar-brand", children: [
139
+ /* @__PURE__ */ o(
140
+ "svg",
141
+ {
142
+ className: "rv-sidebar-logo",
143
+ viewBox: "0 0 429 50",
144
+ fill: "none",
145
+ xmlns: "http://www.w3.org/2000/svg",
146
+ "aria-label": "Re-venue",
147
+ children: [
148
+ /* @__PURE__ */ o("g", { clipPath: "url(#rv-logo-clip)", children: [
149
+ /* @__PURE__ */ e("path", { d: "M24.946 0.60506C24.6367 1.30638 24.2289 3.01155 24.2289 7.32948V8.73212L23.5117 9.22717C22.3867 8.12706 20.2212 7.61826 18.4775 7.61826C11.9105 7.61826 8.0013 13.6414 8.0013 21.3696V35.0247C8.0013 41.0479 8.09974 45.6683 8.4091 48.9824C6.86228 48.6799 5.54045 48.4736 4.303 48.4736C2.96711 48.4736 1.63122 48.6799 -0.0140381 48.9824C0.295326 46.2734 0.39376 42.9593 0.39376 38.2426V15.8691C0.407822 11.5512 0.309388 4.0154 2.39182e-05 1.00385C1.95464 1.40264 3.0796 1.4989 4.31706 1.4989C5.55452 1.4989 6.89041 1.29263 8.42316 1.00385L8.01537 6.0231C7.91693 7.12321 7.91693 8.73212 7.91693 10.7398L8.12786 10.8361C12.1215 3.61661 16.8322 0 21.768 0C23.0055 0 23.7226 0.206271 24.946 0.60506Z", fill: "currentColor" }),
150
+ /* @__PURE__ */ e("path", { d: "M74.7396 20.5858V22.291L74.5287 24.3949C68.3695 24.2987 61.6901 24.0924 54.4059 24.0924C49.4842 24.0924 44.3376 24.2987 39.1065 24.3949C39.0081 24.9037 39.0081 26.3064 39.0081 26.6089C39.0081 39.0539 46.4047 45.7921 56.6699 45.7921C61.901 45.7921 68.1727 42.9868 72.1663 38.6689L72.6866 38.9714L72.0678 43.8944C66.7243 47.9098 60.2557 50.0137 54.8137 50.0137C40.5408 50.0137 29.9662 40.0715 29.9662 26.3201C29.9802 9.84598 38.6003 0 53.4919 0C66.6399 0 74.7396 8.12706 74.7396 20.5858ZM52.6623 20.8883C56.2621 20.8883 62.3088 20.5858 66.3165 20.5858C66.218 9.03465 61.9994 3.21782 53.6888 3.21782C45.3781 3.21782 40.4424 9.74972 39.3174 20.5858C43.3251 20.5858 51.017 20.8883 52.6623 20.8883Z", fill: "currentColor" }),
151
+ /* @__PURE__ */ e("path", { d: "M164.989 22.9923V27.709H82.8533V22.9923H164.989Z", fill: "currentColor" }),
152
+ /* @__PURE__ */ e("path", { d: "M172.274 1.51265C173.82 1.51265 175.142 1.30638 176.788 1.0176C180.992 14.1639 185.928 26.8152 192.087 40.1815C195.687 32.852 198.148 26.8289 207.794 1.0176C208.821 1.32013 209.847 1.51265 210.972 1.51265C212.21 1.51265 213.025 1.30638 214.15 1.0176L203.477 24.615C199.779 32.9483 196.502 40.9791 193.521 49.0099C192.495 48.7074 191.468 48.5011 190.343 48.5011C189.106 48.5011 188.6 48.5974 187.053 49.0099C180.486 32.5495 174.636 17.1755 167.141 1.0176C169.292 1.41639 170.741 1.51265 172.274 1.51265Z", fill: "currentColor" }),
153
+ /* @__PURE__ */ e("path", { d: "M263.452 20.5858V22.291L263.241 24.3949C257.082 24.2987 250.402 24.0924 243.118 24.0924C238.196 24.0924 233.05 24.2987 227.819 24.3949C227.72 24.9037 227.72 26.3064 227.72 26.6089C227.72 39.0539 235.117 45.7921 245.382 45.7921C250.613 45.7921 256.885 42.9868 260.878 38.6689L261.399 38.9714L260.78 43.8944C255.436 47.9098 248.968 50.0138 243.526 50.0138C229.253 50.0138 218.678 40.0715 218.678 26.3201C218.678 9.85973 227.298 0.0137513 242.19 0.0137513C255.338 0.0137513 263.438 8.14081 263.438 20.5996L263.452 20.5858ZM241.374 20.8883C244.974 20.8883 251.021 20.5858 255.029 20.5858C254.93 9.03465 250.711 3.21782 242.401 3.21782C234.09 3.21782 229.154 9.74972 228.029 20.5858C232.037 20.5858 239.729 20.8883 241.374 20.8883Z", fill: "currentColor" }),
154
+ /* @__PURE__ */ e("path", { d: "M315.706 17.7668C315.706 23.0886 315.298 28.9054 315.298 36.5374C315.298 45.3795 315.509 47.181 315.509 48.9824C313.765 48.5836 312.528 48.4736 311.192 48.4736C309.856 48.4736 308.619 48.5699 306.988 48.9824C306.988 43.2618 307.705 34.2272 307.705 27.6953V19.967C307.705 11.6337 303.908 5.21177 296.413 5.21177C287.371 5.21177 282.66 10.8361 282.66 21.2734V33.3196C282.66 37.6375 282.97 44.4582 283.476 48.9824C281.831 48.6799 280.396 48.4736 278.85 48.4736C277.303 48.4736 275.868 48.6799 274.223 48.9824C275.039 42.6568 275.039 35.3273 275.039 31.3119V17.753C275.039 11.7299 274.729 6.20187 274.223 0.990099C275.967 1.38889 277.514 1.48515 278.85 1.48515C279.876 1.48515 281.212 1.27888 282.956 0.990099C282.857 2.69527 282.646 6.61441 282.646 9.0209H282.857C286.654 3.30033 291.787 -0.0137513 299.183 -0.0137513C309.448 -0.0137513 315.72 5.70682 315.72 17.753L315.706 17.7668Z", fill: "currentColor" }),
155
+ /* @__PURE__ */ e("path", { d: "M331.413 1.00385C333.157 1.30638 334.591 1.4989 335.73 1.4989C336.968 1.4989 338.304 1.29263 339.935 1.00385C339.218 9.43344 338.908 19.6782 338.908 28.9191C338.908 31.4356 338.908 37.6513 341.889 40.7728C343.844 43.0831 346.924 44.7882 350.931 44.7882C356.584 44.7882 359.861 42.3817 361.815 39.2602C364.276 35.2448 364.487 32.2332 364.487 21.3834C364.487 11.2486 364.389 3.10781 364.276 1.00385C366.02 1.40264 367.257 1.4989 368.593 1.4989C370.14 1.4989 371.265 1.40264 372.798 1.00385C372.39 7.42574 372.081 17.368 372.081 31.1194C372.081 38.8476 372.179 44.2657 372.488 48.9961C370.942 48.6936 369.62 48.4873 368.481 48.4873C367.342 48.4873 366.02 48.6936 364.473 48.9961C364.571 47.6898 364.684 45.4758 364.684 43.9769V40.3603H364.473C360.873 46.7822 355.023 50 348.456 50C337.783 50 331.315 44.3757 331.315 33.1271C331.315 29.0154 331.624 19.7745 331.624 16.5567C331.624 11.3311 331.526 6.21562 331.413 0.990099V1.00385Z", fill: "currentColor" }),
156
+ /* @__PURE__ */ e("path", { d: "M428.947 20.5858V22.291L428.736 24.3949C422.577 24.2987 415.898 24.0924 408.614 24.0924C403.692 24.0924 398.545 24.2987 393.314 24.3949C393.216 24.9037 393.216 26.3064 393.216 26.6089C393.216 39.0539 400.612 45.7921 410.878 45.7921C416.109 45.7921 422.38 42.9868 426.374 38.6689L426.894 38.9714L426.276 43.8944C420.932 47.9098 414.463 50.0138 409.021 50.0138C394.749 50.0138 384.174 40.0715 384.174 26.3201C384.174 9.85973 392.794 0.0137513 407.686 0.0137513C420.834 0.0137513 428.933 8.14081 428.933 20.5996L428.947 20.5858ZM406.87 20.8883C410.47 20.8883 416.517 20.5858 420.524 20.5858C420.426 9.03465 416.207 3.21782 407.897 3.21782C399.586 3.21782 394.65 9.74972 393.525 20.5858C397.533 20.5858 405.225 20.8883 406.87 20.8883Z", fill: "currentColor" })
157
+ ] }),
158
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("clipPath", { id: "rv-logo-clip", children: /* @__PURE__ */ e("rect", { width: "428.947", height: "50", fill: "white" }) }) })
159
+ ]
160
+ }
161
+ ),
162
+ N && /* @__PURE__ */ e("span", { className: "rv-sidebar-workspace", children: N })
163
+ ] }),
164
+ /* @__PURE__ */ e(
165
+ "button",
166
+ {
167
+ className: "rv-collapse-toggle",
168
+ title: s ? "Expand sidebar" : "Collapse sidebar",
169
+ onClick: S,
170
+ children: s ? /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
171
+ /* @__PURE__ */ e("polyline", { points: "13 17 18 12 13 7" }),
172
+ /* @__PURE__ */ e("polyline", { points: "6 17 11 12 6 7" })
173
+ ] }) : /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
174
+ /* @__PURE__ */ e("polyline", { points: "11 17 6 12 11 7" }),
175
+ /* @__PURE__ */ e("polyline", { points: "18 17 13 12 18 7" })
176
+ ] })
177
+ }
178
+ )
179
+ ] }),
180
+ u && /* @__PURE__ */ e("div", { className: "rv-sidebar-panel", children: u }),
181
+ /* @__PURE__ */ e("nav", { className: "rv-sidebar-nav", children: $.map((t) => /* @__PURE__ */ o(
182
+ "a",
183
+ {
184
+ href: t.url,
185
+ className: `rv-nav-item${t.active ? " rv-active" : ""}`,
186
+ title: s ? t.label : void 0,
187
+ children: [
188
+ /* @__PURE__ */ e("span", { className: "rv-nav-icon", dangerouslySetInnerHTML: { __html: t.icon } }),
189
+ !s && /* @__PURE__ */ e("span", { className: "rv-nav-label", children: t.label })
190
+ ]
191
+ },
192
+ t.url
193
+ )) }),
194
+ /* @__PURE__ */ o("div", { className: "rv-sidebar-user", children: [
195
+ /* @__PURE__ */ e("div", { className: "rv-user-avatar", children: V }),
196
+ !s && /* @__PURE__ */ e("div", { className: "rv-user-info", children: /* @__PURE__ */ e("span", { className: "rv-user-email", title: n?.email ?? "", children: n?.email }) }),
197
+ /* @__PURE__ */ e("button", { className: "rv-logout-btn", title: "Sign out", onClick: () => b(!0), children: /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
198
+ /* @__PURE__ */ e("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
199
+ /* @__PURE__ */ e("polyline", { points: "16 17 21 12 16 7" }),
200
+ /* @__PURE__ */ e("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
201
+ ] }) })
202
+ ] })
203
+ ] }),
204
+ /* @__PURE__ */ o("div", { className: "rv-shell-body", children: [
205
+ _ && /* @__PURE__ */ e("header", { className: "rv-shell-header", children: C !== void 0 ? C : /* @__PURE__ */ e(
206
+ A,
207
+ {
208
+ value: c ?? "",
209
+ venues: a,
210
+ onChange: m ?? (() => {
211
+ })
212
+ }
213
+ ) }),
214
+ /* @__PURE__ */ e("main", { className: `rv-shell-content${r ? " rv-shell-content--scroll" : " rv-shell-content--fill"}`, children: l })
215
+ ] }),
216
+ /* @__PURE__ */ e(
217
+ E,
218
+ {
219
+ open: y,
220
+ title: "Sign out",
221
+ message: "Are you sure you want to sign out?",
222
+ confirmLabel: "Sign out",
223
+ onConfirm: v,
224
+ onCancel: () => b(!1)
225
+ }
226
+ )
227
+ ] });
228
+ }
229
+ export {
230
+ R as AppShell,
231
+ E as ConfirmModal,
232
+ A as VenueSwitcher
233
+ };
@@ -0,0 +1 @@
1
+ (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.ReVenueUiCoreReact={},d.jsxRuntime,d.React,d.ReactDOM))})(this,(function(d,e,n,S){"use strict";function k({open:s,title:a="Are you sure?",message:t="This action cannot be undone.",confirmLabel:c="Confirm",loading:C=!1,onConfirm:p,onCancel:v}){const[f,h]=n.useState(!1),[u,r]=n.useState(!1),l=n.useRef(`rv-confirm-${Math.random().toString(36).slice(2)}`).current;return n.useEffect(()=>{if(s)r(!0),requestAnimationFrame(()=>h(!0));else{h(!1);const o=setTimeout(()=>r(!1),200);return()=>clearTimeout(o)}},[s]),u?S.createPortal(e.jsx("div",{className:`rv-modal-backdrop${f?" rv-modal-visible":""}`,onClick:o=>{o.target===o.currentTarget&&v()},children:e.jsxs("div",{className:"rv-modal-dialog",role:"dialog","aria-modal":"true","aria-labelledby":l,children:[e.jsx("h2",{id:l,className:"rv-modal-title",children:a}),e.jsx("p",{className:"rv-modal-body",children:t}),e.jsxs("div",{className:"rv-modal-actions",children:[e.jsx("button",{className:"rv-modal-btn rv-modal-btn-ghost",onClick:v,disabled:C,children:"Cancel"}),e.jsx("button",{className:"rv-modal-btn rv-modal-btn-danger",onClick:p,disabled:C,children:c})]})]})}),document.body):null}function b({value:s,venues:a,onChange:t}){const[c,C]=n.useState(!1),p=n.useRef(null),v=n.useMemo(()=>a.find(r=>r.id===s),[a,s]),f=n.useMemo(()=>{const r=new Map;for(const l of a){const o=l.workspace?.id??"__none__",m=l.workspace?.name??"";r.has(o)||r.set(o,{workspaceName:m,venues:[]}),r.get(o).venues.push(l)}return[...r.values()]},[a]),h=f.length>1;n.useEffect(()=>{if(!c)return;function r(l){p.current&&!p.current.contains(l.target)&&C(!1)}return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[c]);function u(r){t(r),C(!1)}return e.jsxs("div",{ref:p,className:"rv-venue-switcher",children:[e.jsxs("button",{className:`rv-vs-trigger${c?" rv-open":""}`,onClick:()=>C(r=>!r),children:[e.jsxs("span",{className:"rv-vs-label",children:[e.jsx("span",{className:"rv-vs-venue",children:v?.name??"Select venue"}),v?.workspace&&h&&e.jsx("span",{className:"rv-vs-workspace",children:v.workspace.name})]}),e.jsx("svg",{className:"rv-vs-chevron",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),c&&e.jsx("div",{className:"rv-vs-dropdown",children:f.map(r=>e.jsxs("div",{children:[h&&e.jsx("div",{className:"rv-vs-workspace-header",children:r.workspaceName}),r.venues.map(l=>e.jsx("button",{className:`rv-vs-venue-option${l.id===s?" rv-active":""}`,onClick:()=>u(l.id),children:l.name},l.id))]},r.workspaceName))})]})}const N="rv_sidebar_collapsed",x=3600*24*365;function y(){const s=`${N}=`;for(const a of document.cookie.split(";")){const t=a.trim();if(t.startsWith(s))return decodeURIComponent(t.slice(s.length))==="true"}return!1}function V(s,a){const t=a?`; Domain=${a}`:"";document.cookie=`${N}=${s}; Path=/; Max-Age=${x}; SameSite=Lax${t}`}function $({user:s,isAdmin:a,venues:t,activeVenueId:c,navItems:C,cookieDomain:p,onSwitchVenue:v,onLogout:f,headerSlot:h,sidebarPanel:u,scrollable:r=!0,children:l}){const[o,m]=n.useState(()=>y()),[_,L]=n.useState(!1);function Z(){const i=!o;m(i),V(i,p)}const g=n.useMemo(()=>t.find(i=>i.id===c),[t,c]),M=g?.workspace?.name??"",j=n.useMemo(()=>s?.email?s.email.slice(0,2).toUpperCase():"?",[s?.email]),E=n.useMemo(()=>{const i=g?.workspace?.id;return C.filter(w=>!!(!w.permission||a||s?.globalPermissions.includes(w.permission)||i&&s?.workspacePermissions?.[i]?.includes(w.permission)||c&&s?.venuePermissions?.[c]?.includes(w.permission)))},[C,a,s,g,c]),A=t.length>0||h!==void 0;return e.jsxs("div",{className:"rv-app-shell",children:[e.jsxs("aside",{className:`rv-sidebar${o?" rv-collapsed":""}`,children:[e.jsxs("div",{className:"rv-sidebar-top",children:[!o&&e.jsxs("div",{className:"rv-sidebar-brand",children:[e.jsxs("svg",{className:"rv-sidebar-logo",viewBox:"0 0 429 50",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"Re-venue",children:[e.jsxs("g",{clipPath:"url(#rv-logo-clip)",children:[e.jsx("path",{d:"M24.946 0.60506C24.6367 1.30638 24.2289 3.01155 24.2289 7.32948V8.73212L23.5117 9.22717C22.3867 8.12706 20.2212 7.61826 18.4775 7.61826C11.9105 7.61826 8.0013 13.6414 8.0013 21.3696V35.0247C8.0013 41.0479 8.09974 45.6683 8.4091 48.9824C6.86228 48.6799 5.54045 48.4736 4.303 48.4736C2.96711 48.4736 1.63122 48.6799 -0.0140381 48.9824C0.295326 46.2734 0.39376 42.9593 0.39376 38.2426V15.8691C0.407822 11.5512 0.309388 4.0154 2.39182e-05 1.00385C1.95464 1.40264 3.0796 1.4989 4.31706 1.4989C5.55452 1.4989 6.89041 1.29263 8.42316 1.00385L8.01537 6.0231C7.91693 7.12321 7.91693 8.73212 7.91693 10.7398L8.12786 10.8361C12.1215 3.61661 16.8322 0 21.768 0C23.0055 0 23.7226 0.206271 24.946 0.60506Z",fill:"currentColor"}),e.jsx("path",{d:"M74.7396 20.5858V22.291L74.5287 24.3949C68.3695 24.2987 61.6901 24.0924 54.4059 24.0924C49.4842 24.0924 44.3376 24.2987 39.1065 24.3949C39.0081 24.9037 39.0081 26.3064 39.0081 26.6089C39.0081 39.0539 46.4047 45.7921 56.6699 45.7921C61.901 45.7921 68.1727 42.9868 72.1663 38.6689L72.6866 38.9714L72.0678 43.8944C66.7243 47.9098 60.2557 50.0137 54.8137 50.0137C40.5408 50.0137 29.9662 40.0715 29.9662 26.3201C29.9802 9.84598 38.6003 0 53.4919 0C66.6399 0 74.7396 8.12706 74.7396 20.5858ZM52.6623 20.8883C56.2621 20.8883 62.3088 20.5858 66.3165 20.5858C66.218 9.03465 61.9994 3.21782 53.6888 3.21782C45.3781 3.21782 40.4424 9.74972 39.3174 20.5858C43.3251 20.5858 51.017 20.8883 52.6623 20.8883Z",fill:"currentColor"}),e.jsx("path",{d:"M164.989 22.9923V27.709H82.8533V22.9923H164.989Z",fill:"currentColor"}),e.jsx("path",{d:"M172.274 1.51265C173.82 1.51265 175.142 1.30638 176.788 1.0176C180.992 14.1639 185.928 26.8152 192.087 40.1815C195.687 32.852 198.148 26.8289 207.794 1.0176C208.821 1.32013 209.847 1.51265 210.972 1.51265C212.21 1.51265 213.025 1.30638 214.15 1.0176L203.477 24.615C199.779 32.9483 196.502 40.9791 193.521 49.0099C192.495 48.7074 191.468 48.5011 190.343 48.5011C189.106 48.5011 188.6 48.5974 187.053 49.0099C180.486 32.5495 174.636 17.1755 167.141 1.0176C169.292 1.41639 170.741 1.51265 172.274 1.51265Z",fill:"currentColor"}),e.jsx("path",{d:"M263.452 20.5858V22.291L263.241 24.3949C257.082 24.2987 250.402 24.0924 243.118 24.0924C238.196 24.0924 233.05 24.2987 227.819 24.3949C227.72 24.9037 227.72 26.3064 227.72 26.6089C227.72 39.0539 235.117 45.7921 245.382 45.7921C250.613 45.7921 256.885 42.9868 260.878 38.6689L261.399 38.9714L260.78 43.8944C255.436 47.9098 248.968 50.0138 243.526 50.0138C229.253 50.0138 218.678 40.0715 218.678 26.3201C218.678 9.85973 227.298 0.0137513 242.19 0.0137513C255.338 0.0137513 263.438 8.14081 263.438 20.5996L263.452 20.5858ZM241.374 20.8883C244.974 20.8883 251.021 20.5858 255.029 20.5858C254.93 9.03465 250.711 3.21782 242.401 3.21782C234.09 3.21782 229.154 9.74972 228.029 20.5858C232.037 20.5858 239.729 20.8883 241.374 20.8883Z",fill:"currentColor"}),e.jsx("path",{d:"M315.706 17.7668C315.706 23.0886 315.298 28.9054 315.298 36.5374C315.298 45.3795 315.509 47.181 315.509 48.9824C313.765 48.5836 312.528 48.4736 311.192 48.4736C309.856 48.4736 308.619 48.5699 306.988 48.9824C306.988 43.2618 307.705 34.2272 307.705 27.6953V19.967C307.705 11.6337 303.908 5.21177 296.413 5.21177C287.371 5.21177 282.66 10.8361 282.66 21.2734V33.3196C282.66 37.6375 282.97 44.4582 283.476 48.9824C281.831 48.6799 280.396 48.4736 278.85 48.4736C277.303 48.4736 275.868 48.6799 274.223 48.9824C275.039 42.6568 275.039 35.3273 275.039 31.3119V17.753C275.039 11.7299 274.729 6.20187 274.223 0.990099C275.967 1.38889 277.514 1.48515 278.85 1.48515C279.876 1.48515 281.212 1.27888 282.956 0.990099C282.857 2.69527 282.646 6.61441 282.646 9.0209H282.857C286.654 3.30033 291.787 -0.0137513 299.183 -0.0137513C309.448 -0.0137513 315.72 5.70682 315.72 17.753L315.706 17.7668Z",fill:"currentColor"}),e.jsx("path",{d:"M331.413 1.00385C333.157 1.30638 334.591 1.4989 335.73 1.4989C336.968 1.4989 338.304 1.29263 339.935 1.00385C339.218 9.43344 338.908 19.6782 338.908 28.9191C338.908 31.4356 338.908 37.6513 341.889 40.7728C343.844 43.0831 346.924 44.7882 350.931 44.7882C356.584 44.7882 359.861 42.3817 361.815 39.2602C364.276 35.2448 364.487 32.2332 364.487 21.3834C364.487 11.2486 364.389 3.10781 364.276 1.00385C366.02 1.40264 367.257 1.4989 368.593 1.4989C370.14 1.4989 371.265 1.40264 372.798 1.00385C372.39 7.42574 372.081 17.368 372.081 31.1194C372.081 38.8476 372.179 44.2657 372.488 48.9961C370.942 48.6936 369.62 48.4873 368.481 48.4873C367.342 48.4873 366.02 48.6936 364.473 48.9961C364.571 47.6898 364.684 45.4758 364.684 43.9769V40.3603H364.473C360.873 46.7822 355.023 50 348.456 50C337.783 50 331.315 44.3757 331.315 33.1271C331.315 29.0154 331.624 19.7745 331.624 16.5567C331.624 11.3311 331.526 6.21562 331.413 0.990099V1.00385Z",fill:"currentColor"}),e.jsx("path",{d:"M428.947 20.5858V22.291L428.736 24.3949C422.577 24.2987 415.898 24.0924 408.614 24.0924C403.692 24.0924 398.545 24.2987 393.314 24.3949C393.216 24.9037 393.216 26.3064 393.216 26.6089C393.216 39.0539 400.612 45.7921 410.878 45.7921C416.109 45.7921 422.38 42.9868 426.374 38.6689L426.894 38.9714L426.276 43.8944C420.932 47.9098 414.463 50.0138 409.021 50.0138C394.749 50.0138 384.174 40.0715 384.174 26.3201C384.174 9.85973 392.794 0.0137513 407.686 0.0137513C420.834 0.0137513 428.933 8.14081 428.933 20.5996L428.947 20.5858ZM406.87 20.8883C410.47 20.8883 416.517 20.5858 420.524 20.5858C420.426 9.03465 416.207 3.21782 407.897 3.21782C399.586 3.21782 394.65 9.74972 393.525 20.5858C397.533 20.5858 405.225 20.8883 406.87 20.8883Z",fill:"currentColor"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"rv-logo-clip",children:e.jsx("rect",{width:"428.947",height:"50",fill:"white"})})})]}),M&&e.jsx("span",{className:"rv-sidebar-workspace",children:M})]}),e.jsx("button",{className:"rv-collapse-toggle",title:o?"Expand sidebar":"Collapse sidebar",onClick:Z,children:o?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"13 17 18 12 13 7"}),e.jsx("polyline",{points:"6 17 11 12 6 7"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"11 17 6 12 11 7"}),e.jsx("polyline",{points:"18 17 13 12 18 7"})]})})]}),u&&e.jsx("div",{className:"rv-sidebar-panel",children:u}),e.jsx("nav",{className:"rv-sidebar-nav",children:E.map(i=>e.jsxs("a",{href:i.url,className:`rv-nav-item${i.active?" rv-active":""}`,title:o?i.label:void 0,children:[e.jsx("span",{className:"rv-nav-icon",dangerouslySetInnerHTML:{__html:i.icon}}),!o&&e.jsx("span",{className:"rv-nav-label",children:i.label})]},i.url))}),e.jsxs("div",{className:"rv-sidebar-user",children:[e.jsx("div",{className:"rv-user-avatar",children:j}),!o&&e.jsx("div",{className:"rv-user-info",children:e.jsx("span",{className:"rv-user-email",title:s?.email??"",children:s?.email})}),e.jsx("button",{className:"rv-logout-btn",title:"Sign out",onClick:()=>L(!0),children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})]})]}),e.jsxs("div",{className:"rv-shell-body",children:[A&&e.jsx("header",{className:"rv-shell-header",children:h!==void 0?h:e.jsx(b,{value:c??"",venues:t,onChange:v??(()=>{})})}),e.jsx("main",{className:`rv-shell-content${r?" rv-shell-content--scroll":" rv-shell-content--fill"}`,children:l})]}),e.jsx(k,{open:_,title:"Sign out",message:"Are you sure you want to sign out?",confirmLabel:"Sign out",onConfirm:f,onCancel:()=>L(!1)})]})}d.AppShell=$,d.ConfirmModal=k,d.VenueSwitcher=b,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@re-venue/ui-core-react",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/ui-core-react.umd.cjs",
6
+ "module": "./dist/ui-core-react.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/ui-core-react.js",
11
+ "require": "./dist/ui-core-react.umd.cjs"
12
+ },
13
+ "./dist/ui-core-react.css": "./dist/ui-core-react.css"
14
+ },
15
+ "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc -p tsconfig.app.json --noEmit && vite build",
25
+ "type-check": "tsc -p tsconfig.app.json --noEmit"
26
+ },
27
+ "peerDependencies": {
28
+ "react": "^18.0.0",
29
+ "react-dom": "^18.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/react": "^18.3.0",
33
+ "@types/react-dom": "^18.3.0",
34
+ "@vitejs/plugin-react": "^4.5.0",
35
+ "react": "^18.3.0",
36
+ "react-dom": "^18.3.0",
37
+ "vite-plugin-dts": "^4.5.4"
38
+ }
39
+ }
@@ -0,0 +1,196 @@
1
+ import { useMemo, useState } from 'react'
2
+ import type { ReactNode } from 'react'
3
+ import { ConfirmModal } from './ConfirmModal'
4
+ import { VenueSwitcher } from './VenueSwitcher'
5
+ import type { AuthUser, SidebarNavItem, Venue } from '../types'
6
+ import '../styles/shell.css'
7
+
8
+ interface Props {
9
+ user: AuthUser | null
10
+ isAdmin: boolean
11
+ venues: Venue[]
12
+ activeVenueId: string | null
13
+ navItems: SidebarNavItem[]
14
+ cookieDomain?: string
15
+ onSwitchVenue?: (venueId: string) => void
16
+ onLogout: () => void
17
+ headerSlot?: ReactNode
18
+ sidebarPanel?: ReactNode
19
+ scrollable?: boolean
20
+ children: ReactNode
21
+ }
22
+
23
+ const SIDEBAR_COOKIE = 'rv_sidebar_collapsed'
24
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 365
25
+
26
+ function readSidebarCookie(): boolean {
27
+ const prefix = `${SIDEBAR_COOKIE}=`
28
+ for (const part of document.cookie.split(';')) {
29
+ const trimmed = part.trim()
30
+ if (trimmed.startsWith(prefix)) return decodeURIComponent(trimmed.slice(prefix.length)) === 'true'
31
+ }
32
+ return false
33
+ }
34
+
35
+ function writeSidebarCookie(value: boolean, cookieDomain?: string): void {
36
+ const domainPart = cookieDomain ? `; Domain=${cookieDomain}` : ''
37
+ document.cookie = `${SIDEBAR_COOKIE}=${value}; Path=/; Max-Age=${SIDEBAR_COOKIE_MAX_AGE}; SameSite=Lax${domainPart}`
38
+ }
39
+
40
+ export function AppShell({
41
+ user,
42
+ isAdmin,
43
+ venues,
44
+ activeVenueId,
45
+ navItems,
46
+ cookieDomain,
47
+ onSwitchVenue,
48
+ onLogout,
49
+ headerSlot,
50
+ sidebarPanel,
51
+ scrollable = true,
52
+ children,
53
+ }: Props) {
54
+ const [collapsed, setCollapsed] = useState(() => readSidebarCookie())
55
+ const [showLogoutConfirm, setShowLogoutConfirm] = useState(false)
56
+
57
+ function toggleCollapse() {
58
+ const next = !collapsed
59
+ setCollapsed(next)
60
+ writeSidebarCookie(next, cookieDomain)
61
+ }
62
+
63
+ const activeVenue = useMemo(() => venues.find((v) => v.id === activeVenueId), [venues, activeVenueId])
64
+ const workspaceName = activeVenue?.workspace?.name ?? ''
65
+
66
+ const userInitials = useMemo(() => {
67
+ if (!user?.email) return '?'
68
+ return user.email.slice(0, 2).toUpperCase()
69
+ }, [user?.email])
70
+
71
+ const visibleNavItems = useMemo(() => {
72
+ const activeWorkspaceId = activeVenue?.workspace?.id
73
+ return navItems.filter((item) => {
74
+ if (!item.permission) return true
75
+ if (isAdmin) return true
76
+ if (user?.globalPermissions.includes(item.permission)) return true
77
+ if (activeWorkspaceId && user?.workspacePermissions?.[activeWorkspaceId]?.includes(item.permission)) return true
78
+ if (activeVenueId && user?.venuePermissions?.[activeVenueId]?.includes(item.permission)) return true
79
+ return false
80
+ })
81
+ }, [navItems, isAdmin, user, activeVenue, activeVenueId])
82
+
83
+ const showHeader = venues.length > 0 || headerSlot !== undefined
84
+
85
+ return (
86
+ <div className="rv-app-shell">
87
+ <aside className={`rv-sidebar${collapsed ? ' rv-collapsed' : ''}`}>
88
+ <div className="rv-sidebar-top">
89
+ {!collapsed && (
90
+ <div className="rv-sidebar-brand">
91
+ <svg
92
+ className="rv-sidebar-logo"
93
+ viewBox="0 0 429 50"
94
+ fill="none"
95
+ xmlns="http://www.w3.org/2000/svg"
96
+ aria-label="Re-venue"
97
+ >
98
+ <g clipPath="url(#rv-logo-clip)">
99
+ <path d="M24.946 0.60506C24.6367 1.30638 24.2289 3.01155 24.2289 7.32948V8.73212L23.5117 9.22717C22.3867 8.12706 20.2212 7.61826 18.4775 7.61826C11.9105 7.61826 8.0013 13.6414 8.0013 21.3696V35.0247C8.0013 41.0479 8.09974 45.6683 8.4091 48.9824C6.86228 48.6799 5.54045 48.4736 4.303 48.4736C2.96711 48.4736 1.63122 48.6799 -0.0140381 48.9824C0.295326 46.2734 0.39376 42.9593 0.39376 38.2426V15.8691C0.407822 11.5512 0.309388 4.0154 2.39182e-05 1.00385C1.95464 1.40264 3.0796 1.4989 4.31706 1.4989C5.55452 1.4989 6.89041 1.29263 8.42316 1.00385L8.01537 6.0231C7.91693 7.12321 7.91693 8.73212 7.91693 10.7398L8.12786 10.8361C12.1215 3.61661 16.8322 0 21.768 0C23.0055 0 23.7226 0.206271 24.946 0.60506Z" fill="currentColor" />
100
+ <path d="M74.7396 20.5858V22.291L74.5287 24.3949C68.3695 24.2987 61.6901 24.0924 54.4059 24.0924C49.4842 24.0924 44.3376 24.2987 39.1065 24.3949C39.0081 24.9037 39.0081 26.3064 39.0081 26.6089C39.0081 39.0539 46.4047 45.7921 56.6699 45.7921C61.901 45.7921 68.1727 42.9868 72.1663 38.6689L72.6866 38.9714L72.0678 43.8944C66.7243 47.9098 60.2557 50.0137 54.8137 50.0137C40.5408 50.0137 29.9662 40.0715 29.9662 26.3201C29.9802 9.84598 38.6003 0 53.4919 0C66.6399 0 74.7396 8.12706 74.7396 20.5858ZM52.6623 20.8883C56.2621 20.8883 62.3088 20.5858 66.3165 20.5858C66.218 9.03465 61.9994 3.21782 53.6888 3.21782C45.3781 3.21782 40.4424 9.74972 39.3174 20.5858C43.3251 20.5858 51.017 20.8883 52.6623 20.8883Z" fill="currentColor" />
101
+ <path d="M164.989 22.9923V27.709H82.8533V22.9923H164.989Z" fill="currentColor" />
102
+ <path d="M172.274 1.51265C173.82 1.51265 175.142 1.30638 176.788 1.0176C180.992 14.1639 185.928 26.8152 192.087 40.1815C195.687 32.852 198.148 26.8289 207.794 1.0176C208.821 1.32013 209.847 1.51265 210.972 1.51265C212.21 1.51265 213.025 1.30638 214.15 1.0176L203.477 24.615C199.779 32.9483 196.502 40.9791 193.521 49.0099C192.495 48.7074 191.468 48.5011 190.343 48.5011C189.106 48.5011 188.6 48.5974 187.053 49.0099C180.486 32.5495 174.636 17.1755 167.141 1.0176C169.292 1.41639 170.741 1.51265 172.274 1.51265Z" fill="currentColor" />
103
+ <path d="M263.452 20.5858V22.291L263.241 24.3949C257.082 24.2987 250.402 24.0924 243.118 24.0924C238.196 24.0924 233.05 24.2987 227.819 24.3949C227.72 24.9037 227.72 26.3064 227.72 26.6089C227.72 39.0539 235.117 45.7921 245.382 45.7921C250.613 45.7921 256.885 42.9868 260.878 38.6689L261.399 38.9714L260.78 43.8944C255.436 47.9098 248.968 50.0138 243.526 50.0138C229.253 50.0138 218.678 40.0715 218.678 26.3201C218.678 9.85973 227.298 0.0137513 242.19 0.0137513C255.338 0.0137513 263.438 8.14081 263.438 20.5996L263.452 20.5858ZM241.374 20.8883C244.974 20.8883 251.021 20.5858 255.029 20.5858C254.93 9.03465 250.711 3.21782 242.401 3.21782C234.09 3.21782 229.154 9.74972 228.029 20.5858C232.037 20.5858 239.729 20.8883 241.374 20.8883Z" fill="currentColor" />
104
+ <path d="M315.706 17.7668C315.706 23.0886 315.298 28.9054 315.298 36.5374C315.298 45.3795 315.509 47.181 315.509 48.9824C313.765 48.5836 312.528 48.4736 311.192 48.4736C309.856 48.4736 308.619 48.5699 306.988 48.9824C306.988 43.2618 307.705 34.2272 307.705 27.6953V19.967C307.705 11.6337 303.908 5.21177 296.413 5.21177C287.371 5.21177 282.66 10.8361 282.66 21.2734V33.3196C282.66 37.6375 282.97 44.4582 283.476 48.9824C281.831 48.6799 280.396 48.4736 278.85 48.4736C277.303 48.4736 275.868 48.6799 274.223 48.9824C275.039 42.6568 275.039 35.3273 275.039 31.3119V17.753C275.039 11.7299 274.729 6.20187 274.223 0.990099C275.967 1.38889 277.514 1.48515 278.85 1.48515C279.876 1.48515 281.212 1.27888 282.956 0.990099C282.857 2.69527 282.646 6.61441 282.646 9.0209H282.857C286.654 3.30033 291.787 -0.0137513 299.183 -0.0137513C309.448 -0.0137513 315.72 5.70682 315.72 17.753L315.706 17.7668Z" fill="currentColor" />
105
+ <path d="M331.413 1.00385C333.157 1.30638 334.591 1.4989 335.73 1.4989C336.968 1.4989 338.304 1.29263 339.935 1.00385C339.218 9.43344 338.908 19.6782 338.908 28.9191C338.908 31.4356 338.908 37.6513 341.889 40.7728C343.844 43.0831 346.924 44.7882 350.931 44.7882C356.584 44.7882 359.861 42.3817 361.815 39.2602C364.276 35.2448 364.487 32.2332 364.487 21.3834C364.487 11.2486 364.389 3.10781 364.276 1.00385C366.02 1.40264 367.257 1.4989 368.593 1.4989C370.14 1.4989 371.265 1.40264 372.798 1.00385C372.39 7.42574 372.081 17.368 372.081 31.1194C372.081 38.8476 372.179 44.2657 372.488 48.9961C370.942 48.6936 369.62 48.4873 368.481 48.4873C367.342 48.4873 366.02 48.6936 364.473 48.9961C364.571 47.6898 364.684 45.4758 364.684 43.9769V40.3603H364.473C360.873 46.7822 355.023 50 348.456 50C337.783 50 331.315 44.3757 331.315 33.1271C331.315 29.0154 331.624 19.7745 331.624 16.5567C331.624 11.3311 331.526 6.21562 331.413 0.990099V1.00385Z" fill="currentColor" />
106
+ <path d="M428.947 20.5858V22.291L428.736 24.3949C422.577 24.2987 415.898 24.0924 408.614 24.0924C403.692 24.0924 398.545 24.2987 393.314 24.3949C393.216 24.9037 393.216 26.3064 393.216 26.6089C393.216 39.0539 400.612 45.7921 410.878 45.7921C416.109 45.7921 422.38 42.9868 426.374 38.6689L426.894 38.9714L426.276 43.8944C420.932 47.9098 414.463 50.0138 409.021 50.0138C394.749 50.0138 384.174 40.0715 384.174 26.3201C384.174 9.85973 392.794 0.0137513 407.686 0.0137513C420.834 0.0137513 428.933 8.14081 428.933 20.5996L428.947 20.5858ZM406.87 20.8883C410.47 20.8883 416.517 20.5858 420.524 20.5858C420.426 9.03465 416.207 3.21782 407.897 3.21782C399.586 3.21782 394.65 9.74972 393.525 20.5858C397.533 20.5858 405.225 20.8883 406.87 20.8883Z" fill="currentColor" />
107
+ </g>
108
+ <defs>
109
+ <clipPath id="rv-logo-clip">
110
+ <rect width="428.947" height="50" fill="white" />
111
+ </clipPath>
112
+ </defs>
113
+ </svg>
114
+ {workspaceName && <span className="rv-sidebar-workspace">{workspaceName}</span>}
115
+ </div>
116
+ )}
117
+ <button
118
+ className="rv-collapse-toggle"
119
+ title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
120
+ onClick={toggleCollapse}
121
+ >
122
+ {collapsed ? (
123
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
124
+ <polyline points="13 17 18 12 13 7" />
125
+ <polyline points="6 17 11 12 6 7" />
126
+ </svg>
127
+ ) : (
128
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
129
+ <polyline points="11 17 6 12 11 7" />
130
+ <polyline points="18 17 13 12 18 7" />
131
+ </svg>
132
+ )}
133
+ </button>
134
+ </div>
135
+
136
+ {sidebarPanel && <div className="rv-sidebar-panel">{sidebarPanel}</div>}
137
+
138
+ <nav className="rv-sidebar-nav">
139
+ {visibleNavItems.map((item) => (
140
+ <a
141
+ key={item.url}
142
+ href={item.url}
143
+ className={`rv-nav-item${item.active ? ' rv-active' : ''}`}
144
+ title={collapsed ? item.label : undefined}
145
+ >
146
+ <span className="rv-nav-icon" dangerouslySetInnerHTML={{ __html: item.icon }} />
147
+ {!collapsed && <span className="rv-nav-label">{item.label}</span>}
148
+ </a>
149
+ ))}
150
+ </nav>
151
+
152
+ <div className="rv-sidebar-user">
153
+ <div className="rv-user-avatar">{userInitials}</div>
154
+ {!collapsed && (
155
+ <div className="rv-user-info">
156
+ <span className="rv-user-email" title={user?.email ?? ''}>{user?.email}</span>
157
+ </div>
158
+ )}
159
+ <button className="rv-logout-btn" title="Sign out" onClick={() => setShowLogoutConfirm(true)}>
160
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
161
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
162
+ <polyline points="16 17 21 12 16 7" />
163
+ <line x1="21" y1="12" x2="9" y2="12" />
164
+ </svg>
165
+ </button>
166
+ </div>
167
+ </aside>
168
+
169
+ <div className="rv-shell-body">
170
+ {showHeader && (
171
+ <header className="rv-shell-header">
172
+ {headerSlot !== undefined ? headerSlot : (
173
+ <VenueSwitcher
174
+ value={activeVenueId ?? ''}
175
+ venues={venues}
176
+ onChange={onSwitchVenue ?? (() => undefined)}
177
+ />
178
+ )}
179
+ </header>
180
+ )}
181
+ <main className={`rv-shell-content${scrollable ? ' rv-shell-content--scroll' : ' rv-shell-content--fill'}`}>
182
+ {children}
183
+ </main>
184
+ </div>
185
+
186
+ <ConfirmModal
187
+ open={showLogoutConfirm}
188
+ title="Sign out"
189
+ message="Are you sure you want to sign out?"
190
+ confirmLabel="Sign out"
191
+ onConfirm={onLogout}
192
+ onCancel={() => setShowLogoutConfirm(false)}
193
+ />
194
+ </div>
195
+ )
196
+ }
@@ -0,0 +1,60 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+ import { createPortal } from 'react-dom'
3
+
4
+ interface Props {
5
+ open: boolean
6
+ title?: string
7
+ message?: string
8
+ confirmLabel?: string
9
+ loading?: boolean
10
+ onConfirm: () => void
11
+ onCancel: () => void
12
+ }
13
+
14
+ export function ConfirmModal({
15
+ open,
16
+ title = 'Are you sure?',
17
+ message = 'This action cannot be undone.',
18
+ confirmLabel = 'Confirm',
19
+ loading = false,
20
+ onConfirm,
21
+ onCancel,
22
+ }: Props) {
23
+ const [visible, setVisible] = useState(false)
24
+ const [mounted, setMounted] = useState(false)
25
+ const titleId = useRef(`rv-confirm-${Math.random().toString(36).slice(2)}`).current
26
+
27
+ useEffect(() => {
28
+ if (open) {
29
+ setMounted(true)
30
+ requestAnimationFrame(() => setVisible(true))
31
+ } else {
32
+ setVisible(false)
33
+ const timer = setTimeout(() => setMounted(false), 200)
34
+ return () => clearTimeout(timer)
35
+ }
36
+ }, [open])
37
+
38
+ if (!mounted) return null
39
+
40
+ return createPortal(
41
+ <div
42
+ className={`rv-modal-backdrop${visible ? ' rv-modal-visible' : ''}`}
43
+ onClick={(e) => { if (e.target === e.currentTarget) onCancel() }}
44
+ >
45
+ <div className="rv-modal-dialog" role="dialog" aria-modal="true" aria-labelledby={titleId}>
46
+ <h2 id={titleId} className="rv-modal-title">{title}</h2>
47
+ <p className="rv-modal-body">{message}</p>
48
+ <div className="rv-modal-actions">
49
+ <button className="rv-modal-btn rv-modal-btn-ghost" onClick={onCancel} disabled={loading}>
50
+ Cancel
51
+ </button>
52
+ <button className="rv-modal-btn rv-modal-btn-danger" onClick={onConfirm} disabled={loading}>
53
+ {confirmLabel}
54
+ </button>
55
+ </div>
56
+ </div>
57
+ </div>,
58
+ document.body,
59
+ )
60
+ }
@@ -0,0 +1,92 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react'
2
+ import type { Venue } from '../types'
3
+
4
+ interface Props {
5
+ value: string
6
+ venues: Venue[]
7
+ onChange: (id: string) => void
8
+ }
9
+
10
+ export function VenueSwitcher({ value, venues, onChange }: Props) {
11
+ const [open, setOpen] = useState(false)
12
+ const rootRef = useRef<HTMLDivElement>(null)
13
+
14
+ const activeVenue = useMemo(() => venues.find((v) => v.id === value), [venues, value])
15
+
16
+ const workspaceGroups = useMemo(() => {
17
+ const groups = new Map<string, { workspaceName: string; venues: Venue[] }>()
18
+ for (const venue of venues) {
19
+ const key = venue.workspace?.id ?? '__none__'
20
+ const name = venue.workspace?.name ?? ''
21
+ if (!groups.has(key)) groups.set(key, { workspaceName: name, venues: [] })
22
+ groups.get(key)!.venues.push(venue)
23
+ }
24
+ return [...groups.values()]
25
+ }, [venues])
26
+
27
+ const multiWorkspace = workspaceGroups.length > 1
28
+
29
+ useEffect(() => {
30
+ if (!open) return
31
+ function onClickOutside(e: MouseEvent) {
32
+ if (rootRef.current && !rootRef.current.contains(e.target as Node)) {
33
+ setOpen(false)
34
+ }
35
+ }
36
+ document.addEventListener('mousedown', onClickOutside)
37
+ return () => document.removeEventListener('mousedown', onClickOutside)
38
+ }, [open])
39
+
40
+ function select(id: string) {
41
+ onChange(id)
42
+ setOpen(false)
43
+ }
44
+
45
+ return (
46
+ <div ref={rootRef} className="rv-venue-switcher">
47
+ <button className={`rv-vs-trigger${open ? ' rv-open' : ''}`} onClick={() => setOpen((o) => !o)}>
48
+ <span className="rv-vs-label">
49
+ <span className="rv-vs-venue">{activeVenue?.name ?? 'Select venue'}</span>
50
+ {activeVenue?.workspace && multiWorkspace && (
51
+ <span className="rv-vs-workspace">{activeVenue.workspace.name}</span>
52
+ )}
53
+ </span>
54
+ <svg
55
+ className="rv-vs-chevron"
56
+ xmlns="http://www.w3.org/2000/svg"
57
+ width="14"
58
+ height="14"
59
+ viewBox="0 0 24 24"
60
+ fill="none"
61
+ stroke="currentColor"
62
+ strokeWidth="2.5"
63
+ strokeLinecap="round"
64
+ strokeLinejoin="round"
65
+ >
66
+ <polyline points="6 9 12 15 18 9" />
67
+ </svg>
68
+ </button>
69
+
70
+ {open && (
71
+ <div className="rv-vs-dropdown">
72
+ {workspaceGroups.map((group) => (
73
+ <div key={group.workspaceName}>
74
+ {multiWorkspace && (
75
+ <div className="rv-vs-workspace-header">{group.workspaceName}</div>
76
+ )}
77
+ {group.venues.map((venue) => (
78
+ <button
79
+ key={venue.id}
80
+ className={`rv-vs-venue-option${venue.id === value ? ' rv-active' : ''}`}
81
+ onClick={() => select(venue.id)}
82
+ >
83
+ {venue.name}
84
+ </button>
85
+ ))}
86
+ </div>
87
+ ))}
88
+ </div>
89
+ )}
90
+ </div>
91
+ )
92
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { AppShell } from './components/AppShell'
2
+ export { VenueSwitcher } from './components/VenueSwitcher'
3
+ export { ConfirmModal } from './components/ConfirmModal'
4
+ export type { AuthUser, Venue, SidebarNavItem } from './types'
@@ -0,0 +1,473 @@
1
+ .rv-app-shell {
2
+ display: flex;
3
+ height: 100dvh;
4
+ overflow: hidden;
5
+ font-family: 'Host Grotesk', system-ui, sans-serif;
6
+ }
7
+
8
+ .rv-sidebar {
9
+ width: 280px;
10
+ flex-shrink: 0;
11
+ display: flex;
12
+ flex-direction: column;
13
+ background: var(--color-bg-panel, #ffffff);
14
+ border-right: 1px solid var(--color-border-subtle, #d1d5db);
15
+ transition: width var(--transition-slow, 0.25s ease);
16
+ overflow: hidden;
17
+ }
18
+
19
+ .rv-sidebar.rv-collapsed {
20
+ width: 56px;
21
+ }
22
+
23
+ .rv-sidebar.rv-collapsed .rv-sidebar-top {
24
+ justify-content: center;
25
+ padding: 0;
26
+ }
27
+
28
+ .rv-sidebar.rv-collapsed .rv-sidebar-nav {
29
+ padding: 0.5rem 0;
30
+ align-items: center;
31
+ }
32
+
33
+ .rv-sidebar.rv-collapsed .rv-nav-item {
34
+ justify-content: center;
35
+ padding: 0.625rem 0;
36
+ width: 100%;
37
+ }
38
+
39
+ .rv-sidebar.rv-collapsed .rv-sidebar-user {
40
+ flex-direction: column;
41
+ align-items: center;
42
+ gap: 0.5rem;
43
+ padding: 0.75rem 0;
44
+ }
45
+
46
+ .rv-sidebar.rv-collapsed .rv-logout-btn {
47
+ margin-left: 0;
48
+ }
49
+
50
+ .rv-sidebar-top {
51
+ display: flex;
52
+ align-items: center;
53
+ gap: 0.5rem;
54
+ padding: 0 0.875rem;
55
+ border-bottom: 1px solid var(--color-border-subtle, #d1d5db);
56
+ height: 64px;
57
+ flex-shrink: 0;
58
+ }
59
+
60
+ .rv-sidebar-brand {
61
+ flex: 1;
62
+ display: flex;
63
+ flex-direction: column;
64
+ gap: 0.25rem;
65
+ min-width: 0;
66
+ }
67
+
68
+ .rv-sidebar-logo {
69
+ width: 90px;
70
+ height: auto;
71
+ color: var(--color-text-primary, #111111);
72
+ }
73
+
74
+ .rv-sidebar-workspace {
75
+ font-size: 0.8rem;
76
+ font-weight: 600;
77
+ color: var(--color-text-secondary, #444444);
78
+ white-space: nowrap;
79
+ overflow: hidden;
80
+ text-overflow: ellipsis;
81
+ }
82
+
83
+ .rv-collapse-toggle {
84
+ flex-shrink: 0;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ width: 28px;
89
+ height: 28px;
90
+ border: none;
91
+ background: none;
92
+ border-radius: var(--radius-sm, 4px);
93
+ cursor: pointer;
94
+ color: var(--color-text-muted, #777777);
95
+ transition: background var(--transition-fast, 0.1s ease), color var(--transition-fast, 0.1s ease);
96
+ }
97
+
98
+ .rv-collapse-toggle:hover {
99
+ background: var(--color-bg-surface, #f0f0f0);
100
+ color: var(--color-text-secondary, #444444);
101
+ }
102
+
103
+ .rv-sidebar-panel {
104
+ border-bottom: 1px solid var(--color-border-subtle, #d1d5db);
105
+ overflow: hidden;
106
+ }
107
+
108
+ .rv-sidebar-nav {
109
+ flex: 1;
110
+ display: flex;
111
+ flex-direction: column;
112
+ gap: 2px;
113
+ padding: 0.625rem 0.5rem;
114
+ overflow-y: auto;
115
+ }
116
+
117
+ .rv-nav-item {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 0.625rem;
121
+ padding: 0.5rem 0.625rem;
122
+ border-radius: var(--radius-md, 8px);
123
+ color: var(--color-text-secondary, #444444);
124
+ text-decoration: none;
125
+ font-size: 0.875rem;
126
+ font-weight: 400;
127
+ transition: background var(--transition-fast, 0.1s ease), color var(--transition-fast, 0.1s ease);
128
+ white-space: nowrap;
129
+ }
130
+
131
+ .rv-nav-item:hover {
132
+ background: var(--color-bg-surface, #f0f0f0);
133
+ color: var(--color-text-primary, #111111);
134
+ }
135
+
136
+ .rv-nav-item.rv-active {
137
+ background: var(--color-primary-focus, rgba(22, 163, 74, 0.1));
138
+ color: var(--color-primary, #16a34a);
139
+ font-weight: 600;
140
+ }
141
+
142
+ .rv-nav-icon {
143
+ width: 18px;
144
+ height: 18px;
145
+ flex-shrink: 0;
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ }
150
+
151
+ .rv-nav-icon svg {
152
+ width: 18px;
153
+ height: 18px;
154
+ }
155
+
156
+ .rv-nav-label {
157
+ flex: 1;
158
+ overflow: hidden;
159
+ text-overflow: ellipsis;
160
+ }
161
+
162
+ .rv-sidebar-user {
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 0.5rem;
166
+ padding: 0.75rem;
167
+ border-top: 1px solid var(--color-border-subtle, #d1d5db);
168
+ flex-shrink: 0;
169
+ }
170
+
171
+ .rv-user-avatar {
172
+ width: 28px;
173
+ height: 28px;
174
+ border-radius: var(--radius-full, 999px);
175
+ background: var(--color-primary-focus, rgba(22, 163, 74, 0.1));
176
+ color: var(--color-primary, #16a34a);
177
+ font-size: 0.65rem;
178
+ font-weight: 700;
179
+ display: flex;
180
+ align-items: center;
181
+ justify-content: center;
182
+ flex-shrink: 0;
183
+ letter-spacing: 0.02em;
184
+ }
185
+
186
+ .rv-user-info {
187
+ flex: 1;
188
+ min-width: 0;
189
+ display: flex;
190
+ flex-direction: column;
191
+ }
192
+
193
+ .rv-user-email {
194
+ font-size: 0.875rem;
195
+ font-weight: 400;
196
+ color: var(--color-text-secondary, #444444);
197
+ white-space: nowrap;
198
+ overflow: hidden;
199
+ text-overflow: ellipsis;
200
+ }
201
+
202
+ .rv-logout-btn {
203
+ flex-shrink: 0;
204
+ display: flex;
205
+ align-items: center;
206
+ justify-content: center;
207
+ margin-left: auto;
208
+ border: none;
209
+ background: none;
210
+ cursor: pointer;
211
+ color: var(--color-text-muted, #777777);
212
+ border-radius: var(--radius-sm, 4px);
213
+ padding: 4px;
214
+ transition: background var(--transition-fast, 0.1s ease), color var(--transition-fast, 0.1s ease);
215
+ }
216
+
217
+ .rv-logout-btn:hover {
218
+ background: var(--color-bg-surface, #f0f0f0);
219
+ color: var(--color-text-secondary, #444444);
220
+ }
221
+
222
+ .rv-shell-body {
223
+ flex: 1;
224
+ display: flex;
225
+ flex-direction: column;
226
+ overflow: hidden;
227
+ min-width: 0;
228
+ min-height: 0;
229
+ }
230
+
231
+ .rv-shell-header {
232
+ height: 64px;
233
+ flex-shrink: 0;
234
+ display: flex;
235
+ align-items: center;
236
+ padding: 0 1.25rem;
237
+ border-bottom: 1px solid var(--color-border-subtle, #d1d5db);
238
+ background: var(--color-bg-panel, #ffffff);
239
+ }
240
+
241
+ .rv-shell-content {
242
+ flex: 1;
243
+ min-height: 0;
244
+ background: var(--color-bg-base, #f9f8f6);
245
+ }
246
+
247
+ .rv-shell-content--scroll {
248
+ overflow-y: auto;
249
+ }
250
+
251
+ .rv-shell-content--fill {
252
+ overflow: hidden;
253
+ display: flex;
254
+ flex-direction: column;
255
+ }
256
+
257
+ /* VenueSwitcher */
258
+ .rv-venue-switcher {
259
+ position: relative;
260
+ }
261
+
262
+ .rv-vs-trigger {
263
+ display: flex;
264
+ align-items: center;
265
+ gap: 0.5rem;
266
+ padding: 0.4rem 0.65rem;
267
+ border: 1px solid var(--color-border-subtle, #d1d5db);
268
+ border-radius: 8px;
269
+ background: var(--color-bg-panel, #ffffff);
270
+ cursor: pointer;
271
+ font-size: 0.875rem;
272
+ font-weight: 400;
273
+ color: var(--color-text-primary, #111111);
274
+ transition: border-color 0.15s, background 0.15s;
275
+ min-width: 140px;
276
+ max-width: 220px;
277
+ font-family: inherit;
278
+ }
279
+
280
+ .rv-vs-trigger:hover {
281
+ background: var(--color-bg-surface, #f0f0f0);
282
+ }
283
+
284
+ .rv-vs-trigger.rv-open {
285
+ border-color: var(--color-primary, #16a34a);
286
+ outline: none;
287
+ }
288
+
289
+ .rv-vs-label {
290
+ flex: 1;
291
+ display: flex;
292
+ flex-direction: column;
293
+ align-items: flex-start;
294
+ gap: 0.05rem;
295
+ overflow: hidden;
296
+ }
297
+
298
+ .rv-vs-venue {
299
+ font-weight: 600;
300
+ white-space: nowrap;
301
+ overflow: hidden;
302
+ text-overflow: ellipsis;
303
+ max-width: 100%;
304
+ }
305
+
306
+ .rv-vs-workspace {
307
+ font-size: 0.7rem;
308
+ font-weight: 400;
309
+ color: var(--color-text-muted, #777777);
310
+ white-space: nowrap;
311
+ overflow: hidden;
312
+ text-overflow: ellipsis;
313
+ max-width: 100%;
314
+ }
315
+
316
+ .rv-vs-chevron {
317
+ flex-shrink: 0;
318
+ color: var(--color-text-muted, #777777);
319
+ transition: transform 0.15s;
320
+ }
321
+
322
+ .rv-vs-trigger.rv-open .rv-vs-chevron {
323
+ transform: rotate(180deg);
324
+ }
325
+
326
+ .rv-vs-dropdown {
327
+ position: absolute;
328
+ top: calc(100% + 6px);
329
+ left: 0;
330
+ min-width: 100%;
331
+ width: max-content;
332
+ max-width: 280px;
333
+ background: var(--color-bg-panel, #ffffff);
334
+ border: 1px solid var(--color-border-subtle, #d1d5db);
335
+ border-radius: 10px;
336
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
337
+ max-height: min(360px, 80dvh);
338
+ overflow-y: auto;
339
+ overscroll-behavior: contain;
340
+ z-index: 200;
341
+ padding: 0.3rem;
342
+ }
343
+
344
+ .rv-vs-workspace-header {
345
+ padding: 0.45rem 0.65rem 0.25rem;
346
+ font-size: 0.7rem;
347
+ font-weight: 700;
348
+ color: var(--color-text-muted, #777777);
349
+ text-transform: uppercase;
350
+ letter-spacing: 0.06em;
351
+ }
352
+
353
+ .rv-vs-workspace-header + .rv-vs-workspace-header,
354
+ .rv-vs-venue-option + .rv-vs-workspace-header {
355
+ border-top: 1px solid var(--color-border-muted, #e5e7eb);
356
+ margin-top: 0.25rem;
357
+ padding-top: 0.6rem;
358
+ }
359
+
360
+ .rv-vs-venue-option {
361
+ display: block;
362
+ width: 100%;
363
+ text-align: left;
364
+ padding: 0.5rem 0.65rem;
365
+ font-size: 0.875rem;
366
+ font-weight: 400;
367
+ color: var(--color-text-secondary, #444444);
368
+ border: none;
369
+ background: none;
370
+ border-radius: 6px;
371
+ cursor: pointer;
372
+ transition: background 0.1s;
373
+ font-family: inherit;
374
+ }
375
+
376
+ .rv-vs-venue-option:hover {
377
+ background: var(--color-bg-surface, #f0f0f0);
378
+ }
379
+
380
+ .rv-vs-venue-option.rv-active {
381
+ background: var(--color-primary-focus, rgba(22, 163, 74, 0.1));
382
+ color: var(--color-primary, #16a34a);
383
+ font-weight: 600;
384
+ }
385
+
386
+ /* ConfirmModal */
387
+ .rv-modal-backdrop {
388
+ position: fixed;
389
+ inset: 0;
390
+ background: rgba(0, 0, 0, 0.45);
391
+ display: flex;
392
+ align-items: center;
393
+ justify-content: center;
394
+ z-index: 1000;
395
+ padding: 1rem;
396
+ opacity: 0;
397
+ transition: opacity 0.2s ease;
398
+ }
399
+
400
+ .rv-modal-backdrop.rv-modal-visible {
401
+ opacity: 1;
402
+ }
403
+
404
+ .rv-modal-dialog {
405
+ background: var(--color-bg-panel, #ffffff);
406
+ border-radius: var(--radius-lg, 12px);
407
+ padding: 2rem;
408
+ max-width: 420px;
409
+ width: 100%;
410
+ box-shadow: var(--shadow-lg, rgba(0, 0, 0, 0.32) 0px 8px 24px);
411
+ transform: scale(0.95) translateY(-8px);
412
+ opacity: 0;
413
+ transition: transform 0.2s ease, opacity 0.2s ease;
414
+ font-family: 'Host Grotesk', system-ui, sans-serif;
415
+ }
416
+
417
+ .rv-modal-backdrop.rv-modal-visible .rv-modal-dialog {
418
+ transform: scale(1) translateY(0);
419
+ opacity: 1;
420
+ }
421
+
422
+ .rv-modal-title {
423
+ font-size: 1.15rem;
424
+ font-weight: 700;
425
+ color: var(--color-text-primary, #111111);
426
+ margin: 0 0 0.75rem;
427
+ }
428
+
429
+ .rv-modal-body {
430
+ font-size: 0.9rem;
431
+ color: var(--color-text-secondary, #444444);
432
+ margin: 0 0 1.5rem;
433
+ line-height: 1.55;
434
+ }
435
+
436
+ .rv-modal-actions {
437
+ display: flex;
438
+ justify-content: flex-end;
439
+ gap: 0.75rem;
440
+ }
441
+
442
+ .rv-modal-btn {
443
+ display: inline-flex;
444
+ align-items: center;
445
+ justify-content: center;
446
+ padding: 0.5rem 1rem;
447
+ font-size: 0.875rem;
448
+ font-weight: 500;
449
+ border-radius: var(--radius-md, 8px);
450
+ cursor: pointer;
451
+ border: none;
452
+ font-family: inherit;
453
+ transition: background 0.15s, color 0.15s;
454
+ }
455
+
456
+ .rv-modal-btn-ghost {
457
+ background: transparent;
458
+ color: var(--color-text-secondary, #444444);
459
+ border: 1px solid var(--color-border-subtle, #d1d5db);
460
+ }
461
+
462
+ .rv-modal-btn-ghost:hover {
463
+ background: var(--color-bg-surface, #f0f0f0);
464
+ }
465
+
466
+ .rv-modal-btn-danger {
467
+ background: var(--color-error, #ef4444);
468
+ color: #ffffff;
469
+ }
470
+
471
+ .rv-modal-btn-danger:hover {
472
+ background: var(--color-error-hover, #dc2626);
473
+ }
package/src/types.ts ADDED
@@ -0,0 +1,25 @@
1
+ export interface AuthUser {
2
+ id: string
3
+ email: string
4
+ globalPermissions: string[]
5
+ workspacePermissions?: Record<string, string[]>
6
+ venuePermissions?: Record<string, string[]>
7
+ }
8
+
9
+ export interface Venue {
10
+ id: string
11
+ name: string
12
+ workspace?: {
13
+ id: string
14
+ name: string
15
+ slug: string | null
16
+ }
17
+ }
18
+
19
+ export interface SidebarNavItem {
20
+ label: string
21
+ url: string
22
+ icon: string
23
+ permission?: string
24
+ active?: boolean
25
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />