@fayz-ai/ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-22J2RTMN.js +1397 -0
- package/dist/chunk-22J2RTMN.js.map +1 -0
- package/dist/chunk-2P7T6QQK.cjs +206 -0
- package/dist/chunk-2P7T6QQK.cjs.map +1 -0
- package/dist/chunk-7TBDPNLY.cjs +649 -0
- package/dist/chunk-7TBDPNLY.cjs.map +1 -0
- package/dist/chunk-CZ6X6PZT.js +1237 -0
- package/dist/chunk-CZ6X6PZT.js.map +1 -0
- package/dist/chunk-D6SXPF4F.cjs +397 -0
- package/dist/chunk-D6SXPF4F.cjs.map +1 -0
- package/dist/chunk-DNYVEOAX.js +11 -0
- package/dist/chunk-DNYVEOAX.js.map +1 -0
- package/dist/chunk-E526FHZ4.js +169 -0
- package/dist/chunk-E526FHZ4.js.map +1 -0
- package/dist/chunk-GE6XUREM.cjs +1277 -0
- package/dist/chunk-GE6XUREM.cjs.map +1 -0
- package/dist/chunk-GFH5HOCO.js +605 -0
- package/dist/chunk-GFH5HOCO.js.map +1 -0
- package/dist/chunk-IWBXYV4U.js +203 -0
- package/dist/chunk-IWBXYV4U.js.map +1 -0
- package/dist/chunk-MYZT2OG7.js +350 -0
- package/dist/chunk-MYZT2OG7.js.map +1 -0
- package/dist/chunk-O5F4LLSL.js +445 -0
- package/dist/chunk-O5F4LLSL.js.map +1 -0
- package/dist/chunk-TDGSY5W6.cjs +474 -0
- package/dist/chunk-TDGSY5W6.cjs.map +1 -0
- package/dist/chunk-VVVZO2LE.cjs +13 -0
- package/dist/chunk-VVVZO2LE.cjs.map +1 -0
- package/dist/chunk-W4XXXJRW.cjs +196 -0
- package/dist/chunk-W4XXXJRW.cjs.map +1 -0
- package/dist/chunk-YB5ZJKNG.cjs +1484 -0
- package/dist/chunk-YB5ZJKNG.cjs.map +1 -0
- package/dist/dashboard/index.cjs +102 -0
- package/dist/dashboard/index.cjs.map +1 -0
- package/dist/dashboard/index.js +5 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/index.cjs +569 -4304
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -4152
- package/dist/index.js.map +1 -1
- package/dist/layout/index.cjs +90 -0
- package/dist/layout/index.cjs.map +1 -0
- package/dist/layout/index.js +5 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/preset.cjs +18 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.js +3 -0
- package/dist/preset.js.map +1 -0
- package/dist/primitives/index.cjs +347 -0
- package/dist/primitives/index.cjs.map +1 -0
- package/dist/primitives/index.js +6 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/theme/index.cjs +41 -0
- package/dist/theme/index.cjs.map +1 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,1277 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkW4XXXJRW_cjs = require('./chunk-W4XXXJRW.cjs');
|
|
4
|
+
var chunkVVVZO2LE_cjs = require('./chunk-VVVZO2LE.cjs');
|
|
5
|
+
var React3 = require('react');
|
|
6
|
+
var lucideReact = require('lucide-react');
|
|
7
|
+
var Tooltip = require('@radix-ui/react-tooltip');
|
|
8
|
+
var zustand = require('zustand');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var Popover = require('@radix-ui/react-popover');
|
|
11
|
+
var reactDom = require('react-dom');
|
|
12
|
+
var core = require('@fayz-ai/core');
|
|
13
|
+
|
|
14
|
+
function _interopNamespace(e) {
|
|
15
|
+
if (e && e.__esModule) return e;
|
|
16
|
+
var n = Object.create(null);
|
|
17
|
+
if (e) {
|
|
18
|
+
Object.keys(e).forEach(function (k) {
|
|
19
|
+
if (k !== 'default') {
|
|
20
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return e[k]; }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
n.default = e;
|
|
29
|
+
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
33
|
+
var Tooltip__namespace = /*#__PURE__*/_interopNamespace(Tooltip);
|
|
34
|
+
var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
35
|
+
|
|
36
|
+
var useLayoutStore = zustand.create((set) => ({
|
|
37
|
+
sidebarOpen: true,
|
|
38
|
+
sidebarCollapsed: false,
|
|
39
|
+
mobileDrawerOpen: false,
|
|
40
|
+
commandPaletteOpen: false,
|
|
41
|
+
toggleSidebar: () => set((state) => ({ sidebarOpen: !state.sidebarOpen })),
|
|
42
|
+
setSidebarCollapsed: (collapsed) => set({ sidebarCollapsed: collapsed }),
|
|
43
|
+
toggleMobileDrawer: () => set((state) => ({ mobileDrawerOpen: !state.mobileDrawerOpen })),
|
|
44
|
+
setCommandPaletteOpen: (open) => set({ commandPaletteOpen: open })
|
|
45
|
+
}));
|
|
46
|
+
var ICON_MAP = {
|
|
47
|
+
Home: lucideReact.Home,
|
|
48
|
+
Users: lucideReact.Users,
|
|
49
|
+
Settings: lucideReact.Settings,
|
|
50
|
+
CreditCard: lucideReact.CreditCard,
|
|
51
|
+
Bell: lucideReact.Bell,
|
|
52
|
+
Calendar: lucideReact.Calendar,
|
|
53
|
+
Package: lucideReact.Package,
|
|
54
|
+
BarChart3: lucideReact.BarChart3,
|
|
55
|
+
FileText: lucideReact.FileText,
|
|
56
|
+
Mail: lucideReact.Mail,
|
|
57
|
+
DollarSign: lucideReact.DollarSign,
|
|
58
|
+
Megaphone: lucideReact.Megaphone,
|
|
59
|
+
ShoppingCart: lucideReact.ShoppingCart,
|
|
60
|
+
Target: lucideReact.Target,
|
|
61
|
+
Wrench: lucideReact.Wrench,
|
|
62
|
+
ClipboardList: lucideReact.ClipboardList,
|
|
63
|
+
Briefcase: lucideReact.Briefcase,
|
|
64
|
+
UserCog: lucideReact.UserCog,
|
|
65
|
+
BookOpen: lucideReact.BookOpen,
|
|
66
|
+
MessageCircle: lucideReact.MessageCircle,
|
|
67
|
+
Globe: lucideReact.Globe,
|
|
68
|
+
Percent: lucideReact.Percent,
|
|
69
|
+
Tag: lucideReact.Tag,
|
|
70
|
+
Camera: lucideReact.Camera,
|
|
71
|
+
UtensilsCrossed: lucideReact.UtensilsCrossed,
|
|
72
|
+
MapPin: lucideReact.MapPin,
|
|
73
|
+
Handshake: lucideReact.Handshake,
|
|
74
|
+
Contact: lucideReact.Contact,
|
|
75
|
+
Building2: lucideReact.Building2,
|
|
76
|
+
Filter: lucideReact.Filter,
|
|
77
|
+
Plus: lucideReact.Plus,
|
|
78
|
+
List: lucideReact.List,
|
|
79
|
+
Search: lucideReact.Search,
|
|
80
|
+
Dog: lucideReact.Dog,
|
|
81
|
+
Cat: lucideReact.Cat,
|
|
82
|
+
PawPrint: lucideReact.PawPrint,
|
|
83
|
+
Heart: lucideReact.Heart,
|
|
84
|
+
LayoutTemplate: lucideReact.LayoutTemplate,
|
|
85
|
+
LeafyGreen: lucideReact.LeafyGreen,
|
|
86
|
+
Apple: lucideReact.Apple,
|
|
87
|
+
Egg: lucideReact.Egg,
|
|
88
|
+
Wheat: lucideReact.Wheat,
|
|
89
|
+
PartyPopper: lucideReact.PartyPopper,
|
|
90
|
+
Radio: lucideReact.Radio,
|
|
91
|
+
CalendarDays: lucideReact.CalendarDays,
|
|
92
|
+
Banknote: lucideReact.Banknote,
|
|
93
|
+
Layers: lucideReact.Layers,
|
|
94
|
+
Music: lucideReact.Music,
|
|
95
|
+
Eye: lucideReact.Eye,
|
|
96
|
+
ListMusic: lucideReact.ListMusic,
|
|
97
|
+
Disc3: lucideReact.Disc3,
|
|
98
|
+
UsersRound: lucideReact.UsersRound,
|
|
99
|
+
Mic: lucideReact.Mic,
|
|
100
|
+
Zap: lucideReact.Zap,
|
|
101
|
+
Award: lucideReact.Award,
|
|
102
|
+
LayoutDashboard: lucideReact.LayoutDashboard,
|
|
103
|
+
MessageSquare: lucideReact.MessageSquare,
|
|
104
|
+
Star: lucideReact.Star,
|
|
105
|
+
Workflow: lucideReact.Workflow
|
|
106
|
+
};
|
|
107
|
+
function getIcon(name) {
|
|
108
|
+
return ICON_MAP[name] ?? lucideReact.Home;
|
|
109
|
+
}
|
|
110
|
+
function NavItem({
|
|
111
|
+
item,
|
|
112
|
+
collapsed,
|
|
113
|
+
isActive,
|
|
114
|
+
onNavigate
|
|
115
|
+
}) {
|
|
116
|
+
const Icon = getIcon(item.icon);
|
|
117
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
+
"button",
|
|
119
|
+
{
|
|
120
|
+
onClick: () => onNavigate(item.route),
|
|
121
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
122
|
+
"flex w-full items-center gap-3 rounded-md px-2.5 py-1.5 text-[13px] font-medium transition-colors",
|
|
123
|
+
"hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground",
|
|
124
|
+
isActive ? "bg-sidebar-accent font-semibold text-sidebar-accent-foreground shadow-sm" : "text-sidebar-foreground/80",
|
|
125
|
+
collapsed && "justify-center px-2"
|
|
126
|
+
),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
129
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: item.label }),
|
|
131
|
+
item.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto rounded-full bg-primary px-2 py-0.5 text-xs font-semibold text-primary-foreground", children: item.badge })
|
|
132
|
+
] })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
if (collapsed) {
|
|
137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip__namespace.Root, { delayDuration: 0, children: [
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Trigger, { asChild: true, children: content }),
|
|
139
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
140
|
+
Tooltip__namespace.Content,
|
|
141
|
+
{
|
|
142
|
+
side: "right",
|
|
143
|
+
sideOffset: 8,
|
|
144
|
+
className: "fayz-glass-surface z-50 rounded-md bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md",
|
|
145
|
+
children: [
|
|
146
|
+
item.label,
|
|
147
|
+
item.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 rounded-full bg-primary px-1.5 py-0.5 text-xs text-primary-foreground", children: item.badge }),
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Arrow, { className: "fill-popover" })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
) })
|
|
152
|
+
] });
|
|
153
|
+
}
|
|
154
|
+
return content;
|
|
155
|
+
}
|
|
156
|
+
function NavGroup({
|
|
157
|
+
item,
|
|
158
|
+
collapsed,
|
|
159
|
+
currentPath,
|
|
160
|
+
onNavigate
|
|
161
|
+
}) {
|
|
162
|
+
const [open, setOpen] = React3__namespace.useState(
|
|
163
|
+
() => item.children?.some((c) => currentPath === c.route || currentPath.startsWith(c.route + "/")) ?? false
|
|
164
|
+
);
|
|
165
|
+
const Icon = getIcon(item.icon);
|
|
166
|
+
const isChildActive = item.children?.some(
|
|
167
|
+
(c) => currentPath === c.route || currentPath.startsWith(c.route + "/")
|
|
168
|
+
);
|
|
169
|
+
if (collapsed) {
|
|
170
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip__namespace.Root, { delayDuration: 0, children: [
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
onClick: () => onNavigate(item.route),
|
|
175
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
176
|
+
"flex w-full items-center justify-center rounded-md px-2 py-2 text-sm font-medium transition-colors",
|
|
177
|
+
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
178
|
+
isChildActive ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-muted"
|
|
179
|
+
),
|
|
180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 shrink-0" })
|
|
181
|
+
}
|
|
182
|
+
) }),
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip__namespace.Content, { side: "right", sideOffset: 8, className: "fayz-glass-surface z-50 rounded-md bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md", children: [
|
|
184
|
+
item.label,
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Arrow, { className: "fill-popover" })
|
|
186
|
+
] }) })
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
onClick: () => setOpen(!open),
|
|
194
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
195
|
+
"flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors",
|
|
196
|
+
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
197
|
+
isChildActive ? "text-sidebar-accent-foreground" : "text-sidebar-muted"
|
|
198
|
+
),
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: item.label }),
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: chunkVVVZO2LE_cjs.cn("h-3.5 w-3.5 shrink-0 transition-transform", open && "rotate-180") })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4 mt-0.5 space-y-0.5 border-l border-sidebar-border/50 pl-3", children: item.children?.map((child) => {
|
|
207
|
+
const ChildIcon = getIcon(child.icon);
|
|
208
|
+
const isActive = currentPath === child.route || currentPath.startsWith(child.route + "/");
|
|
209
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
onClick: () => onNavigate(child.route),
|
|
213
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
214
|
+
"flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-sm transition-colors",
|
|
215
|
+
isActive ? "font-medium text-sidebar-accent-foreground" : "text-sidebar-muted hover:text-sidebar-accent-foreground"
|
|
216
|
+
),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChildIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: child.label })
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
child.id
|
|
223
|
+
);
|
|
224
|
+
}) })
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
function Sidebar({
|
|
228
|
+
navigation,
|
|
229
|
+
logo,
|
|
230
|
+
collapsed,
|
|
231
|
+
onToggle,
|
|
232
|
+
onNavigate,
|
|
233
|
+
currentPath: currentPathProp = "/",
|
|
234
|
+
user: _user,
|
|
235
|
+
orgSwitcher,
|
|
236
|
+
topContent,
|
|
237
|
+
footerContent,
|
|
238
|
+
borderless,
|
|
239
|
+
userMenuSlot,
|
|
240
|
+
notificationSlot,
|
|
241
|
+
unreadCount = 0
|
|
242
|
+
}) {
|
|
243
|
+
const currentPath = currentPathProp;
|
|
244
|
+
const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
|
|
245
|
+
const mainItems = navigation.filter((item) => item.section === "main");
|
|
246
|
+
const secondaryItems = navigation.filter((item) => item.section === "secondary");
|
|
247
|
+
const settingsItems = navigation.filter((item) => item.section === "settings");
|
|
248
|
+
const handleNavigate = (route) => {
|
|
249
|
+
onNavigate?.(route);
|
|
250
|
+
};
|
|
251
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip__namespace.Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
252
|
+
"aside",
|
|
253
|
+
{
|
|
254
|
+
"data-print": "hide",
|
|
255
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
256
|
+
"flex h-full flex-col bg-sidebar text-sidebar-foreground transition-all duration-200",
|
|
257
|
+
!borderless && "border-r border-sidebar-border",
|
|
258
|
+
collapsed ? "w-16" : "w-64"
|
|
259
|
+
),
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
262
|
+
"div",
|
|
263
|
+
{
|
|
264
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
265
|
+
"flex h-14 items-center justify-between px-4",
|
|
266
|
+
!borderless && "border-b border-sidebar-border",
|
|
267
|
+
collapsed && "justify-center px-2"
|
|
268
|
+
),
|
|
269
|
+
children: [
|
|
270
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
271
|
+
logo ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg font-bold", children: "App" }),
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
onClick: onToggle,
|
|
276
|
+
className: "ml-auto rounded-md p-1.5 text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
277
|
+
"aria-label": "Collapse sidebar",
|
|
278
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { className: "h-4 w-4" })
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
] }),
|
|
282
|
+
collapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
283
|
+
"button",
|
|
284
|
+
{
|
|
285
|
+
onClick: onToggle,
|
|
286
|
+
className: "rounded-md p-1.5 text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
287
|
+
"aria-label": "Expand sidebar",
|
|
288
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, { className: "h-4 w-4" })
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex-1 space-y-1 overflow-y-auto p-2", children: [
|
|
295
|
+
topContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 space-y-2", children: topContent }),
|
|
296
|
+
mainItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: mainItems.map(
|
|
297
|
+
(item) => item.children && item.children.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(NavGroup, { item, collapsed, currentPath, onNavigate: handleNavigate }, item.id) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
298
|
+
NavItem,
|
|
299
|
+
{
|
|
300
|
+
item,
|
|
301
|
+
collapsed,
|
|
302
|
+
isActive: currentPath === item.route || currentPath.startsWith(item.route + "/"),
|
|
303
|
+
onNavigate: handleNavigate
|
|
304
|
+
},
|
|
305
|
+
item.id
|
|
306
|
+
)
|
|
307
|
+
) }),
|
|
308
|
+
secondaryItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 space-y-1", children: secondaryItems.map(
|
|
309
|
+
(item) => item.children && item.children.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(NavGroup, { item, collapsed, currentPath, onNavigate: handleNavigate }, item.id) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
NavItem,
|
|
311
|
+
{
|
|
312
|
+
item,
|
|
313
|
+
collapsed,
|
|
314
|
+
isActive: currentPath === item.route || currentPath.startsWith(item.route + "/"),
|
|
315
|
+
onNavigate: handleNavigate
|
|
316
|
+
},
|
|
317
|
+
item.id
|
|
318
|
+
)
|
|
319
|
+
) })
|
|
320
|
+
] }),
|
|
321
|
+
settingsItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVVVZO2LE_cjs.cn("p-2 space-y-1", !borderless && "border-t border-sidebar-border"), children: settingsItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
322
|
+
NavItem,
|
|
323
|
+
{
|
|
324
|
+
item,
|
|
325
|
+
collapsed,
|
|
326
|
+
isActive: currentPath === item.route || currentPath.startsWith(item.route + "/"),
|
|
327
|
+
onNavigate: handleNavigate
|
|
328
|
+
},
|
|
329
|
+
item.id
|
|
330
|
+
)) }),
|
|
331
|
+
footerContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVVVZO2LE_cjs.cn("p-2", !borderless && "border-t border-sidebar-border"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: footerContent }) }),
|
|
332
|
+
orgSwitcher && React3__namespace.isValidElement(orgSwitcher) ? React3__namespace.cloneElement(orgSwitcher, { collapsed }) : orgSwitcher,
|
|
333
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVVVZO2LE_cjs.cn("p-2", !borderless && "border-t border-sidebar-border"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVVVZO2LE_cjs.cn(
|
|
334
|
+
"flex items-center rounded-md",
|
|
335
|
+
collapsed ? "flex-col gap-1" : "gap-1 px-1"
|
|
336
|
+
), children: [
|
|
337
|
+
userMenuSlot,
|
|
338
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
|
|
339
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
onClick: () => setCommandPaletteOpen(true),
|
|
343
|
+
className: "inline-flex shrink-0 items-center justify-center rounded-md p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground",
|
|
344
|
+
"aria-label": "Search",
|
|
345
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4" })
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
notificationSlot ?? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
className: "relative inline-flex shrink-0 items-center justify-center rounded-md p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground",
|
|
352
|
+
"aria-label": unreadCount > 0 ? `${unreadCount} unread notifications` : "Notifications",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: "h-4 w-4" }),
|
|
355
|
+
unreadCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-destructive" })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] }) })
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
) });
|
|
363
|
+
}
|
|
364
|
+
function TopbarUserMenu({
|
|
365
|
+
user,
|
|
366
|
+
onSignOut,
|
|
367
|
+
onProfile,
|
|
368
|
+
onSettings,
|
|
369
|
+
onBilling,
|
|
370
|
+
userMenuExtras
|
|
371
|
+
}) {
|
|
372
|
+
const [open, setOpen] = React3__namespace.useState(false);
|
|
373
|
+
if (!user) return null;
|
|
374
|
+
const initial = (user.fullName?.trim()?.[0] ?? user.email?.[0] ?? "?").toUpperCase();
|
|
375
|
+
const item = (label, onClick, Icon) => onClick ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
376
|
+
"button",
|
|
377
|
+
{
|
|
378
|
+
onClick: () => {
|
|
379
|
+
setOpen(false);
|
|
380
|
+
onClick();
|
|
381
|
+
},
|
|
382
|
+
className: "flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70",
|
|
383
|
+
children: [
|
|
384
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 text-muted-foreground" }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
label
|
|
389
|
+
) : null;
|
|
390
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open, onOpenChange: setOpen, children: [
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
"aria-label": "User menu",
|
|
395
|
+
className: "ml-1 flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-primary text-xs font-semibold text-primary-foreground ring-2 ring-transparent transition hover:ring-sidebar-border",
|
|
396
|
+
children: user.avatarUrl ? (
|
|
397
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
398
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: user.avatarUrl, alt: "", className: "h-full w-full object-cover" })
|
|
399
|
+
) : initial
|
|
400
|
+
}
|
|
401
|
+
) }),
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
403
|
+
Popover__namespace.Content,
|
|
404
|
+
{
|
|
405
|
+
align: "end",
|
|
406
|
+
sideOffset: 8,
|
|
407
|
+
className: "fayz-glass-surface z-50 min-w-[220px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95",
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-3 py-2", children: [
|
|
410
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium text-foreground", children: user.fullName || user.email }),
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 space-y-0.5", children: [
|
|
414
|
+
item("Perfil", onProfile, lucideReact.UserCog),
|
|
415
|
+
item("Configura\xE7\xF5es", onSettings, lucideReact.Settings),
|
|
416
|
+
item("Cobran\xE7a", onBilling, lucideReact.CreditCard),
|
|
417
|
+
userMenuExtras?.map((e) => item(e.label, e.onClick)),
|
|
418
|
+
onSignOut && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 border-t border-border" }),
|
|
420
|
+
item("Sair", onSignOut)
|
|
421
|
+
] })
|
|
422
|
+
] })
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
) })
|
|
426
|
+
] });
|
|
427
|
+
}
|
|
428
|
+
var ICON_MAP2 = {
|
|
429
|
+
Home: lucideReact.Home,
|
|
430
|
+
Users: lucideReact.Users,
|
|
431
|
+
Settings: lucideReact.Settings,
|
|
432
|
+
CreditCard: lucideReact.CreditCard,
|
|
433
|
+
Bell: lucideReact.Bell,
|
|
434
|
+
Calendar: lucideReact.Calendar,
|
|
435
|
+
Package: lucideReact.Package,
|
|
436
|
+
BarChart3: lucideReact.BarChart3,
|
|
437
|
+
FileText: lucideReact.FileText,
|
|
438
|
+
Mail: lucideReact.Mail,
|
|
439
|
+
DollarSign: lucideReact.DollarSign,
|
|
440
|
+
Megaphone: lucideReact.Megaphone,
|
|
441
|
+
ShoppingCart: lucideReact.ShoppingCart,
|
|
442
|
+
Target: lucideReact.Target,
|
|
443
|
+
Wrench: lucideReact.Wrench,
|
|
444
|
+
ClipboardList: lucideReact.ClipboardList,
|
|
445
|
+
Briefcase: lucideReact.Briefcase,
|
|
446
|
+
UserCog: lucideReact.UserCog,
|
|
447
|
+
BookOpen: lucideReact.BookOpen,
|
|
448
|
+
MessageCircle: lucideReact.MessageCircle,
|
|
449
|
+
Globe: lucideReact.Globe,
|
|
450
|
+
Percent: lucideReact.Percent,
|
|
451
|
+
Tag: lucideReact.Tag,
|
|
452
|
+
Camera: lucideReact.Camera,
|
|
453
|
+
UtensilsCrossed: lucideReact.UtensilsCrossed,
|
|
454
|
+
Search: lucideReact.Search,
|
|
455
|
+
MapPin: lucideReact.MapPin,
|
|
456
|
+
Handshake: lucideReact.Handshake,
|
|
457
|
+
Contact: lucideReact.Contact,
|
|
458
|
+
Building2: lucideReact.Building2,
|
|
459
|
+
ChevronDown: lucideReact.ChevronDown,
|
|
460
|
+
Filter: lucideReact.Filter,
|
|
461
|
+
Plus: lucideReact.Plus,
|
|
462
|
+
List: lucideReact.List,
|
|
463
|
+
Dog: lucideReact.Dog,
|
|
464
|
+
Cat: lucideReact.Cat,
|
|
465
|
+
PawPrint: lucideReact.PawPrint,
|
|
466
|
+
Heart: lucideReact.Heart,
|
|
467
|
+
LayoutTemplate: lucideReact.LayoutTemplate,
|
|
468
|
+
LeafyGreen: lucideReact.LeafyGreen,
|
|
469
|
+
Apple: lucideReact.Apple,
|
|
470
|
+
Egg: lucideReact.Egg,
|
|
471
|
+
Wheat: lucideReact.Wheat,
|
|
472
|
+
ArrowDownCircle: lucideReact.ArrowDownCircle,
|
|
473
|
+
ArrowUpCircle: lucideReact.ArrowUpCircle,
|
|
474
|
+
ArrowLeftRight: lucideReact.ArrowLeftRight,
|
|
475
|
+
Plug: lucideReact.Plug,
|
|
476
|
+
SlidersHorizontal: lucideReact.SlidersHorizontal,
|
|
477
|
+
TableProperties: lucideReact.TableProperties,
|
|
478
|
+
Landmark: lucideReact.Landmark,
|
|
479
|
+
Receipt: lucideReact.Receipt,
|
|
480
|
+
TrendingUp: lucideReact.TrendingUp,
|
|
481
|
+
CircleDollarSign: lucideReact.CircleDollarSign,
|
|
482
|
+
Clock: lucideReact.Clock,
|
|
483
|
+
AlertTriangle: lucideReact.AlertTriangle,
|
|
484
|
+
Sparkles: lucideReact.Sparkles,
|
|
485
|
+
Wallet: lucideReact.Wallet,
|
|
486
|
+
Warehouse: lucideReact.Warehouse,
|
|
487
|
+
Ruler: lucideReact.Ruler,
|
|
488
|
+
ArrowUpRight: lucideReact.ArrowUpRight,
|
|
489
|
+
ArrowDownRight: lucideReact.ArrowDownRight,
|
|
490
|
+
UserPlus: lucideReact.UserPlus,
|
|
491
|
+
TreePalm: lucideReact.TreePalm,
|
|
492
|
+
PartyPopper: lucideReact.PartyPopper,
|
|
493
|
+
Radio: lucideReact.Radio,
|
|
494
|
+
CalendarDays: lucideReact.CalendarDays,
|
|
495
|
+
Banknote: lucideReact.Banknote,
|
|
496
|
+
Layers: lucideReact.Layers,
|
|
497
|
+
Music: lucideReact.Music,
|
|
498
|
+
Eye: lucideReact.Eye,
|
|
499
|
+
ListMusic: lucideReact.ListMusic,
|
|
500
|
+
Disc3: lucideReact.Disc3,
|
|
501
|
+
UsersRound: lucideReact.UsersRound,
|
|
502
|
+
Mic: lucideReact.Mic
|
|
503
|
+
};
|
|
504
|
+
function getIcon2(name) {
|
|
505
|
+
return ICON_MAP2[name] ?? lucideReact.Home;
|
|
506
|
+
}
|
|
507
|
+
function NavDropdown({ item, currentPath, onNavigate }) {
|
|
508
|
+
const [open, setOpen] = React3__namespace.useState(false);
|
|
509
|
+
const Icon = getIcon2(item.icon);
|
|
510
|
+
const isChildActive = item.children?.some(
|
|
511
|
+
(child) => currentPath === child.route || currentPath.startsWith(child.route + "/")
|
|
512
|
+
);
|
|
513
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open, onOpenChange: setOpen, children: [
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
"data-nav-active": isChildActive || void 0,
|
|
518
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
519
|
+
"flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors",
|
|
520
|
+
isChildActive ? "border-sidebar-accent-foreground font-semibold text-sidebar-foreground" : "border-transparent text-sidebar-muted hover:text-sidebar-foreground"
|
|
521
|
+
),
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label }),
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: chunkVVVZO2LE_cjs.cn("h-3 w-3 transition-transform", open && "rotate-180") })
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
) }),
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
Popover__namespace.Content,
|
|
531
|
+
{
|
|
532
|
+
align: "start",
|
|
533
|
+
sideOffset: 4,
|
|
534
|
+
className: "fayz-glass-surface z-50 min-w-[200px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95",
|
|
535
|
+
children: item.children?.map((child) => {
|
|
536
|
+
const ChildIcon = getIcon2(child.icon);
|
|
537
|
+
const isActive = currentPath === child.route || currentPath.startsWith(child.route + "/");
|
|
538
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
539
|
+
"button",
|
|
540
|
+
{
|
|
541
|
+
onClick: () => {
|
|
542
|
+
onNavigate(child.route);
|
|
543
|
+
setOpen(false);
|
|
544
|
+
},
|
|
545
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
546
|
+
"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors",
|
|
547
|
+
isActive ? "bg-muted font-medium text-foreground" : "text-popover-foreground hover:bg-muted/70"
|
|
548
|
+
),
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChildIcon, { className: "h-4 w-4 text-muted-foreground" }),
|
|
551
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: child.label })
|
|
552
|
+
]
|
|
553
|
+
},
|
|
554
|
+
child.id
|
|
555
|
+
);
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
) })
|
|
559
|
+
] });
|
|
560
|
+
}
|
|
561
|
+
function Topbar({
|
|
562
|
+
navigation,
|
|
563
|
+
logo,
|
|
564
|
+
user,
|
|
565
|
+
onMenuClick,
|
|
566
|
+
leftContent,
|
|
567
|
+
rightContent,
|
|
568
|
+
currentPath = "/",
|
|
569
|
+
onNavigate,
|
|
570
|
+
searchPlaceholder = "Search...",
|
|
571
|
+
onSignOut,
|
|
572
|
+
onProfile,
|
|
573
|
+
onSettings,
|
|
574
|
+
onBilling,
|
|
575
|
+
userMenuExtras
|
|
576
|
+
}) {
|
|
577
|
+
const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
|
|
578
|
+
const mainNav = navigation.filter((item) => item.section === "main");
|
|
579
|
+
const secondaryNav = navigation.filter((item) => item.section === "secondary");
|
|
580
|
+
const allNav = [...mainNav, ...secondaryNav];
|
|
581
|
+
const handleNavigate = (route) => {
|
|
582
|
+
onNavigate?.(route);
|
|
583
|
+
};
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { "data-print": "hide", className: "sticky top-0 z-50 w-full shrink-0", children: [
|
|
585
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-sidebar-border bg-sidebar text-sidebar-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-14 w-full items-center justify-between px-4 md:px-6", children: [
|
|
586
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
587
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
+
"button",
|
|
589
|
+
{
|
|
590
|
+
onClick: onMenuClick,
|
|
591
|
+
className: "inline-flex items-center justify-center rounded-md p-2 text-sidebar-foreground/70 hover:bg-sidebar/30 hover:text-sidebar-foreground md:hidden",
|
|
592
|
+
"aria-label": "Open menu",
|
|
593
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "h-5 w-5" })
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden shrink-0 items-center md:flex", children: logo ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg font-bold", children: "App" }) })
|
|
597
|
+
] }),
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-8 hidden max-w-sm flex-1 md:flex", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
599
|
+
"button",
|
|
600
|
+
{
|
|
601
|
+
onClick: () => setCommandPaletteOpen(true),
|
|
602
|
+
className: "relative flex h-8 w-full items-center rounded-md border border-sidebar-border bg-sidebar-accent px-3 pl-8 text-sm text-sidebar-muted shadow-sm transition-colors hover:bg-card",
|
|
603
|
+
children: [
|
|
604
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-sidebar-muted" }),
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: searchPlaceholder }),
|
|
606
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "ml-auto hidden rounded border border-sidebar-border bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium text-sidebar-muted sm:inline-block", children: "\u2318K" })
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
) }),
|
|
610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
611
|
+
leftContent,
|
|
612
|
+
rightContent,
|
|
613
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
614
|
+
TopbarUserMenu,
|
|
615
|
+
{
|
|
616
|
+
user,
|
|
617
|
+
onSignOut,
|
|
618
|
+
onProfile,
|
|
619
|
+
onSettings,
|
|
620
|
+
onBilling,
|
|
621
|
+
userMenuExtras
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
] })
|
|
625
|
+
] }) }),
|
|
626
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden md:block bg-sidebar", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-11 w-full items-center px-4 md:px-6", children: /* @__PURE__ */ jsxRuntime.jsx("nav", { ref: (el) => {
|
|
627
|
+
if (!el) return;
|
|
628
|
+
const active = el.querySelector('[data-nav-active="true"]');
|
|
629
|
+
if (active) {
|
|
630
|
+
const left = active.offsetLeft - el.offsetWidth / 2 + active.offsetWidth / 2;
|
|
631
|
+
el.scrollTo({ left: Math.max(0, left), behavior: "smooth" });
|
|
632
|
+
}
|
|
633
|
+
}, className: "flex items-center gap-0.5 overflow-x-auto scrollbar-hide", children: allNav.map((item) => {
|
|
634
|
+
if (item.children && item.children.length > 0) {
|
|
635
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
636
|
+
NavDropdown,
|
|
637
|
+
{
|
|
638
|
+
item,
|
|
639
|
+
currentPath,
|
|
640
|
+
onNavigate: handleNavigate
|
|
641
|
+
},
|
|
642
|
+
item.id
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
const Icon = getIcon2(item.icon);
|
|
646
|
+
const isActive = item.route === "/" ? currentPath === "/" : currentPath === item.route || currentPath.startsWith(item.route + "/");
|
|
647
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
648
|
+
"button",
|
|
649
|
+
{
|
|
650
|
+
"data-nav-active": isActive || void 0,
|
|
651
|
+
onClick: () => handleNavigate(item.route),
|
|
652
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
653
|
+
"flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors",
|
|
654
|
+
isActive ? "border-primary font-semibold text-sidebar-foreground" : "border-transparent text-sidebar-muted hover:text-sidebar-foreground"
|
|
655
|
+
),
|
|
656
|
+
children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
|
|
658
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label }),
|
|
659
|
+
item.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground", children: item.badge })
|
|
660
|
+
]
|
|
661
|
+
},
|
|
662
|
+
item.id
|
|
663
|
+
);
|
|
664
|
+
}) }) }) })
|
|
665
|
+
] });
|
|
666
|
+
}
|
|
667
|
+
var ModuleHeaderSlotContext = React3__namespace.createContext(null);
|
|
668
|
+
function useModuleHeaderSlot() {
|
|
669
|
+
return React3__namespace.useContext(ModuleHeaderSlotContext);
|
|
670
|
+
}
|
|
671
|
+
var ModuleHeaderActionsSlotContext = React3__namespace.createContext(null);
|
|
672
|
+
function useModuleHeaderActionsSlot() {
|
|
673
|
+
return React3__namespace.useContext(ModuleHeaderActionsSlotContext);
|
|
674
|
+
}
|
|
675
|
+
function SidebarLayout({
|
|
676
|
+
navigation = [],
|
|
677
|
+
logo,
|
|
678
|
+
user,
|
|
679
|
+
children,
|
|
680
|
+
onNavigate,
|
|
681
|
+
onSignOut,
|
|
682
|
+
onProfile,
|
|
683
|
+
onSettings,
|
|
684
|
+
onBilling,
|
|
685
|
+
userMenuExtras: _userMenuExtras,
|
|
686
|
+
orgSwitcher,
|
|
687
|
+
sidebarTopContent,
|
|
688
|
+
sidebarFooterContent,
|
|
689
|
+
frame,
|
|
690
|
+
currentPath,
|
|
691
|
+
pageTitle,
|
|
692
|
+
topbarStart,
|
|
693
|
+
topbarEnd,
|
|
694
|
+
userMenuSlot,
|
|
695
|
+
notificationSlot,
|
|
696
|
+
unreadCount = 0
|
|
697
|
+
}) {
|
|
698
|
+
const sidebarCollapsed = useLayoutStore((s) => s.sidebarCollapsed);
|
|
699
|
+
const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed);
|
|
700
|
+
const [mobileMenuOpen, setMobileMenuOpen] = React3__namespace.useState(false);
|
|
701
|
+
const [headerSlot, setHeaderSlot] = React3__namespace.useState(null);
|
|
702
|
+
const [actionsSlot, setActionsSlot] = React3__namespace.useState(null);
|
|
703
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkW4XXXJRW_cjs.SaveBarProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ModuleHeaderSlotContext.Provider, { value: headerSlot, children: /* @__PURE__ */ jsxRuntime.jsx(ModuleHeaderActionsSlotContext.Provider, { value: actionsSlot, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
704
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
+
Sidebar,
|
|
706
|
+
{
|
|
707
|
+
navigation,
|
|
708
|
+
logo,
|
|
709
|
+
collapsed: sidebarCollapsed,
|
|
710
|
+
onToggle: () => setSidebarCollapsed(!sidebarCollapsed),
|
|
711
|
+
onNavigate,
|
|
712
|
+
currentPath,
|
|
713
|
+
user,
|
|
714
|
+
onSignOut,
|
|
715
|
+
onProfile,
|
|
716
|
+
onSettings,
|
|
717
|
+
onBilling,
|
|
718
|
+
orgSwitcher,
|
|
719
|
+
topContent: sidebarTopContent,
|
|
720
|
+
footerContent: sidebarFooterContent,
|
|
721
|
+
borderless: false,
|
|
722
|
+
userMenuSlot,
|
|
723
|
+
notificationSlot,
|
|
724
|
+
unreadCount
|
|
725
|
+
}
|
|
726
|
+
) }),
|
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVVVZO2LE_cjs.cn(
|
|
728
|
+
"relative flex flex-1 flex-col overflow-hidden",
|
|
729
|
+
frame && "md:m-2 md:rounded-xl md:border md:border-border md:bg-card"
|
|
730
|
+
), children: [
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-14 shrink-0 items-center justify-between gap-3 border-b border-border bg-card px-4 py-2", children: [
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
733
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
734
|
+
"button",
|
|
735
|
+
{
|
|
736
|
+
onClick: () => setMobileMenuOpen(true),
|
|
737
|
+
className: "inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-accent md:hidden",
|
|
738
|
+
"aria-label": "Open menu",
|
|
739
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "h-5 w-5" })
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
pageTitle && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-lg", children: pageTitle }),
|
|
743
|
+
topbarStart,
|
|
744
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: setHeaderSlot, className: "flex min-w-0 flex-1 items-center" })
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
747
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: setActionsSlot, className: "flex items-center gap-2" }),
|
|
748
|
+
topbarEnd
|
|
749
|
+
] })
|
|
750
|
+
] }),
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1 overflow-y-auto", children }),
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkW4XXXJRW_cjs.SaveBar, {})
|
|
753
|
+
] }),
|
|
754
|
+
mobileMenuOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
755
|
+
MobileOverlay,
|
|
756
|
+
{
|
|
757
|
+
navigation,
|
|
758
|
+
logo,
|
|
759
|
+
user,
|
|
760
|
+
currentPath,
|
|
761
|
+
onNavigate,
|
|
762
|
+
onSignOut,
|
|
763
|
+
onProfile,
|
|
764
|
+
onSettings,
|
|
765
|
+
onBilling,
|
|
766
|
+
orgSwitcher,
|
|
767
|
+
topContent: sidebarTopContent,
|
|
768
|
+
footerContent: sidebarFooterContent,
|
|
769
|
+
userMenuSlot,
|
|
770
|
+
notificationSlot,
|
|
771
|
+
unreadCount,
|
|
772
|
+
onClose: () => setMobileMenuOpen(false)
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
] }) }) }) });
|
|
776
|
+
}
|
|
777
|
+
function TopbarLayout({
|
|
778
|
+
navigation = [],
|
|
779
|
+
logo,
|
|
780
|
+
user,
|
|
781
|
+
children,
|
|
782
|
+
onNavigate,
|
|
783
|
+
onSignOut,
|
|
784
|
+
onProfile,
|
|
785
|
+
onSettings,
|
|
786
|
+
onBilling,
|
|
787
|
+
userMenuExtras,
|
|
788
|
+
frame,
|
|
789
|
+
currentPath,
|
|
790
|
+
topbarStart,
|
|
791
|
+
topbarEnd
|
|
792
|
+
}) {
|
|
793
|
+
const [mobileMenuOpen, setMobileMenuOpen] = React3__namespace.useState(false);
|
|
794
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkW4XXXJRW_cjs.SaveBarProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex h-screen flex-col overflow-hidden bg-background", children: [
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
+
Topbar,
|
|
797
|
+
{
|
|
798
|
+
navigation,
|
|
799
|
+
logo,
|
|
800
|
+
user,
|
|
801
|
+
currentPath,
|
|
802
|
+
onNavigate,
|
|
803
|
+
onSignOut,
|
|
804
|
+
onProfile,
|
|
805
|
+
onSettings,
|
|
806
|
+
onBilling,
|
|
807
|
+
userMenuExtras,
|
|
808
|
+
leftContent: topbarStart,
|
|
809
|
+
rightContent: topbarEnd,
|
|
810
|
+
onMenuClick: () => setMobileMenuOpen(true)
|
|
811
|
+
}
|
|
812
|
+
),
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: chunkVVVZO2LE_cjs.cn("flex-1 overflow-y-auto", frame && "md:p-2"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVVVZO2LE_cjs.cn("min-h-full", frame && "md:rounded-xl md:border md:border-border md:bg-card"), children }) }),
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkW4XXXJRW_cjs.SaveBar, {}),
|
|
815
|
+
mobileMenuOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
816
|
+
MobileOverlay,
|
|
817
|
+
{
|
|
818
|
+
navigation,
|
|
819
|
+
logo,
|
|
820
|
+
user,
|
|
821
|
+
currentPath,
|
|
822
|
+
onNavigate,
|
|
823
|
+
onSignOut,
|
|
824
|
+
onProfile,
|
|
825
|
+
onSettings,
|
|
826
|
+
onBilling,
|
|
827
|
+
userMenuSlot: user ? /* @__PURE__ */ jsxRuntime.jsx(DrawerUserRow, { user }) : void 0,
|
|
828
|
+
onClose: () => setMobileMenuOpen(false)
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
] }) });
|
|
832
|
+
}
|
|
833
|
+
function DrawerUserRow({ user }) {
|
|
834
|
+
const label = user.fullName || user.email;
|
|
835
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2 px-1", children: [
|
|
836
|
+
user.avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: user.avatarUrl, alt: "", className: "h-7 w-7 shrink-0 rounded-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-semibold text-primary-foreground", children: (label || "?").charAt(0).toUpperCase() }),
|
|
837
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-sidebar-foreground", children: label })
|
|
838
|
+
] });
|
|
839
|
+
}
|
|
840
|
+
function MinimalLayout({
|
|
841
|
+
logo,
|
|
842
|
+
user: _user,
|
|
843
|
+
children,
|
|
844
|
+
headerEnd
|
|
845
|
+
}) {
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-screen flex-col", children: [
|
|
847
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6", children: [
|
|
848
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: logo ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg font-bold", children: "App" }) }),
|
|
849
|
+
headerEnd && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: headerEnd })
|
|
850
|
+
] }),
|
|
851
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1 overflow-y-auto", children })
|
|
852
|
+
] });
|
|
853
|
+
}
|
|
854
|
+
function MobileOverlay({ onClose, onNavigate, ...sidebarProps }) {
|
|
855
|
+
const [visible, setVisible] = React3__namespace.useState(false);
|
|
856
|
+
React3__namespace.useEffect(() => {
|
|
857
|
+
const id = requestAnimationFrame(() => setVisible(true));
|
|
858
|
+
return () => cancelAnimationFrame(id);
|
|
859
|
+
}, []);
|
|
860
|
+
const close = React3__namespace.useCallback(() => {
|
|
861
|
+
setVisible(false);
|
|
862
|
+
window.setTimeout(onClose, 250);
|
|
863
|
+
}, [onClose]);
|
|
864
|
+
React3__namespace.useEffect(() => {
|
|
865
|
+
const previous = document.body.style.overflow;
|
|
866
|
+
document.body.style.overflow = "hidden";
|
|
867
|
+
return () => {
|
|
868
|
+
document.body.style.overflow = previous;
|
|
869
|
+
};
|
|
870
|
+
}, []);
|
|
871
|
+
React3__namespace.useEffect(() => {
|
|
872
|
+
const onKey = (e) => {
|
|
873
|
+
if (e.key === "Escape") close();
|
|
874
|
+
};
|
|
875
|
+
window.addEventListener("keydown", onKey);
|
|
876
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
877
|
+
}, [close]);
|
|
878
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-[60] md:hidden", children: [
|
|
879
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
880
|
+
"div",
|
|
881
|
+
{
|
|
882
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
883
|
+
"absolute inset-0 bg-black/50 transition-opacity duration-300 ease-out",
|
|
884
|
+
visible ? "opacity-100" : "opacity-0"
|
|
885
|
+
),
|
|
886
|
+
onClick: close
|
|
887
|
+
}
|
|
888
|
+
),
|
|
889
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
"div",
|
|
891
|
+
{
|
|
892
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
893
|
+
"absolute inset-y-0 left-0 shadow-2xl transition-transform duration-300 ease-out will-change-transform",
|
|
894
|
+
visible ? "translate-x-0" : "-translate-x-full"
|
|
895
|
+
),
|
|
896
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
897
|
+
Sidebar,
|
|
898
|
+
{
|
|
899
|
+
...sidebarProps,
|
|
900
|
+
collapsed: false,
|
|
901
|
+
onToggle: close,
|
|
902
|
+
borderless: true,
|
|
903
|
+
onNavigate: (route) => {
|
|
904
|
+
onNavigate?.(route);
|
|
905
|
+
close();
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
] });
|
|
912
|
+
}
|
|
913
|
+
function AppShell({
|
|
914
|
+
variant,
|
|
915
|
+
contentFrame,
|
|
916
|
+
navigation = [],
|
|
917
|
+
logo,
|
|
918
|
+
user,
|
|
919
|
+
children,
|
|
920
|
+
onNavigate,
|
|
921
|
+
onSignOut,
|
|
922
|
+
onProfile,
|
|
923
|
+
onSettings,
|
|
924
|
+
onBilling,
|
|
925
|
+
pageTitle,
|
|
926
|
+
currentPath,
|
|
927
|
+
userMenuExtras,
|
|
928
|
+
orgSwitcher,
|
|
929
|
+
topbarStart,
|
|
930
|
+
topbarEnd,
|
|
931
|
+
sidebarTopContent,
|
|
932
|
+
sidebarFooterContent,
|
|
933
|
+
userMenuSlot,
|
|
934
|
+
notificationSlot,
|
|
935
|
+
unreadCount = 0
|
|
936
|
+
}) {
|
|
937
|
+
switch (variant) {
|
|
938
|
+
case "sidebar":
|
|
939
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
+
SidebarLayout,
|
|
941
|
+
{
|
|
942
|
+
navigation,
|
|
943
|
+
logo,
|
|
944
|
+
user,
|
|
945
|
+
onNavigate,
|
|
946
|
+
onSignOut,
|
|
947
|
+
onProfile,
|
|
948
|
+
onSettings,
|
|
949
|
+
onBilling,
|
|
950
|
+
userMenuExtras,
|
|
951
|
+
orgSwitcher,
|
|
952
|
+
sidebarTopContent,
|
|
953
|
+
sidebarFooterContent,
|
|
954
|
+
frame: contentFrame,
|
|
955
|
+
currentPath,
|
|
956
|
+
pageTitle,
|
|
957
|
+
topbarStart,
|
|
958
|
+
topbarEnd,
|
|
959
|
+
userMenuSlot,
|
|
960
|
+
notificationSlot,
|
|
961
|
+
unreadCount,
|
|
962
|
+
children
|
|
963
|
+
}
|
|
964
|
+
);
|
|
965
|
+
case "topbar":
|
|
966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
967
|
+
TopbarLayout,
|
|
968
|
+
{
|
|
969
|
+
navigation,
|
|
970
|
+
logo,
|
|
971
|
+
user,
|
|
972
|
+
onNavigate,
|
|
973
|
+
onSignOut,
|
|
974
|
+
onProfile,
|
|
975
|
+
onSettings,
|
|
976
|
+
onBilling,
|
|
977
|
+
userMenuExtras,
|
|
978
|
+
frame: contentFrame,
|
|
979
|
+
currentPath,
|
|
980
|
+
topbarStart,
|
|
981
|
+
topbarEnd,
|
|
982
|
+
children
|
|
983
|
+
}
|
|
984
|
+
);
|
|
985
|
+
case "minimal":
|
|
986
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MinimalLayout, { logo, user, headerEnd: topbarEnd, children });
|
|
987
|
+
default: {
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
var NavTransitionContext = React3__namespace.createContext("slide");
|
|
993
|
+
function NavTransitionProvider({ value, children }) {
|
|
994
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NavTransitionContext.Provider, { value, children });
|
|
995
|
+
}
|
|
996
|
+
function useNavTransition() {
|
|
997
|
+
return React3__namespace.useContext(NavTransitionContext);
|
|
998
|
+
}
|
|
999
|
+
function resolveTransitionClass(transition, direction) {
|
|
1000
|
+
if (transition === "none") return "";
|
|
1001
|
+
if (transition === "fade") return "saas-page-enter";
|
|
1002
|
+
if (direction === "back") return "saas-nav-back";
|
|
1003
|
+
if (direction === "forward") return "saas-nav-forward";
|
|
1004
|
+
return "saas-page-enter";
|
|
1005
|
+
}
|
|
1006
|
+
function PageTransition({
|
|
1007
|
+
transitionKey,
|
|
1008
|
+
direction,
|
|
1009
|
+
className,
|
|
1010
|
+
children
|
|
1011
|
+
}) {
|
|
1012
|
+
const transition = useNavTransition();
|
|
1013
|
+
const animClass = resolveTransitionClass(transition, direction);
|
|
1014
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkVVVZO2LE_cjs.cn(animClass, className), children }, transitionKey);
|
|
1015
|
+
}
|
|
1016
|
+
function PageHeaderActions({ children }) {
|
|
1017
|
+
const slot = useModuleHeaderActionsSlot();
|
|
1018
|
+
if (slot) return reactDom.createPortal(children, slot);
|
|
1019
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 flex items-center justify-end gap-2", children });
|
|
1020
|
+
}
|
|
1021
|
+
var ModuleLayoutContext = React3__namespace.createContext("rail");
|
|
1022
|
+
function ModuleLayoutProvider({ variant, children }) {
|
|
1023
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ModuleLayoutContext.Provider, { value: variant, children });
|
|
1024
|
+
}
|
|
1025
|
+
function useModuleLayout() {
|
|
1026
|
+
return React3__namespace.useContext(ModuleLayoutContext);
|
|
1027
|
+
}
|
|
1028
|
+
function NavItem2({ item }) {
|
|
1029
|
+
const [expanded, setExpanded] = React3__namespace.useState(true);
|
|
1030
|
+
const Icon = item.icon ? ICON_MAP2[item.icon] ?? null : null;
|
|
1031
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
1032
|
+
const hasActiveChild = hasChildren && item.children.some((c) => c.active);
|
|
1033
|
+
const isActive = item.active || hasActiveChild;
|
|
1034
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1035
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1036
|
+
"button",
|
|
1037
|
+
{
|
|
1038
|
+
type: "button",
|
|
1039
|
+
onClick: () => hasChildren ? setExpanded(!expanded) : item.onClick?.(),
|
|
1040
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
1041
|
+
"flex items-center gap-2 w-full rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
1042
|
+
isActive ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
|
1043
|
+
),
|
|
1044
|
+
children: [
|
|
1045
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
1046
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-left truncate", children: item.label }),
|
|
1047
|
+
hasChildren && (expanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3.5 w-3.5 shrink-0 opacity-50" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3.5 w-3.5 shrink-0 opacity-50" }))
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
hasChildren && expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4 mt-0.5 space-y-0.5 border-l pl-2", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1052
|
+
"button",
|
|
1053
|
+
{
|
|
1054
|
+
type: "button",
|
|
1055
|
+
onClick: child.onClick,
|
|
1056
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
1057
|
+
"flex items-center w-full rounded-md px-2.5 py-1 text-xs transition-colors",
|
|
1058
|
+
child.active ? "text-primary font-medium bg-primary/5" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
|
1059
|
+
),
|
|
1060
|
+
children: child.label
|
|
1061
|
+
},
|
|
1062
|
+
child.id
|
|
1063
|
+
)) })
|
|
1064
|
+
] });
|
|
1065
|
+
}
|
|
1066
|
+
function MobileTabs({ nav }) {
|
|
1067
|
+
const scrollRef = React3__namespace.useRef(null);
|
|
1068
|
+
const [expandedId, setExpandedId] = React3__namespace.useState(null);
|
|
1069
|
+
React3__namespace.useEffect(() => {
|
|
1070
|
+
const container = scrollRef.current;
|
|
1071
|
+
if (!container) return;
|
|
1072
|
+
const activeEl = container.querySelector('[data-active="true"]');
|
|
1073
|
+
if (activeEl) {
|
|
1074
|
+
const left = activeEl.offsetLeft - container.offsetWidth / 2 + activeEl.offsetWidth / 2;
|
|
1075
|
+
container.scrollTo({ left: Math.max(0, left), behavior: "smooth" });
|
|
1076
|
+
}
|
|
1077
|
+
}, [nav]);
|
|
1078
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden -mx-1 mb-4 no-print", children: [
|
|
1079
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "flex gap-1 px-1 pb-2 overflow-x-auto scrollbar-hide", children: nav.map((item) => {
|
|
1080
|
+
const Icon = item.icon ? ICON_MAP2[item.icon] ?? null : null;
|
|
1081
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
1082
|
+
const isActive = item.active || item.children?.some((c) => c.active);
|
|
1083
|
+
const isExpanded = expandedId === item.id;
|
|
1084
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1085
|
+
"button",
|
|
1086
|
+
{
|
|
1087
|
+
type: "button",
|
|
1088
|
+
"data-active": isActive || void 0,
|
|
1089
|
+
onClick: () => {
|
|
1090
|
+
if (hasChildren) {
|
|
1091
|
+
setExpandedId(isExpanded ? null : item.id);
|
|
1092
|
+
} else {
|
|
1093
|
+
item.onClick?.();
|
|
1094
|
+
setExpandedId(null);
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
1098
|
+
"flex items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1.5 text-xs font-medium transition-colors shrink-0",
|
|
1099
|
+
isActive ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:text-foreground"
|
|
1100
|
+
),
|
|
1101
|
+
children: [
|
|
1102
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-3 w-3" }),
|
|
1103
|
+
item.label,
|
|
1104
|
+
hasChildren && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: chunkVVVZO2LE_cjs.cn("h-2.5 w-2.5 transition-transform", isExpanded && "rotate-180") })
|
|
1105
|
+
]
|
|
1106
|
+
},
|
|
1107
|
+
item.id
|
|
1108
|
+
);
|
|
1109
|
+
}) }),
|
|
1110
|
+
expandedId && (() => {
|
|
1111
|
+
const item = nav.find((n) => n.id === expandedId);
|
|
1112
|
+
if (!item?.children) return null;
|
|
1113
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 px-2 pb-2 animate-in fade-in-0 slide-in-from-top-1", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
|
+
"button",
|
|
1115
|
+
{
|
|
1116
|
+
type: "button",
|
|
1117
|
+
onClick: () => {
|
|
1118
|
+
child.onClick?.();
|
|
1119
|
+
setExpandedId(null);
|
|
1120
|
+
},
|
|
1121
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
1122
|
+
"whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium transition-colors shrink-0",
|
|
1123
|
+
child.active ? "bg-foreground/10 text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
1124
|
+
),
|
|
1125
|
+
children: child.label
|
|
1126
|
+
},
|
|
1127
|
+
child.id
|
|
1128
|
+
)) });
|
|
1129
|
+
})()
|
|
1130
|
+
] });
|
|
1131
|
+
}
|
|
1132
|
+
var BackStyleContext = React3__namespace.createContext("link");
|
|
1133
|
+
function BackStyleProvider({ style, children }) {
|
|
1134
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BackStyleContext.Provider, { value: style, children });
|
|
1135
|
+
}
|
|
1136
|
+
function useBackStyle() {
|
|
1137
|
+
return React3__namespace.useContext(BackStyleContext);
|
|
1138
|
+
}
|
|
1139
|
+
function SubpageHeader({ title, subtitle, icon, onBack, parentLabel, actions, backStyle }) {
|
|
1140
|
+
const t = core.useTranslation();
|
|
1141
|
+
const appStyle = useBackStyle();
|
|
1142
|
+
const { onBack: effectiveOnBack, parentLabel: effectiveParentLabel } = chunkW4XXXJRW_cjs.useCrossModuleBack(onBack, parentLabel);
|
|
1143
|
+
chunkW4XXXJRW_cjs.useBackHandler(effectiveOnBack);
|
|
1144
|
+
const Icon = icon ? ICON_MAP2[icon] ?? null : null;
|
|
1145
|
+
const style = !effectiveOnBack ? "icon" : backStyle ?? appStyle;
|
|
1146
|
+
const effectiveStyle = style !== "icon" && !effectiveParentLabel ? "icon" : style;
|
|
1147
|
+
const titleBlock = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1148
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1149
|
+
effectiveStyle === "icon" && effectiveOnBack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
+
"button",
|
|
1151
|
+
{
|
|
1152
|
+
onClick: effectiveOnBack,
|
|
1153
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border hover:bg-muted bg-card shadow-button active:shadow-button-inset transition-colors",
|
|
1154
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" })
|
|
1155
|
+
}
|
|
1156
|
+
),
|
|
1157
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-5 w-5 text-muted-foreground" }) }),
|
|
1158
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1159
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-bold", children: title }),
|
|
1160
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
1161
|
+
] })
|
|
1162
|
+
] }),
|
|
1163
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "no-print", children: actions })
|
|
1164
|
+
] });
|
|
1165
|
+
if (effectiveStyle === "breadcrumb") {
|
|
1166
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 mb-6", children: [
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
1169
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: effectiveOnBack, className: "hover:text-foreground transition-colors", children: effectiveParentLabel }),
|
|
1170
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3.5 w-3.5" }),
|
|
1171
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: title })
|
|
1172
|
+
] }),
|
|
1173
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "no-print", children: actions })
|
|
1174
|
+
] }),
|
|
1175
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground -mt-2", children: subtitle })
|
|
1176
|
+
] });
|
|
1177
|
+
}
|
|
1178
|
+
if (effectiveStyle === "link") {
|
|
1179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 mb-6", children: [
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1181
|
+
"button",
|
|
1182
|
+
{
|
|
1183
|
+
onClick: effectiveOnBack,
|
|
1184
|
+
className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
1185
|
+
children: [
|
|
1186
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }),
|
|
1187
|
+
t("crud.detail.backTo", { entities: effectiveParentLabel })
|
|
1188
|
+
]
|
|
1189
|
+
}
|
|
1190
|
+
),
|
|
1191
|
+
titleBlock
|
|
1192
|
+
] });
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4 mb-6", children: titleBlock });
|
|
1195
|
+
}
|
|
1196
|
+
function ModuleHeader({ nav }) {
|
|
1197
|
+
const slot = useModuleHeaderSlot();
|
|
1198
|
+
function defaultChild(item) {
|
|
1199
|
+
const kids = item.children ?? [];
|
|
1200
|
+
return kids.find((c) => /list/i.test(c.id) || /^list$/i.test(c.label)) ?? kids[kids.length - 1];
|
|
1201
|
+
}
|
|
1202
|
+
const content = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full min-w-0 items-center gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-0.5 overflow-x-auto scrollbar-hide", children: nav.map((item) => {
|
|
1203
|
+
const Icon = item.icon ? ICON_MAP2[item.icon] ?? null : null;
|
|
1204
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
1205
|
+
const isActive = item.active || item.children?.some((c) => c.active);
|
|
1206
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
type: "button",
|
|
1210
|
+
onClick: () => hasChildren ? defaultChild(item)?.onClick?.() : item.onClick?.(),
|
|
1211
|
+
className: chunkVVVZO2LE_cjs.cn(
|
|
1212
|
+
"flex shrink-0 items-center gap-1.5 whitespace-nowrap border-b-2 px-2.5 py-1.5 text-sm font-medium transition-colors",
|
|
1213
|
+
isActive ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
1214
|
+
),
|
|
1215
|
+
children: [
|
|
1216
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
|
|
1217
|
+
item.label
|
|
1218
|
+
]
|
|
1219
|
+
},
|
|
1220
|
+
item.id
|
|
1221
|
+
);
|
|
1222
|
+
}) }) });
|
|
1223
|
+
if (slot) return reactDom.createPortal(content, slot);
|
|
1224
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-5 border-b border-border pb-2", children: content });
|
|
1225
|
+
}
|
|
1226
|
+
function ModulePage({ title, subtitle, nav, children, className, headerAction, showHeader = true, sidebarFooter, navVariant, viewKey, direction }) {
|
|
1227
|
+
const ctxVariant = useModuleLayout();
|
|
1228
|
+
const variant = navVariant ?? ctxVariant;
|
|
1229
|
+
const transitionKey = viewKey ?? "view";
|
|
1230
|
+
if (variant === "tabs") {
|
|
1231
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsx(ModuleHeader, { nav }),
|
|
1233
|
+
showHeader && headerAction && /* @__PURE__ */ jsxRuntime.jsx(PageHeaderActions, { children: headerAction }),
|
|
1234
|
+
/* @__PURE__ */ jsxRuntime.jsx(PageTransition, { transitionKey, direction, className: chunkVVVZO2LE_cjs.cn("min-w-0", className), children })
|
|
1235
|
+
] });
|
|
1236
|
+
}
|
|
1237
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVVVZO2LE_cjs.cn("flex gap-6 -mt-2", className), children: [
|
|
1238
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-48 shrink-0 hidden md:block no-print", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkVVVZO2LE_cjs.cn(sidebarFooter && "sticky top-4 flex flex-col"), style: sidebarFooter ? { height: "calc(100vh - 8rem)" } : void 0, children: [
|
|
1239
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1240
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider px-2.5 mb-2", children: title }),
|
|
1241
|
+
/* @__PURE__ */ jsxRuntime.jsx("nav", { className: "space-y-0.5", children: nav.map((item) => /* @__PURE__ */ jsxRuntime.jsx(NavItem2, { item }, item.id)) })
|
|
1242
|
+
] }),
|
|
1243
|
+
sidebarFooter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto", children: sidebarFooter })
|
|
1244
|
+
] }) }),
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1246
|
+
showHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 flex items-start justify-between gap-3", children: [
|
|
1247
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1248
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold", children: title }),
|
|
1249
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
1250
|
+
] }),
|
|
1251
|
+
headerAction
|
|
1252
|
+
] }),
|
|
1253
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileTabs, { nav }),
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsx(PageTransition, { transitionKey, direction, children })
|
|
1255
|
+
] })
|
|
1256
|
+
] });
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
exports.AppShell = AppShell;
|
|
1260
|
+
exports.BackStyleProvider = BackStyleProvider;
|
|
1261
|
+
exports.ICON_MAP = ICON_MAP;
|
|
1262
|
+
exports.ModuleLayoutProvider = ModuleLayoutProvider;
|
|
1263
|
+
exports.ModulePage = ModulePage;
|
|
1264
|
+
exports.NavTransitionProvider = NavTransitionProvider;
|
|
1265
|
+
exports.PageHeaderActions = PageHeaderActions;
|
|
1266
|
+
exports.PageTransition = PageTransition;
|
|
1267
|
+
exports.Sidebar = Sidebar;
|
|
1268
|
+
exports.SubpageHeader = SubpageHeader;
|
|
1269
|
+
exports.Topbar = Topbar;
|
|
1270
|
+
exports.useBackStyle = useBackStyle;
|
|
1271
|
+
exports.useLayoutStore = useLayoutStore;
|
|
1272
|
+
exports.useModuleHeaderActionsSlot = useModuleHeaderActionsSlot;
|
|
1273
|
+
exports.useModuleHeaderSlot = useModuleHeaderSlot;
|
|
1274
|
+
exports.useModuleLayout = useModuleLayout;
|
|
1275
|
+
exports.useNavTransition = useNavTransition;
|
|
1276
|
+
//# sourceMappingURL=chunk-GE6XUREM.cjs.map
|
|
1277
|
+
//# sourceMappingURL=chunk-GE6XUREM.cjs.map
|