@logickernel/frame 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +143 -11
- package/dist/index.d.ts +143 -11
- package/dist/index.js +851 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +793 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -22
- package/dist/adapters/nextjs.js +0 -31
- package/dist/adapters/nextjs.js.map +0 -1
- package/dist/adapters/nextjs.mjs +0 -25
- package/dist/adapters/nextjs.mjs.map +0 -1
- package/dist/components/AppSidebar.js +0 -467
- package/dist/components/AppSidebar.js.map +0 -1
- package/dist/components/AppSidebar.mjs +0 -446
- package/dist/components/AppSidebar.mjs.map +0 -1
- package/dist/components/NavMain.js +0 -133
- package/dist/components/NavMain.js.map +0 -1
- package/dist/components/NavMain.mjs +0 -112
- package/dist/components/NavMain.mjs.map +0 -1
- package/dist/components/NavUser.js +0 -88
- package/dist/components/NavUser.js.map +0 -1
- package/dist/components/NavUser.mjs +0 -86
- package/dist/components/NavUser.mjs.map +0 -1
- package/dist/components/TeamSwitcher.js +0 -164
- package/dist/components/TeamSwitcher.js.map +0 -1
- package/dist/components/TeamSwitcher.mjs +0 -162
- package/dist/components/TeamSwitcher.mjs.map +0 -1
- package/dist/hooks/useNavigation.d.mts +0 -24
- package/dist/hooks/useNavigation.d.ts +0 -24
- package/dist/hooks/useNavigation.js +0 -59
- package/dist/hooks/useNavigation.js.map +0 -1
- package/dist/hooks/useNavigation.mjs +0 -57
- package/dist/hooks/useNavigation.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -85
- package/dist/types/index.d.ts +0 -85
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -3
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/ui-components.d.js +0 -4
- package/dist/types/ui-components.d.js.map +0 -1
- package/dist/types/ui-components.d.mjs +0 -3
- package/dist/types/ui-components.d.mjs.map +0 -1
- package/dist/utils/iconMapper.d.mts +0 -16
- package/dist/utils/iconMapper.d.ts +0 -16
- package/dist/utils/iconMapper.js +0 -52
- package/dist/utils/iconMapper.js.map +0 -1
- package/dist/utils/iconMapper.mjs +0 -30
- package/dist/utils/iconMapper.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var collapsible = require('@/components/ui/collapsible');
|
|
5
|
-
var sidebar = require('@/components/ui/sidebar');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var avatar = require('@/components/ui/avatar');
|
|
8
|
-
var dropdownMenu = require('@/components/ui/dropdown-menu');
|
|
9
|
-
var react = require('react');
|
|
3
|
+
var React2 = require('react');
|
|
10
4
|
var Link = require('next/link');
|
|
11
5
|
var navigation = require('next/navigation');
|
|
12
|
-
var react
|
|
6
|
+
var react = require('next-auth/react');
|
|
7
|
+
var LucideIcons = require('lucide-react');
|
|
8
|
+
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
9
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
10
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
11
|
+
var clsx = require('clsx');
|
|
12
|
+
var tailwindMerge = require('tailwind-merge');
|
|
13
|
+
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
16
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
13
17
|
|
|
14
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
19
|
|
|
@@ -31,10 +35,621 @@ function _interopNamespace(e) {
|
|
|
31
35
|
return Object.freeze(n);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
var
|
|
38
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
35
39
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
40
|
+
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
41
|
+
var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
|
|
42
|
+
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
43
|
+
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
44
|
+
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
36
45
|
|
|
37
|
-
// src/components/
|
|
46
|
+
// src/components/AppSidebar.tsx
|
|
47
|
+
var Collapsible = CollapsiblePrimitive__namespace.Root;
|
|
48
|
+
var CollapsibleTrigger2 = CollapsiblePrimitive__namespace.CollapsibleTrigger;
|
|
49
|
+
var CollapsibleContent2 = CollapsiblePrimitive__namespace.CollapsibleContent;
|
|
50
|
+
function cn(...inputs) {
|
|
51
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
52
|
+
}
|
|
53
|
+
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
54
|
+
var Tooltip = TooltipPrimitive__namespace.Root;
|
|
55
|
+
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
56
|
+
var TooltipContent = React2__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
TooltipPrimitive__namespace.Content,
|
|
58
|
+
{
|
|
59
|
+
ref,
|
|
60
|
+
sideOffset,
|
|
61
|
+
className: cn(
|
|
62
|
+
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
) }));
|
|
68
|
+
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
69
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
70
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
71
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
72
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
73
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
74
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
75
|
+
var SidebarContext = React2__namespace.createContext(null);
|
|
76
|
+
function useSidebar() {
|
|
77
|
+
const context = React2__namespace.useContext(SidebarContext);
|
|
78
|
+
if (!context) {
|
|
79
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
80
|
+
}
|
|
81
|
+
return context;
|
|
82
|
+
}
|
|
83
|
+
function useIsMobile() {
|
|
84
|
+
const [isMobile, setIsMobile] = React2__namespace.useState(false);
|
|
85
|
+
React2__namespace.useEffect(() => {
|
|
86
|
+
const mql = window.matchMedia("(max-width: 768px)");
|
|
87
|
+
const onChange = () => setIsMobile(mql.matches);
|
|
88
|
+
mql.addEventListener("change", onChange);
|
|
89
|
+
setIsMobile(mql.matches);
|
|
90
|
+
return () => mql.removeEventListener("change", onChange);
|
|
91
|
+
}, []);
|
|
92
|
+
return isMobile;
|
|
93
|
+
}
|
|
94
|
+
var SidebarProvider = React2__namespace.forwardRef(
|
|
95
|
+
({
|
|
96
|
+
defaultOpen = true,
|
|
97
|
+
open: openProp,
|
|
98
|
+
onOpenChange: setOpenProp,
|
|
99
|
+
className,
|
|
100
|
+
style,
|
|
101
|
+
children,
|
|
102
|
+
...props
|
|
103
|
+
}, ref) => {
|
|
104
|
+
const isMobile = useIsMobile();
|
|
105
|
+
const [openMobile, setOpenMobile] = React2__namespace.useState(false);
|
|
106
|
+
const [_open, _setOpen] = React2__namespace.useState(defaultOpen);
|
|
107
|
+
const open = openProp ?? _open;
|
|
108
|
+
const setOpen = React2__namespace.useCallback(
|
|
109
|
+
(value) => {
|
|
110
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
111
|
+
if (setOpenProp) {
|
|
112
|
+
setOpenProp(openState);
|
|
113
|
+
} else {
|
|
114
|
+
_setOpen(openState);
|
|
115
|
+
}
|
|
116
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
117
|
+
},
|
|
118
|
+
[setOpenProp, open]
|
|
119
|
+
);
|
|
120
|
+
const toggleSidebar = React2__namespace.useCallback(() => {
|
|
121
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
122
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
123
|
+
React2__namespace.useEffect(() => {
|
|
124
|
+
const handleKeyDown = (event) => {
|
|
125
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
toggleSidebar();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
131
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
132
|
+
}, [toggleSidebar]);
|
|
133
|
+
const state = open ? "expanded" : "collapsed";
|
|
134
|
+
const contextValue = React2__namespace.useMemo(
|
|
135
|
+
() => ({
|
|
136
|
+
state,
|
|
137
|
+
open,
|
|
138
|
+
setOpen,
|
|
139
|
+
isMobile,
|
|
140
|
+
openMobile,
|
|
141
|
+
setOpenMobile,
|
|
142
|
+
toggleSidebar
|
|
143
|
+
}),
|
|
144
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
145
|
+
);
|
|
146
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
style: {
|
|
150
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
151
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
152
|
+
...style
|
|
153
|
+
},
|
|
154
|
+
className: cn(
|
|
155
|
+
"group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
|
|
156
|
+
className
|
|
157
|
+
),
|
|
158
|
+
ref,
|
|
159
|
+
...props,
|
|
160
|
+
children
|
|
161
|
+
}
|
|
162
|
+
) }) });
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
SidebarProvider.displayName = "SidebarProvider";
|
|
166
|
+
var Sidebar = React2__namespace.forwardRef(
|
|
167
|
+
({
|
|
168
|
+
side = "left",
|
|
169
|
+
variant = "sidebar",
|
|
170
|
+
collapsible = "offcanvas",
|
|
171
|
+
className,
|
|
172
|
+
children,
|
|
173
|
+
...props
|
|
174
|
+
}, ref) => {
|
|
175
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
176
|
+
if (collapsible === "none") {
|
|
177
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
className: cn(
|
|
181
|
+
"flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
|
|
182
|
+
className
|
|
183
|
+
),
|
|
184
|
+
ref,
|
|
185
|
+
...props,
|
|
186
|
+
children
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
if (isMobile) {
|
|
191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: cn(
|
|
195
|
+
"fixed inset-0 z-50 bg-black/80",
|
|
196
|
+
openMobile ? "block" : "hidden"
|
|
197
|
+
),
|
|
198
|
+
onClick: () => setOpenMobile(false),
|
|
199
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
"data-sidebar": "sidebar",
|
|
203
|
+
"data-mobile": "true",
|
|
204
|
+
className: cn(
|
|
205
|
+
"fixed inset-y-0 z-50 flex h-svh w-[--sidebar-width] flex-col bg-sidebar p-2 text-sidebar-foreground",
|
|
206
|
+
side === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
207
|
+
className
|
|
208
|
+
),
|
|
209
|
+
style: {
|
|
210
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
211
|
+
},
|
|
212
|
+
onClick: (e) => e.stopPropagation(),
|
|
213
|
+
ref,
|
|
214
|
+
...props,
|
|
215
|
+
children
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
ref,
|
|
225
|
+
className: "group peer hidden md:block text-sidebar-foreground",
|
|
226
|
+
"data-state": state,
|
|
227
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
228
|
+
"data-variant": variant,
|
|
229
|
+
"data-side": side,
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
232
|
+
"div",
|
|
233
|
+
{
|
|
234
|
+
className: cn(
|
|
235
|
+
"duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear",
|
|
236
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
237
|
+
"group-data-[side=right]:rotate-180",
|
|
238
|
+
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]" : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
+
"div",
|
|
244
|
+
{
|
|
245
|
+
className: cn(
|
|
246
|
+
"duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",
|
|
247
|
+
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
248
|
+
// Adjust the padding for floating and inset variants.
|
|
249
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]" : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
250
|
+
className
|
|
251
|
+
),
|
|
252
|
+
...props,
|
|
253
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
"data-sidebar": "sidebar",
|
|
257
|
+
className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",
|
|
258
|
+
children
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
Sidebar.displayName = "Sidebar";
|
|
269
|
+
var SidebarTrigger = React2__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
270
|
+
const { toggleSidebar } = useSidebar();
|
|
271
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
272
|
+
"button",
|
|
273
|
+
{
|
|
274
|
+
ref,
|
|
275
|
+
"data-sidebar": "trigger",
|
|
276
|
+
className: cn("h-7 w-7", className),
|
|
277
|
+
onClick: (event) => {
|
|
278
|
+
onClick?.(event);
|
|
279
|
+
toggleSidebar();
|
|
280
|
+
},
|
|
281
|
+
...props,
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.PanelLeft, {}),
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
SidebarTrigger.displayName = "SidebarTrigger";
|
|
290
|
+
var SidebarRail = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
291
|
+
const { toggleSidebar } = useSidebar();
|
|
292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
ref,
|
|
296
|
+
"data-sidebar": "rail",
|
|
297
|
+
"aria-label": "Toggle Sidebar",
|
|
298
|
+
tabIndex: -1,
|
|
299
|
+
onClick: toggleSidebar,
|
|
300
|
+
title: "Toggle Sidebar",
|
|
301
|
+
className: cn(
|
|
302
|
+
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
|
|
303
|
+
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
|
|
304
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
305
|
+
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
|
|
306
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
307
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
308
|
+
className
|
|
309
|
+
),
|
|
310
|
+
...props
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
});
|
|
314
|
+
SidebarRail.displayName = "SidebarRail";
|
|
315
|
+
var SidebarInset = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
+
"main",
|
|
318
|
+
{
|
|
319
|
+
ref,
|
|
320
|
+
className: cn(
|
|
321
|
+
"relative flex min-h-svh flex-1 flex-col bg-background",
|
|
322
|
+
"peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
|
|
323
|
+
className
|
|
324
|
+
),
|
|
325
|
+
...props
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
});
|
|
329
|
+
SidebarInset.displayName = "SidebarInset";
|
|
330
|
+
var SidebarInput = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
331
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
+
"input",
|
|
333
|
+
{
|
|
334
|
+
ref,
|
|
335
|
+
"data-sidebar": "input",
|
|
336
|
+
className: cn(
|
|
337
|
+
"h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
|
|
338
|
+
className
|
|
339
|
+
),
|
|
340
|
+
...props
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
});
|
|
344
|
+
SidebarInput.displayName = "SidebarInput";
|
|
345
|
+
var SidebarHeader = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
346
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
ref,
|
|
350
|
+
"data-sidebar": "header",
|
|
351
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
352
|
+
...props
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
});
|
|
356
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
357
|
+
var SidebarFooter = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
358
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
ref,
|
|
362
|
+
"data-sidebar": "footer",
|
|
363
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
364
|
+
...props
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
});
|
|
368
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
369
|
+
var SidebarSeparator = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
371
|
+
"hr",
|
|
372
|
+
{
|
|
373
|
+
ref,
|
|
374
|
+
"data-sidebar": "separator",
|
|
375
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
376
|
+
...props
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
});
|
|
380
|
+
SidebarSeparator.displayName = "SidebarSeparator";
|
|
381
|
+
var SidebarContent = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
382
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
+
"div",
|
|
384
|
+
{
|
|
385
|
+
ref,
|
|
386
|
+
"data-sidebar": "content",
|
|
387
|
+
className: cn(
|
|
388
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
389
|
+
className
|
|
390
|
+
),
|
|
391
|
+
...props
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
});
|
|
395
|
+
SidebarContent.displayName = "SidebarContent";
|
|
396
|
+
var SidebarGroup = React2__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
397
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
ref,
|
|
401
|
+
"data-sidebar": "group",
|
|
402
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
403
|
+
...props
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
});
|
|
407
|
+
SidebarGroup.displayName = "SidebarGroup";
|
|
408
|
+
var SidebarGroupLabel = React2__namespace.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
409
|
+
const Comp = asChild ? reactSlot.Slot : "div";
|
|
410
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
411
|
+
Comp,
|
|
412
|
+
{
|
|
413
|
+
ref,
|
|
414
|
+
"data-sidebar": "group-label",
|
|
415
|
+
className: cn(
|
|
416
|
+
"duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
417
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
418
|
+
className
|
|
419
|
+
),
|
|
420
|
+
...props
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
});
|
|
424
|
+
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
425
|
+
var SidebarGroupAction = React2__namespace.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
426
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
+
Comp,
|
|
429
|
+
{
|
|
430
|
+
ref,
|
|
431
|
+
"data-sidebar": "group-action",
|
|
432
|
+
className: cn(
|
|
433
|
+
"absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
434
|
+
// Increases the hit area of the button on mobile.
|
|
435
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
436
|
+
"group-data-[collapsible=icon]:hidden",
|
|
437
|
+
className
|
|
438
|
+
),
|
|
439
|
+
...props
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
});
|
|
443
|
+
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
444
|
+
var SidebarGroupContent = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
ref,
|
|
448
|
+
"data-sidebar": "group-content",
|
|
449
|
+
className: cn("w-full text-sm", className),
|
|
450
|
+
...props
|
|
451
|
+
}
|
|
452
|
+
));
|
|
453
|
+
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
454
|
+
var SidebarMenu = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
|
+
"ul",
|
|
456
|
+
{
|
|
457
|
+
ref,
|
|
458
|
+
"data-sidebar": "menu",
|
|
459
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
460
|
+
...props
|
|
461
|
+
}
|
|
462
|
+
));
|
|
463
|
+
SidebarMenu.displayName = "SidebarMenu";
|
|
464
|
+
var SidebarMenuItem = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
"li",
|
|
466
|
+
{
|
|
467
|
+
ref,
|
|
468
|
+
"data-sidebar": "menu-item",
|
|
469
|
+
className: cn("group/menu-item relative", className),
|
|
470
|
+
...props
|
|
471
|
+
}
|
|
472
|
+
));
|
|
473
|
+
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
474
|
+
var sidebarMenuButtonVariants = classVarianceAuthority.cva(
|
|
475
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
476
|
+
{
|
|
477
|
+
variants: {
|
|
478
|
+
variant: {
|
|
479
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
480
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
481
|
+
},
|
|
482
|
+
size: {
|
|
483
|
+
default: "h-8 text-sm",
|
|
484
|
+
sm: "h-7 text-xs",
|
|
485
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
defaultVariants: {
|
|
489
|
+
variant: "default",
|
|
490
|
+
size: "default"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
var SidebarMenuButton = React2__namespace.forwardRef(
|
|
495
|
+
({
|
|
496
|
+
asChild = false,
|
|
497
|
+
isActive = false,
|
|
498
|
+
variant = "default",
|
|
499
|
+
size = "default",
|
|
500
|
+
tooltip,
|
|
501
|
+
className,
|
|
502
|
+
...props
|
|
503
|
+
}, ref) => {
|
|
504
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
505
|
+
const { isMobile, state } = useSidebar();
|
|
506
|
+
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
507
|
+
Comp,
|
|
508
|
+
{
|
|
509
|
+
ref,
|
|
510
|
+
"data-sidebar": "menu-button",
|
|
511
|
+
"data-size": size,
|
|
512
|
+
"data-active": isActive,
|
|
513
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
514
|
+
...props
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
if (!tooltip) {
|
|
518
|
+
return button;
|
|
519
|
+
}
|
|
520
|
+
if (typeof tooltip === "string") {
|
|
521
|
+
tooltip = {
|
|
522
|
+
children: tooltip
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }),
|
|
527
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
528
|
+
TooltipContent,
|
|
529
|
+
{
|
|
530
|
+
side: "right",
|
|
531
|
+
align: "center",
|
|
532
|
+
hidden: state !== "collapsed" || isMobile,
|
|
533
|
+
...tooltip
|
|
534
|
+
}
|
|
535
|
+
)
|
|
536
|
+
] });
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
540
|
+
var SidebarMenuAction = React2__namespace.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
541
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
542
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
543
|
+
Comp,
|
|
544
|
+
{
|
|
545
|
+
ref,
|
|
546
|
+
"data-sidebar": "menu-action",
|
|
547
|
+
className: cn(
|
|
548
|
+
"absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
|
|
549
|
+
// Increases the hit area of the button on mobile.
|
|
550
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
551
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
552
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
553
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
554
|
+
"group-data-[collapsible=icon]:hidden",
|
|
555
|
+
showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
|
|
556
|
+
className
|
|
557
|
+
),
|
|
558
|
+
...props
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
});
|
|
562
|
+
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
563
|
+
var SidebarMenuBadge = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
ref,
|
|
567
|
+
"data-sidebar": "menu-badge",
|
|
568
|
+
className: cn(
|
|
569
|
+
"absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none",
|
|
570
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
571
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
572
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
573
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
574
|
+
"group-data-[collapsible=icon]:hidden",
|
|
575
|
+
className
|
|
576
|
+
),
|
|
577
|
+
...props
|
|
578
|
+
}
|
|
579
|
+
));
|
|
580
|
+
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
581
|
+
var SidebarMenuSkeleton = React2__namespace.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
|
582
|
+
const width = React2__namespace.useMemo(() => {
|
|
583
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
584
|
+
}, []);
|
|
585
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
586
|
+
"div",
|
|
587
|
+
{
|
|
588
|
+
ref,
|
|
589
|
+
"data-sidebar": "menu-skeleton",
|
|
590
|
+
className: cn("rounded-md h-8 flex gap-2 px-2 items-center", className),
|
|
591
|
+
...props,
|
|
592
|
+
children: [
|
|
593
|
+
showIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
594
|
+
"div",
|
|
595
|
+
{
|
|
596
|
+
className: "size-4 rounded-md bg-sidebar-accent-foreground/10",
|
|
597
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
601
|
+
"div",
|
|
602
|
+
{
|
|
603
|
+
className: "h-4 flex-1 max-w-[--skeleton-width] rounded-md bg-sidebar-accent-foreground/10",
|
|
604
|
+
"data-sidebar": "menu-skeleton-text",
|
|
605
|
+
style: {
|
|
606
|
+
"--skeleton-width": width
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
]
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
});
|
|
614
|
+
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
615
|
+
var SidebarMenuSub = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
616
|
+
"ul",
|
|
617
|
+
{
|
|
618
|
+
ref,
|
|
619
|
+
"data-sidebar": "menu-sub",
|
|
620
|
+
className: cn(
|
|
621
|
+
"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
|
|
622
|
+
"group-data-[collapsible=icon]:hidden",
|
|
623
|
+
className
|
|
624
|
+
),
|
|
625
|
+
...props
|
|
626
|
+
}
|
|
627
|
+
));
|
|
628
|
+
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
629
|
+
var SidebarMenuSubItem = React2__namespace.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("li", { ref, ...props }));
|
|
630
|
+
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
631
|
+
var SidebarMenuSubButton = React2__namespace.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
632
|
+
const Comp = asChild ? reactSlot.Slot : "a";
|
|
633
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
634
|
+
Comp,
|
|
635
|
+
{
|
|
636
|
+
ref,
|
|
637
|
+
"data-sidebar": "menu-sub-button",
|
|
638
|
+
"data-size": size,
|
|
639
|
+
"data-active": isActive,
|
|
640
|
+
className: cn(
|
|
641
|
+
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
|
|
642
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
643
|
+
size === "sm" && "text-xs",
|
|
644
|
+
size === "md" && "text-sm",
|
|
645
|
+
"group-data-[collapsible=icon]:hidden",
|
|
646
|
+
className
|
|
647
|
+
),
|
|
648
|
+
...props
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
});
|
|
652
|
+
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
38
653
|
var ICON_MAP = {
|
|
39
654
|
Home: LucideIcons__namespace.Home,
|
|
40
655
|
Users: LucideIcons__namespace.Users,
|
|
@@ -60,7 +675,7 @@ function getIconComponent(icon) {
|
|
|
60
675
|
}
|
|
61
676
|
function NavMain({ items, adapter }) {
|
|
62
677
|
const pathname = adapter.usePathname();
|
|
63
|
-
const
|
|
678
|
+
const Link3 = adapter.Link;
|
|
64
679
|
const groups = [];
|
|
65
680
|
let currentGroup = {
|
|
66
681
|
items: []
|
|
@@ -88,24 +703,24 @@ function NavMain({ items, adapter }) {
|
|
|
88
703
|
if (currentGroup.items.length > 0 || currentGroup.label) {
|
|
89
704
|
groups.push(currentGroup);
|
|
90
705
|
}
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
92
|
-
group.label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
706
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroup, { children: [
|
|
707
|
+
group.label && /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroupLabel, { children: [
|
|
93
708
|
group.label.icon && /* @__PURE__ */ jsxRuntime.jsx(group.label.icon, { className: "mr-2" }),
|
|
94
709
|
group.label.title
|
|
95
710
|
] }),
|
|
96
|
-
group.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
711
|
+
group.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: group.items.map((item) => {
|
|
97
712
|
const isActive = pathname === item.url || item.isActive;
|
|
98
713
|
const hasSubItems = item.items && item.items.length > 0;
|
|
99
714
|
if (hasSubItems) {
|
|
100
715
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
-
|
|
716
|
+
Collapsible,
|
|
102
717
|
{
|
|
103
718
|
asChild: true,
|
|
104
719
|
defaultOpen: isActive,
|
|
105
720
|
className: "group/collapsible",
|
|
106
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
107
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
-
|
|
721
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuItem, { children: [
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
723
|
+
SidebarMenuButton,
|
|
109
724
|
{
|
|
110
725
|
tooltip: item.title,
|
|
111
726
|
isActive,
|
|
@@ -116,19 +731,19 @@ function NavMain({ items, adapter }) {
|
|
|
116
731
|
]
|
|
117
732
|
}
|
|
118
733
|
) }),
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
734
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link3, { href: subItem.url, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title)) }) })
|
|
120
735
|
] })
|
|
121
736
|
},
|
|
122
737
|
item.title
|
|
123
738
|
);
|
|
124
739
|
}
|
|
125
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
-
|
|
740
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
SidebarMenuButton,
|
|
127
742
|
{
|
|
128
743
|
asChild: true,
|
|
129
744
|
tooltip: item.title,
|
|
130
745
|
isActive,
|
|
131
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
746
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Link3, { href: item.url, children: [
|
|
132
747
|
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
133
748
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
134
749
|
] })
|
|
@@ -137,6 +752,153 @@ function NavMain({ items, adapter }) {
|
|
|
137
752
|
}) })
|
|
138
753
|
] }, groupIndex)) });
|
|
139
754
|
}
|
|
755
|
+
var Avatar = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
+
AvatarPrimitive__namespace.Root,
|
|
757
|
+
{
|
|
758
|
+
ref,
|
|
759
|
+
className: cn(
|
|
760
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
761
|
+
className
|
|
762
|
+
),
|
|
763
|
+
...props
|
|
764
|
+
}
|
|
765
|
+
));
|
|
766
|
+
Avatar.displayName = AvatarPrimitive__namespace.Root.displayName;
|
|
767
|
+
var AvatarImage = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
+
AvatarPrimitive__namespace.Image,
|
|
769
|
+
{
|
|
770
|
+
ref,
|
|
771
|
+
className: cn("aspect-square h-full w-full", className),
|
|
772
|
+
...props
|
|
773
|
+
}
|
|
774
|
+
));
|
|
775
|
+
AvatarImage.displayName = AvatarPrimitive__namespace.Image.displayName;
|
|
776
|
+
var AvatarFallback = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
777
|
+
AvatarPrimitive__namespace.Fallback,
|
|
778
|
+
{
|
|
779
|
+
ref,
|
|
780
|
+
className: cn(
|
|
781
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
782
|
+
className
|
|
783
|
+
),
|
|
784
|
+
...props
|
|
785
|
+
}
|
|
786
|
+
));
|
|
787
|
+
AvatarFallback.displayName = AvatarPrimitive__namespace.Fallback.displayName;
|
|
788
|
+
var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
789
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
790
|
+
var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
|
|
791
|
+
var DropdownMenuSubTrigger = React2__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
792
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
793
|
+
{
|
|
794
|
+
ref,
|
|
795
|
+
className: cn(
|
|
796
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
797
|
+
inset && "pl-8",
|
|
798
|
+
className
|
|
799
|
+
),
|
|
800
|
+
...props,
|
|
801
|
+
children: [
|
|
802
|
+
children,
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.ChevronRight, { className: "ml-auto" })
|
|
804
|
+
]
|
|
805
|
+
}
|
|
806
|
+
));
|
|
807
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
|
|
808
|
+
var DropdownMenuSubContent = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
810
|
+
{
|
|
811
|
+
ref,
|
|
812
|
+
className: cn(
|
|
813
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
814
|
+
className
|
|
815
|
+
),
|
|
816
|
+
...props
|
|
817
|
+
}
|
|
818
|
+
));
|
|
819
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
820
|
+
var DropdownMenuContent = React2__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
821
|
+
DropdownMenuPrimitive__namespace.Content,
|
|
822
|
+
{
|
|
823
|
+
ref,
|
|
824
|
+
sideOffset,
|
|
825
|
+
className: cn(
|
|
826
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
827
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
828
|
+
className
|
|
829
|
+
),
|
|
830
|
+
...props
|
|
831
|
+
}
|
|
832
|
+
) }));
|
|
833
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
834
|
+
var DropdownMenuItem = React2__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
836
|
+
{
|
|
837
|
+
ref,
|
|
838
|
+
className: cn(
|
|
839
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
840
|
+
inset && "pl-8",
|
|
841
|
+
className
|
|
842
|
+
),
|
|
843
|
+
...props
|
|
844
|
+
}
|
|
845
|
+
));
|
|
846
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
847
|
+
var DropdownMenuCheckboxItem = React2__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
848
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
849
|
+
{
|
|
850
|
+
ref,
|
|
851
|
+
className: cn(
|
|
852
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
853
|
+
className
|
|
854
|
+
),
|
|
855
|
+
checked,
|
|
856
|
+
...props,
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.Check, { className: "h-4 w-4" }) }) }),
|
|
859
|
+
children
|
|
860
|
+
]
|
|
861
|
+
}
|
|
862
|
+
));
|
|
863
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
|
|
864
|
+
var DropdownMenuRadioItem = React2__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
865
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
866
|
+
{
|
|
867
|
+
ref,
|
|
868
|
+
className: cn(
|
|
869
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
870
|
+
className
|
|
871
|
+
),
|
|
872
|
+
...props,
|
|
873
|
+
children: [
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
875
|
+
children
|
|
876
|
+
]
|
|
877
|
+
}
|
|
878
|
+
));
|
|
879
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
|
|
880
|
+
var DropdownMenuLabel = React2__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
881
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
882
|
+
{
|
|
883
|
+
ref,
|
|
884
|
+
className: cn(
|
|
885
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
886
|
+
inset && "pl-8",
|
|
887
|
+
className
|
|
888
|
+
),
|
|
889
|
+
...props
|
|
890
|
+
}
|
|
891
|
+
));
|
|
892
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
893
|
+
var DropdownMenuSeparator = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
894
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
895
|
+
{
|
|
896
|
+
ref,
|
|
897
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
898
|
+
...props
|
|
899
|
+
}
|
|
900
|
+
));
|
|
901
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
|
|
140
902
|
function getInitials(name, email) {
|
|
141
903
|
if (name) {
|
|
142
904
|
const parts = name.trim().split(/\s+/);
|
|
@@ -148,7 +910,7 @@ function getInitials(name, email) {
|
|
|
148
910
|
return email[0].toUpperCase();
|
|
149
911
|
}
|
|
150
912
|
function NavUser({ user, adapter }) {
|
|
151
|
-
const { isMobile } =
|
|
913
|
+
const { isMobile } = useSidebar();
|
|
152
914
|
const router = adapter.useRouter();
|
|
153
915
|
const initials = getInitials(user.name, user.email);
|
|
154
916
|
const displayName = user.name || user.email;
|
|
@@ -161,16 +923,16 @@ function NavUser({ user, adapter }) {
|
|
|
161
923
|
router.refresh();
|
|
162
924
|
}
|
|
163
925
|
};
|
|
164
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
-
|
|
926
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
928
|
+
SidebarMenuButton,
|
|
167
929
|
{
|
|
168
930
|
size: "lg",
|
|
169
931
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
170
932
|
children: [
|
|
171
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
172
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
933
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image || void 0, alt: displayName }),
|
|
935
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "rounded-lg", children: initials })
|
|
174
936
|
] }),
|
|
175
937
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
176
938
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: displayName }),
|
|
@@ -181,30 +943,30 @@ function NavUser({ user, adapter }) {
|
|
|
181
943
|
}
|
|
182
944
|
) }),
|
|
183
945
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
184
|
-
|
|
946
|
+
DropdownMenuContent,
|
|
185
947
|
{
|
|
186
948
|
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
187
949
|
side: isMobile ? "bottom" : "right",
|
|
188
950
|
align: "end",
|
|
189
951
|
sideOffset: 4,
|
|
190
952
|
children: [
|
|
191
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
193
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
954
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
955
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image || void 0, alt: displayName }),
|
|
956
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "rounded-lg", children: initials })
|
|
195
957
|
] }),
|
|
196
958
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
197
959
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: displayName }),
|
|
198
960
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs", children: user.email })
|
|
199
961
|
] })
|
|
200
962
|
] }) }),
|
|
201
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
202
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
963
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
964
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
203
965
|
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.BadgeCheck, {}),
|
|
204
966
|
"Account"
|
|
205
967
|
] }) }),
|
|
206
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
207
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
968
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
969
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: handleSignOut, children: [
|
|
208
970
|
/* @__PURE__ */ jsxRuntime.jsx(LucideIcons.LogOut, {}),
|
|
209
971
|
"Log out"
|
|
210
972
|
] })
|
|
@@ -218,7 +980,7 @@ function TeamSwitcher({
|
|
|
218
980
|
organizationId,
|
|
219
981
|
adapter
|
|
220
982
|
}) {
|
|
221
|
-
const { isMobile } =
|
|
983
|
+
const { isMobile } = useSidebar();
|
|
222
984
|
const pathname = adapter.usePathname();
|
|
223
985
|
const router = adapter.useRouter();
|
|
224
986
|
const pathSegments = pathname.split("/");
|
|
@@ -239,7 +1001,7 @@ function TeamSwitcher({
|
|
|
239
1001
|
plan: org.plan || "Member"
|
|
240
1002
|
}));
|
|
241
1003
|
if (teamsWithLogo.length === 0) {
|
|
242
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuButton, { size: "lg", className: "cursor-default", children: [
|
|
243
1005
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex aspect-square size-8 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.GalleryVerticalEnd, { className: "size-4 text-muted-foreground" }) }),
|
|
244
1006
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
245
1007
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium text-muted-foreground", children: "No organizations" }),
|
|
@@ -248,9 +1010,9 @@ function TeamSwitcher({
|
|
|
248
1010
|
] }) }) });
|
|
249
1011
|
}
|
|
250
1012
|
if (!activeTeam) {
|
|
251
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
252
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
-
|
|
1013
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1015
|
+
SidebarMenuButton,
|
|
254
1016
|
{
|
|
255
1017
|
size: "lg",
|
|
256
1018
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
@@ -268,16 +1030,16 @@ function TeamSwitcher({
|
|
|
268
1030
|
}
|
|
269
1031
|
) }),
|
|
270
1032
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
271
|
-
|
|
1033
|
+
DropdownMenuContent,
|
|
272
1034
|
{
|
|
273
1035
|
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
274
1036
|
align: "start",
|
|
275
1037
|
side: isMobile ? "bottom" : "right",
|
|
276
1038
|
sideOffset: 4,
|
|
277
1039
|
children: [
|
|
278
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1040
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Select an organization" }),
|
|
279
1041
|
teamsWithLogo.map((team) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
280
|
-
|
|
1042
|
+
DropdownMenuItem,
|
|
281
1043
|
{
|
|
282
1044
|
onClick: () => handleTeamChange(team.id),
|
|
283
1045
|
className: "gap-2 p-2",
|
|
@@ -288,9 +1050,9 @@ function TeamSwitcher({
|
|
|
288
1050
|
},
|
|
289
1051
|
team.id
|
|
290
1052
|
)),
|
|
291
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1053
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
292
1054
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
293
|
-
|
|
1055
|
+
DropdownMenuItem,
|
|
294
1056
|
{
|
|
295
1057
|
className: "gap-2 p-2",
|
|
296
1058
|
onClick: () => router.push("/app/user/organizations"),
|
|
@@ -311,9 +1073,9 @@ function TeamSwitcher({
|
|
|
311
1073
|
if (!activeTeamWithLogo) {
|
|
312
1074
|
return null;
|
|
313
1075
|
}
|
|
314
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
315
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
-
|
|
1076
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1078
|
+
SidebarMenuButton,
|
|
317
1079
|
{
|
|
318
1080
|
size: "lg",
|
|
319
1081
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
@@ -328,16 +1090,16 @@ function TeamSwitcher({
|
|
|
328
1090
|
}
|
|
329
1091
|
) }),
|
|
330
1092
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
331
|
-
|
|
1093
|
+
DropdownMenuContent,
|
|
332
1094
|
{
|
|
333
1095
|
className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
|
|
334
1096
|
align: "start",
|
|
335
1097
|
side: isMobile ? "bottom" : "right",
|
|
336
1098
|
sideOffset: 4,
|
|
337
1099
|
children: [
|
|
338
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs", children: "Organizations" }),
|
|
339
1101
|
teamsWithLogo.map((team) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
340
|
-
|
|
1102
|
+
DropdownMenuItem,
|
|
341
1103
|
{
|
|
342
1104
|
onClick: () => handleTeamChange(team.id),
|
|
343
1105
|
className: "gap-2 p-2",
|
|
@@ -349,9 +1111,9 @@ function TeamSwitcher({
|
|
|
349
1111
|
},
|
|
350
1112
|
team.id
|
|
351
1113
|
)),
|
|
352
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
353
1115
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
354
|
-
|
|
1116
|
+
DropdownMenuItem,
|
|
355
1117
|
{
|
|
356
1118
|
className: "gap-2 p-2",
|
|
357
1119
|
onClick: () => router.push("/app/user/organizations"),
|
|
@@ -371,11 +1133,11 @@ function useNavigation({
|
|
|
371
1133
|
apiBaseUrl = "/api",
|
|
372
1134
|
enabled = true
|
|
373
1135
|
} = {}) {
|
|
374
|
-
const [items, setItems] =
|
|
375
|
-
const [organizations, setOrganizations] =
|
|
376
|
-
const [loading, setLoading] =
|
|
377
|
-
const [error, setError] =
|
|
378
|
-
|
|
1136
|
+
const [items, setItems] = React2.useState([]);
|
|
1137
|
+
const [organizations, setOrganizations] = React2.useState([]);
|
|
1138
|
+
const [loading, setLoading] = React2.useState(false);
|
|
1139
|
+
const [error, setError] = React2.useState(null);
|
|
1140
|
+
React2.useEffect(() => {
|
|
379
1141
|
if (!enabled || !organizationId) {
|
|
380
1142
|
setItems([]);
|
|
381
1143
|
setOrganizations([]);
|
|
@@ -417,18 +1179,32 @@ function useNavigation({
|
|
|
417
1179
|
}, [organizationId, apiBaseUrl, enabled]);
|
|
418
1180
|
return { items, organizations, loading, error };
|
|
419
1181
|
}
|
|
1182
|
+
var NextJSLink = ({ href, children, className }) => /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className, children });
|
|
420
1183
|
function AppSidebar({
|
|
421
1184
|
user,
|
|
422
|
-
adapter,
|
|
1185
|
+
adapter: externalAdapter,
|
|
423
1186
|
data,
|
|
424
1187
|
organizationId,
|
|
425
1188
|
apiBaseUrl,
|
|
426
1189
|
...props
|
|
427
1190
|
}) {
|
|
428
|
-
const pathname =
|
|
1191
|
+
const pathname = navigation.usePathname();
|
|
1192
|
+
const nextRouter = navigation.useRouter();
|
|
1193
|
+
const router = React2__namespace.useMemo(() => ({
|
|
1194
|
+
push: (path) => nextRouter.push(path),
|
|
1195
|
+
refresh: () => nextRouter.refresh()
|
|
1196
|
+
}), [nextRouter]);
|
|
1197
|
+
const internalAdapter = React2__namespace.useMemo(() => ({
|
|
1198
|
+
usePathname: () => pathname,
|
|
1199
|
+
useRouter: () => router,
|
|
1200
|
+
Link: NextJSLink,
|
|
1201
|
+
signOut: react.signOut
|
|
1202
|
+
}), [pathname, router]);
|
|
1203
|
+
const adapter = externalAdapter ?? internalAdapter;
|
|
1204
|
+
const currentPathname = adapter.usePathname();
|
|
429
1205
|
const isPropsMode = data !== void 0;
|
|
430
|
-
const pathSegments =
|
|
431
|
-
const isAppOrgRoute =
|
|
1206
|
+
const pathSegments = currentPathname.split("/");
|
|
1207
|
+
const isAppOrgRoute = currentPathname.startsWith("/app/") && pathSegments.length > 2 && pathSegments[2] !== "user";
|
|
432
1208
|
const pathOrgId = isAppOrgRoute ? pathSegments[2] : null;
|
|
433
1209
|
const {
|
|
434
1210
|
items: apiNavigationItems,
|
|
@@ -454,8 +1230,8 @@ function AppSidebar({
|
|
|
454
1230
|
}));
|
|
455
1231
|
}
|
|
456
1232
|
const displayNavigationItems = currentOrgId ? navigationItems : [];
|
|
457
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
458
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1233
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { collapsible: "icon", ...props, children: [
|
|
1234
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
459
1235
|
TeamSwitcher,
|
|
460
1236
|
{
|
|
461
1237
|
teams: organizations,
|
|
@@ -463,13 +1239,13 @@ function AppSidebar({
|
|
|
463
1239
|
adapter
|
|
464
1240
|
}
|
|
465
1241
|
) }),
|
|
466
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
467
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
468
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1242
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarContent, { children: navigationLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Loading..." }) : /* @__PURE__ */ jsxRuntime.jsx(NavMain, { items: displayNavigationItems, adapter }) }),
|
|
1243
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(NavUser, { user, adapter }) }),
|
|
1244
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarRail, {})
|
|
469
1245
|
] });
|
|
470
1246
|
}
|
|
471
1247
|
function createNextJSAdapter() {
|
|
472
|
-
const
|
|
1248
|
+
const NextJSLink2 = ({ href, children, className }) => /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className, children });
|
|
473
1249
|
return {
|
|
474
1250
|
usePathname: navigation.usePathname,
|
|
475
1251
|
useRouter: () => {
|
|
@@ -479,17 +1255,19 @@ function createNextJSAdapter() {
|
|
|
479
1255
|
refresh: () => router.refresh()
|
|
480
1256
|
};
|
|
481
1257
|
},
|
|
482
|
-
Link:
|
|
483
|
-
signOut: react
|
|
1258
|
+
Link: NextJSLink2,
|
|
1259
|
+
signOut: react.signOut
|
|
484
1260
|
};
|
|
485
1261
|
}
|
|
486
1262
|
|
|
487
1263
|
exports.AppSidebar = AppSidebar;
|
|
488
1264
|
exports.NavMain = NavMain;
|
|
489
1265
|
exports.NavUser = NavUser;
|
|
1266
|
+
exports.SidebarProvider = SidebarProvider;
|
|
490
1267
|
exports.TeamSwitcher = TeamSwitcher;
|
|
491
1268
|
exports.createNextJSAdapter = createNextJSAdapter;
|
|
492
1269
|
exports.getIconComponent = getIconComponent;
|
|
493
1270
|
exports.useNavigation = useNavigation;
|
|
1271
|
+
exports.useSidebar = useSidebar;
|
|
494
1272
|
//# sourceMappingURL=index.js.map
|
|
495
1273
|
//# sourceMappingURL=index.js.map
|