@yimingliao/cms 0.0.106 → 0.0.107

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.
@@ -491,6 +491,13 @@ function formatDateTime(input) {
491
491
  return dateTimeFormatter.format(date);
492
492
  }
493
493
 
494
+ // src/shared/utils/join-url.ts
495
+ function joinUrl(...parts) {
496
+ return parts.filter(Boolean).map(
497
+ (part, i) => i === 0 ? part.replace(/\/+$/, "") : part.replace(/^\/+|\/+$/g, "")
498
+ ).join("/");
499
+ }
500
+
494
501
  // src/shared/units.ts
495
502
  var SIZE = {
496
503
  BYTE: 1,
@@ -501,4 +508,4 @@ var SIZE = {
501
508
  PB: 1024 ** 5
502
509
  };
503
510
 
504
- export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd };
511
+ export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, joinUrl, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd };
@@ -4,11 +4,13 @@ import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
5
5
  import * as _tanstack_query_core from '@tanstack/query-core';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
+ import { ThemeProvider as ThemeProvider$1 } from 'next-themes';
8
+ import * as React$1 from 'react';
9
+ import { HTMLAttributes, ReactNode, ComponentProps, InputHTMLAttributes, Dispatch, SetStateAction } from 'react';
7
10
  import { c as createVerifyAction, a as createSignInAction, b as createVerifyEmailAction, d as createEmailUnverifiedAction, e as createForgotPasswordAction, f as createResetPasswordAction, g as createChangePasswordAction } from '../create-reset-password-action-D6aTuuqO.js';
8
- import { U as UIStates, F as FormData, a as FormFieldController } from '../types-BUmWwzpD.js';
9
11
  import { LucideIcon } from 'lucide-react';
10
- import { B as ButtonProps$1, L as LabelProps } from '../label-BF4qxS03.js';
11
- import { ReactNode, ComponentProps, HTMLAttributes, InputHTMLAttributes, Dispatch, SetStateAction } from 'react';
12
+ import { S as Sidebar, B as ButtonProps$1, L as LabelProps } from '../sidebar-Dei7UxR1.js';
13
+ import { U as UIStates, F as FormData, a as FormFieldController } from '../types-BUmWwzpD.js';
12
14
  import { ClassValue } from 'clsx';
13
15
  import 'zod';
14
16
  import 'zod/v4/core';
@@ -21,9 +23,11 @@ import '@prisma/client';
21
23
  import 'nodemailer';
22
24
  import 'intor';
23
25
  import 'keyv';
26
+ import '@radix-ui/react-label';
24
27
  import 'class-variance-authority/types';
25
28
  import 'class-variance-authority';
26
- import '@radix-ui/react-label';
29
+ import '@radix-ui/react-separator';
30
+ import '@radix-ui/react-tooltip';
27
31
 
28
32
  interface FetchContext {
29
33
  input: string;
@@ -326,12 +330,44 @@ declare function AdminProvider({ children }: {
326
330
  }): react_jsx_runtime.JSX.Element;
327
331
  declare function useAdmin(): AdminContextValue;
328
332
 
333
+ declare function ThemeProvider({ children, ...props }: React$1.ComponentProps<typeof ThemeProvider$1>): react_jsx_runtime.JSX.Element;
334
+
329
335
  declare function createAdminInitializer({ useAdmin, useQuery, verifyAction, }: {
330
336
  useAdmin: () => AdminContextValue;
331
337
  useQuery: ReturnType<typeof createUseQuery>;
332
338
  verifyAction: ReturnType<typeof createVerifyAction>;
333
339
  }): () => null;
334
340
 
341
+ interface ContentContainerProps extends HTMLAttributes<HTMLDivElement> {
342
+ children?: ReactNode;
343
+ isNotFound?: boolean;
344
+ isFixHeight?: boolean;
345
+ }
346
+ declare function ContentContainer({ className, children, isNotFound, isFixHeight, ...props }: ContentContainerProps): react_jsx_runtime.JSX.Element;
347
+
348
+ declare function ContentSkeleton(): react_jsx_runtime.JSX.Element;
349
+
350
+ interface NavItem {
351
+ icon?: LucideIcon;
352
+ title?: string;
353
+ url?: string;
354
+ isSeparator?: boolean;
355
+ items?: NavItem[];
356
+ }
357
+ declare function NavMain({ items }: {
358
+ items: NavItem[];
359
+ }): react_jsx_runtime.JSX.Element;
360
+
361
+ declare function SidebarSkeleton({ ...props }: React$1.ComponentProps<typeof Sidebar>): react_jsx_runtime.JSX.Element;
362
+
363
+ declare function createNavbar({ webUrl, storageUrl, I18nSelector, ThemeSelector, SignOutButton, }: {
364
+ webUrl: string;
365
+ storageUrl: string;
366
+ I18nSelector: ReactNode;
367
+ ThemeSelector: ReactNode;
368
+ SignOutButton: ReactNode;
369
+ }): () => react_jsx_runtime.JSX.Element;
370
+
335
371
  interface PageHeaderTitleProps {
336
372
  icon?: LucideIcon;
337
373
  title?: ReactNode;
@@ -542,4 +578,4 @@ declare const cn: (...inputs: ClassValue[]) => string;
542
578
 
543
579
  declare function useDeviceInfo(): DeviceInfo | null;
544
580
 
545
- export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, MainFields, PageHeader, PasswordInput, ReturnButton, SearchInput, type ShowToastOption, SideFields, SlugField, Textarea, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin, useDeviceInfo };
581
+ export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ContentSkeleton, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, MainFields, type NavItem, NavMain, PageHeader, PasswordInput, ReturnButton, SearchInput, type ShowToastOption, SideFields, SidebarSkeleton, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin, useDeviceInfo };
@@ -1,14 +1,15 @@
1
- import { Button, Spinner, useParentPathname, cn, Separator, Label, InputGroup, InputGroupAddon, InputGroupInput, InputGroupButton, Textarea, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, isConfirm } from '../chunk-FLKUBNE4.js';
2
- export { cn, useDeviceInfo } from '../chunk-FLKUBNE4.js';
3
- import { ensureArray } from '../chunk-OAENV763.js';
1
+ import { cn, useSidebar, SidebarMenuSkeleton, SidebarInset, SIDEBAR_WIDTH, Skeleton, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Sidebar, Button, Spinner, useParentPathname, PAGE_HEADER_HEIGHT, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, InputGroup, InputGroupAddon, InputGroupInput, InputGroupButton, Textarea, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, DropdownMenu, DropdownMenuTrigger, Avatar, AvatarImage, AvatarFallback, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, DropdownMenuItem } from '../chunk-Q654SMCX.js';
2
+ export { cn, useDeviceInfo } from '../chunk-Q654SMCX.js';
3
+ import { ensureArray, findTranslation, joinUrl } from '../chunk-VSV6SQWC.js';
4
4
  import { toast } from 'sonner';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { useMutation, useQuery } from '@tanstack/react-query';
7
7
  import { createContext, useState, useContext, useEffect, createElement, useRef } from 'react';
8
+ import { ThemeProvider as ThemeProvider$1 } from 'next-themes';
8
9
  import { useTranslator } from 'intor/react';
9
- import { Undo2, Files, Asterisk, Eye, EyeOff, CircleX, CirclePlus, Search, Mail, Trash2, CopyCheck, CopyX, FileSymlink, FileX, FilePlus, FilePen, File, FileStack, FolderSearch, Lock, FolderCog, FileSpreadsheet, Archive, Binary, MapPinCheckInside, Star, House, CircleMinus } from 'lucide-react';
10
- import { useRouter, useSearchParams } from 'next/navigation';
10
+ import { ChevronRight, Undo2, SidebarIcon, House, SquareArrowOutUpRight, Files, Asterisk, Eye, EyeOff, CircleX, CirclePlus, Search, Mail, UserCircle, ChevronsUpDown, PenLine, Trash2, CopyCheck, CopyX, FileSymlink, FileX, FilePlus, FilePen, File, FileStack, FolderSearch, Lock, FolderCog, FileSpreadsheet, Archive, Binary, MapPinCheckInside, Star, CircleMinus } from 'lucide-react';
11
11
  import Link from 'next/link';
12
+ import { usePathname, useRouter, useSearchParams } from 'next/navigation';
12
13
 
13
14
  // src/client/infrastructure/fetch/smart-fetch.ts
14
15
  function createSmartFetch({
@@ -217,6 +218,22 @@ function useAdmin() {
217
218
  if (!ctx) throw new Error("useAdmin must be used within AdminProvider");
218
219
  return ctx;
219
220
  }
221
+ function ThemeProvider({
222
+ children,
223
+ ...props
224
+ }) {
225
+ return /* @__PURE__ */ jsx(
226
+ ThemeProvider$1,
227
+ {
228
+ attribute: "class",
229
+ defaultTheme: "system",
230
+ enableSystem: true,
231
+ disableTransitionOnChange: true,
232
+ ...props,
233
+ children
234
+ }
235
+ );
236
+ }
220
237
  function createAdminInitializer({
221
238
  useAdmin: useAdmin2,
222
239
  useQuery,
@@ -240,29 +257,205 @@ function createAdminInitializer({
240
257
  return null;
241
258
  };
242
259
  }
243
-
244
- // src/client/interfaces/styles/constants.ts
245
- var PAGE_HEADER_HEIGHT = 56;
246
- var FORM_SIDE_FIELDS_WIDTH = 320;
247
- var FORM_MIDDLE_GAP_WIDTH = 24;
248
- function PageHeaderTitle({
249
- icon,
250
- title,
251
- subtitle,
260
+ function ContentContainer({
261
+ className = "",
252
262
  children,
253
- leftChildren,
254
- className
263
+ isNotFound = false,
264
+ isFixHeight,
265
+ ...props
255
266
  }) {
256
- return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", className), children: [
257
- leftChildren,
258
- icon && createElement(icon),
259
- /* @__PURE__ */ jsxs("div", { className: "flex-center w-fit gap-3 whitespace-nowrap", children: [
260
- subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: subtitle }),
261
- /* @__PURE__ */ jsx("p", { className: "scroll-m-20 text-xl font-semibold tracking-tight", children: title })
262
- ] }),
263
- children
267
+ const { t } = useTranslator();
268
+ const ABOVE_HEIGHT = NAVBAR_HEIGHT + PAGE_HEADER_HEIGHT;
269
+ return /* @__PURE__ */ jsx(
270
+ "div",
271
+ {
272
+ style: {
273
+ height: isFixHeight ? `calc(100vh - ${ABOVE_HEIGHT}px)` : "auto"
274
+ },
275
+ className: cn(
276
+ className,
277
+ "relative",
278
+ "flex flex-col gap-4",
279
+ "px-6 pt-6",
280
+ isFixHeight ? "pb-6" : "flex-1 pb-64"
281
+ ),
282
+ ...props,
283
+ children: isNotFound ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: t("ui.no-data.text") }) : children
284
+ }
285
+ );
286
+ }
287
+ function ContentSkeleton() {
288
+ const { open } = useSidebar();
289
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1", children: [
290
+ /* @__PURE__ */ jsx(SidebarMenuSkeleton, {}),
291
+ /* @__PURE__ */ jsx(
292
+ SidebarInset,
293
+ {
294
+ style: { width: open ? `calc(100% - ${SIDEBAR_WIDTH})` : "100%" },
295
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-6", children: [
296
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-96" }),
297
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-72" }),
298
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-64" })
299
+ ] })
300
+ }
301
+ )
264
302
  ] });
265
303
  }
304
+ var getMainPath = (path) => "/" + path.split("/").slice(3).filter(Boolean).join("/");
305
+ var toSegments = (path) => path.split("/").filter(Boolean);
306
+ var isSegmentMatch = (current, target) => {
307
+ const currentSeg = toSegments(current);
308
+ const targetSeg = toSegments(target);
309
+ if (targetSeg.length > currentSeg.length) return false;
310
+ return targetSeg.every((seg, i) => currentSeg[i] === seg);
311
+ };
312
+ function NavMain({ items }) {
313
+ const pathname = usePathname();
314
+ const [openItems, setOpenItems] = useState([]);
315
+ const toggleItem = (title, open) => {
316
+ setOpenItems(
317
+ (prev) => open ? [...prev, title] : prev.filter((t) => t !== title)
318
+ );
319
+ };
320
+ const parsedPathname = getMainPath(pathname);
321
+ useEffect(() => {
322
+ const matched = items.filter(
323
+ (item) => item.url ? isSegmentMatch(parsedPathname, getMainPath(item.url)) : false
324
+ ).map((item) => item.title || "");
325
+ queueMicrotask(() => setOpenItems(matched));
326
+ }, [parsedPathname, items]);
327
+ return /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item, index) => {
328
+ const isOpen = openItems.includes(item.title || "");
329
+ const parsedUrl = getMainPath(item.url || "");
330
+ const isCurrentPath = item.url ? isSegmentMatch(parsedPathname, parsedUrl) : false;
331
+ return /* @__PURE__ */ jsx(
332
+ Collapsible,
333
+ {
334
+ asChild: true,
335
+ open: isOpen,
336
+ onOpenChange: (open) => toggleItem(item.title || "", open),
337
+ children: /* @__PURE__ */ jsxs(SidebarMenuItem, { className: "[&>button]:top-2 [&>button]:size-6", children: [
338
+ !item.isSeparator ? /* @__PURE__ */ jsx(
339
+ SidebarMenuButton,
340
+ {
341
+ asChild: true,
342
+ size: "md",
343
+ isActive: isCurrentPath,
344
+ children: /* @__PURE__ */ jsxs(Link, { href: item.url || "", children: [
345
+ item.icon && /* @__PURE__ */ jsx(item.icon, {}),
346
+ /* @__PURE__ */ jsx("span", { children: item.title })
347
+ ] })
348
+ }
349
+ ) : /* @__PURE__ */ jsx(Separator, {}),
350
+ item.items?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
351
+ /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(SidebarMenuAction, { className: "data-[state=open]:rotate-90", children: [
352
+ /* @__PURE__ */ jsx(ChevronRight, {}),
353
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle" })
354
+ ] }) }),
355
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem, index2) => {
356
+ const parsedPathname2 = getMainPath(pathname);
357
+ const parsedUrl2 = getMainPath(subItem.url || "");
358
+ const isCurrentPath2 = subItem.url ? isSegmentMatch(parsedPathname2, parsedUrl2) : false;
359
+ return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: !subItem.isSeparator ? /* @__PURE__ */ jsx(
360
+ SidebarMenuSubButton,
361
+ {
362
+ asChild: true,
363
+ size: "lg",
364
+ isActive: isCurrentPath2,
365
+ children: /* @__PURE__ */ jsxs(Link, { href: subItem.url || "", children: [
366
+ subItem.icon && /* @__PURE__ */ jsx(subItem.icon, {}),
367
+ /* @__PURE__ */ jsx("span", { children: subItem.title })
368
+ ] })
369
+ }
370
+ ) : /* @__PURE__ */ jsx(Separator, {}) }, index2);
371
+ }) }) })
372
+ ] }) : null
373
+ ] })
374
+ },
375
+ index
376
+ );
377
+ }) }) });
378
+ }
379
+ function SidebarSkeleton({
380
+ ...props
381
+ }) {
382
+ return /* @__PURE__ */ jsx(
383
+ Sidebar,
384
+ {
385
+ className: "top-(--header-height) h-[calc(100svh-var(--header-height))]!",
386
+ ...props,
387
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 p-3", children: [
388
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
389
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
390
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
391
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })
392
+ ] })
393
+ }
394
+ );
395
+ }
396
+
397
+ // src/constants/keys/auth.ts
398
+ var AUTH_KEYS = {
399
+ signIn: { key: "sign-in" },
400
+ forgotPassword: { key: "forgot-password" },
401
+ changePassword: { key: "change-password" }};
402
+
403
+ // src/constants/keys/main.ts
404
+ var MAIN_KEYS = {
405
+ dashboard: { key: "dashboard" },
406
+ cmsSettings: { key: "cms-settings" }};
407
+
408
+ // src/constants/keys/resources.ts
409
+ var RESOURCES_KEYS = {
410
+ admin: { key: "admin" }};
411
+
412
+ // src/constants/keys/index.ts
413
+ var KEYS = {
414
+ main: MAIN_KEYS,
415
+ auth: AUTH_KEYS,
416
+ resources: RESOURCES_KEYS};
417
+
418
+ // src/constants/paths/cms-path.ts
419
+ var CMS_PATH = "/cms";
420
+
421
+ // src/constants/paths/main.ts
422
+ var MAIN_PATHS = {
423
+ dashboard: {
424
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}`
425
+ },
426
+ cmsSettings: {
427
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.cmsSettings.key}`
428
+ }};
429
+
430
+ // src/constants/paths/auth.ts
431
+ var AUTH_PATHS = {
432
+ signIn: {
433
+ path: `${CMS_PATH}/${KEYS.auth.signIn.key}`
434
+ },
435
+ forgotPassword: {
436
+ path: `${CMS_PATH}/${KEYS.auth.forgotPassword.key}`
437
+ },
438
+ changePassword: {
439
+ path: `${MAIN_PATHS.dashboard.path}/${KEYS.auth.changePassword.key}`
440
+ }
441
+ };
442
+
443
+ // src/constants/paths/resources.ts
444
+ var RESOURCES_PATHS = {
445
+ admin: {
446
+ path: `${MAIN_PATHS.cmsSettings.path}/${KEYS.resources.admin.key}`
447
+ }};
448
+
449
+ // src/constants/paths/index.ts
450
+ var PATHS = {
451
+ main: MAIN_PATHS,
452
+ auth: AUTH_PATHS,
453
+ resources: RESOURCES_PATHS
454
+ };
455
+
456
+ // src/constants/anchor.ts
457
+ var NEW_TAB_TARGET = "_blank";
458
+ var NEW_TAB_REL = "noopener noreferrer";
266
459
  function Button2({
267
460
  icon,
268
461
  href,
@@ -343,6 +536,141 @@ function ReturnButton({
343
536
  }
344
537
  );
345
538
  }
539
+ function NavUser({
540
+ storageUrl,
541
+ admin,
542
+ isLoading = false,
543
+ SignOutButton
544
+ }) {
545
+ const { t, locale } = useTranslator();
546
+ const { name } = findTranslation(admin?.translations, locale);
547
+ if (isLoading)
548
+ return /* @__PURE__ */ jsx(Button2, { variant: "outline", size: "icon", disabled: true, className: "w-64", children: /* @__PURE__ */ jsx(Spinner, {}) });
549
+ if (!admin)
550
+ return /* @__PURE__ */ jsx(Button2, { variant: "outline", size: "icon", disabled: true, className: "w-64", children: /* @__PURE__ */ jsx(UserCircle, { className: "size-4" }) });
551
+ return /* @__PURE__ */ jsx(SidebarMenu, { className: "w-64", children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
552
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
553
+ SidebarMenuButton,
554
+ {
555
+ size: "lg",
556
+ className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
557
+ disabled: isLoading,
558
+ children: [
559
+ /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
560
+ admin.avatarImage?.key && /* @__PURE__ */ jsx(
561
+ AvatarImage,
562
+ {
563
+ src: joinUrl(storageUrl, admin.avatarImage?.key),
564
+ alt: name ?? ""
565
+ }
566
+ ),
567
+ /* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg" })
568
+ ] }),
569
+ /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
570
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
571
+ /* @__PURE__ */ jsx("span", { className: "truncate text-xs", children: admin.email })
572
+ ] }),
573
+ /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
574
+ ]
575
+ }
576
+ ) }),
577
+ /* @__PURE__ */ jsxs(
578
+ DropdownMenuContent,
579
+ {
580
+ className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
581
+ side: "bottom",
582
+ align: "end",
583
+ sideOffset: 4,
584
+ children: [
585
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
586
+ /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
587
+ admin.avatarImage?.key && /* @__PURE__ */ jsx(
588
+ AvatarImage,
589
+ {
590
+ src: joinUrl(storageUrl, admin.avatarImage?.key),
591
+ alt: name ?? ""
592
+ }
593
+ ),
594
+ /* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg" })
595
+ ] }),
596
+ /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
597
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
598
+ /* @__PURE__ */ jsx("span", { className: "truncate text-xs", children: admin.email })
599
+ ] })
600
+ ] }) }),
601
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
602
+ /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(Link, { href: PATHS.auth.changePassword.path, children: /* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
603
+ /* @__PURE__ */ jsx(PenLine, {}),
604
+ t("auth.change-password.text")
605
+ ] }) }) }),
606
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
607
+ SignOutButton
608
+ ]
609
+ }
610
+ )
611
+ ] }) }) });
612
+ }
613
+ function createNavbar({
614
+ webUrl,
615
+ storageUrl,
616
+ I18nSelector,
617
+ ThemeSelector,
618
+ SignOutButton
619
+ }) {
620
+ return function Navbar() {
621
+ const { toggleSidebar } = useSidebar();
622
+ const { admin, isLoading } = useAdmin();
623
+ const { t } = useTranslator();
624
+ return /* @__PURE__ */ jsx("header", { className: "bg-background sticky top-0 z-50 flex w-full items-center border-b", children: /* @__PURE__ */ jsxs("div", { className: "flex h-(--header-height) w-full items-center gap-2 px-2", children: [
625
+ /* @__PURE__ */ jsx(
626
+ Button2,
627
+ {
628
+ className: "h-8 w-8",
629
+ variant: "ghost",
630
+ size: "icon",
631
+ onClick: toggleSidebar,
632
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
633
+ }
634
+ ),
635
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mr-2 h-4" }),
636
+ /* @__PURE__ */ jsx(Button2, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsx(Link, { href: PATHS.main.dashboard.path, children: /* @__PURE__ */ jsx(House, {}) }) }),
637
+ /* @__PURE__ */ jsx(Button2, { variant: "outline", asChild: true, children: /* @__PURE__ */ jsxs(Link, { href: webUrl, target: NEW_TAB_TARGET, rel: NEW_TAB_REL, children: [
638
+ /* @__PURE__ */ jsx(SquareArrowOutUpRight, {}),
639
+ t("ui.layout.navbar.website-homepage.text")
640
+ ] }) }),
641
+ /* @__PURE__ */ jsx("div", { className: "ml-auto" }),
642
+ I18nSelector,
643
+ ThemeSelector,
644
+ /* @__PURE__ */ jsx(
645
+ NavUser,
646
+ {
647
+ storageUrl,
648
+ SignOutButton,
649
+ admin,
650
+ isLoading
651
+ }
652
+ )
653
+ ] }) });
654
+ };
655
+ }
656
+ function PageHeaderTitle({
657
+ icon,
658
+ title,
659
+ subtitle,
660
+ children,
661
+ leftChildren,
662
+ className
663
+ }) {
664
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", className), children: [
665
+ leftChildren,
666
+ icon && createElement(icon),
667
+ /* @__PURE__ */ jsxs("div", { className: "flex-center w-fit gap-3 whitespace-nowrap", children: [
668
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: subtitle }),
669
+ /* @__PURE__ */ jsx("p", { className: "scroll-m-20 text-xl font-semibold tracking-tight", children: title })
670
+ ] }),
671
+ children
672
+ ] });
673
+ }
346
674
  function createIndexPreset(ctx) {
347
675
  const { props, t } = ctx;
348
676
  return {
@@ -1509,60 +1837,6 @@ function ControlFields({
1509
1837
  }
1510
1838
  ) });
1511
1839
  }
1512
-
1513
- // src/constants/keys/auth.ts
1514
- var AUTH_KEYS = {
1515
- signIn: { key: "sign-in" },
1516
- forgotPassword: { key: "forgot-password" }};
1517
-
1518
- // src/constants/keys/main.ts
1519
- var MAIN_KEYS = {
1520
- dashboard: { key: "dashboard" },
1521
- cmsSettings: { key: "cms-settings" }};
1522
-
1523
- // src/constants/keys/resources.ts
1524
- var RESOURCES_KEYS = {
1525
- admin: { key: "admin" }};
1526
-
1527
- // src/constants/keys/index.ts
1528
- var KEYS = {
1529
- main: MAIN_KEYS,
1530
- auth: AUTH_KEYS,
1531
- resources: RESOURCES_KEYS};
1532
-
1533
- // src/constants/paths/cms-path.ts
1534
- var CMS_PATH = "/cms";
1535
-
1536
- // src/constants/paths/main.ts
1537
- var MAIN_PATHS = {
1538
- dashboard: {
1539
- path: `${CMS_PATH}/${KEYS.main.dashboard.key}`
1540
- },
1541
- cmsSettings: {
1542
- path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.cmsSettings.key}`
1543
- }};
1544
-
1545
- // src/constants/paths/auth.ts
1546
- var AUTH_PATHS = {
1547
- signIn: {
1548
- path: `${CMS_PATH}/${KEYS.auth.signIn.key}`
1549
- },
1550
- forgotPassword: {
1551
- path: `${CMS_PATH}/${KEYS.auth.forgotPassword.key}`
1552
- }};
1553
-
1554
- // src/constants/paths/resources.ts
1555
- var RESOURCES_PATHS = {
1556
- admin: {
1557
- path: `${MAIN_PATHS.cmsSettings.path}/${KEYS.resources.admin.key}`
1558
- }};
1559
-
1560
- // src/constants/paths/index.ts
1561
- var PATHS = {
1562
- main: MAIN_PATHS,
1563
- auth: AUTH_PATHS,
1564
- resources: RESOURCES_PATHS
1565
- };
1566
1840
  function createSignInPage({
1567
1841
  useCommand,
1568
1842
  signInAction
@@ -1986,4 +2260,4 @@ function createChangePasswordPage({
1986
2260
  };
1987
2261
  }
1988
2262
 
1989
- export { AdminProvider, ArrayInput, Button2 as Button, Checkbox, ControlFields, Field, FieldBody, FieldsContainer, Form, IndexField, Input, MainFields, PageHeader, PasswordInput, ReturnButton, SearchInput, SideFields, SlugField, Textarea2 as Textarea, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin };
2263
+ export { AdminProvider, ArrayInput, Button2 as Button, Checkbox, ContentContainer, ContentSkeleton, ControlFields, Field, FieldBody, FieldsContainer, Form, IndexField, Input, MainFields, NavMain, PageHeader, PasswordInput, ReturnButton, SearchInput, SideFields, SidebarSkeleton, SlugField, Textarea2 as Textarea, ThemeProvider, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin };
@@ -1,12 +1,17 @@
1
- import { a as Button } from '../../label-BF4qxS03.js';
2
- export { B as ButtonProps, b as Label, L as LabelProps } from '../../label-BF4qxS03.js';
1
+ import { a as Button } from '../../sidebar-Dei7UxR1.js';
2
+ export { B as ButtonProps, I as Input, b as Label, L as LabelProps, c as SIDEBAR_COOKIE_NAME, d as Separator, S as Sidebar, e as SidebarContent, f as SidebarFooter, g as SidebarGroup, h as SidebarGroupAction, i as SidebarGroupContent, j as SidebarGroupLabel, k as SidebarHeader, l as SidebarInput, m as SidebarInset, n as SidebarMenu, o as SidebarMenuAction, p as SidebarMenuBadge, q as SidebarMenuButton, r as SidebarMenuItem, s as SidebarMenuSkeleton, t as SidebarMenuSub, u as SidebarMenuSubButton, v as SidebarMenuSubItem, w as SidebarProvider, x as SidebarRail, y as SidebarSeparator, z as SidebarTrigger, T as Tooltip, A as TooltipContent, C as TooltipProvider, D as TooltipTrigger, E as useSidebar } from '../../sidebar-Dei7UxR1.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import { ComponentProps } from 'react';
6
6
  import * as class_variance_authority_types from 'class-variance-authority/types';
7
7
  import { VariantProps } from 'class-variance-authority';
8
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
8
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
9
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
10
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
11
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
9
12
  import '@radix-ui/react-label';
13
+ import '@radix-ui/react-separator';
14
+ import '@radix-ui/react-tooltip';
10
15
 
11
16
  declare function Card({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
12
17
  declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
@@ -16,11 +21,9 @@ declare function CardAction({ className, ...props }: React.ComponentProps<"div">
16
21
  declare function CardContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
17
22
  declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
18
23
 
19
- declare function Input({ className, type, ...props }: React.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
20
-
21
24
  declare function InputGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
22
25
  declare const inputGroupAddonVariants: (props?: ({
23
- align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
26
+ align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
24
27
  } & class_variance_authority_types.ClassProp) | undefined) => string;
25
28
  declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): react_jsx_runtime.JSX.Element;
26
29
  declare const inputGroupButtonVariants: (props?: ({
@@ -35,6 +38,48 @@ declare function Spinner({ className, ...props }: ComponentProps<"svg">): react_
35
38
 
36
39
  declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
37
40
 
38
- declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): react_jsx_runtime.JSX.Element;
41
+ declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): react_jsx_runtime.JSX.Element;
42
+ declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
43
+ declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): react_jsx_runtime.JSX.Element;
44
+ declare function SheetContent({ className, children, side, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
45
+ side?: "top" | "right" | "bottom" | "left";
46
+ }): react_jsx_runtime.JSX.Element;
47
+ declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
48
+ declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
49
+ declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): react_jsx_runtime.JSX.Element;
50
+ declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): react_jsx_runtime.JSX.Element;
51
+
52
+ declare function Skeleton({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
53
+
54
+ declare function Collapsible({ ...props }: ComponentProps<typeof CollapsiblePrimitive.Root>): react_jsx_runtime.JSX.Element;
55
+ declare function CollapsibleTrigger({ ...props }: ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): react_jsx_runtime.JSX.Element;
56
+ declare function CollapsibleContent({ ...props }: ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): react_jsx_runtime.JSX.Element;
57
+
58
+ declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): react_jsx_runtime.JSX.Element;
59
+ declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): react_jsx_runtime.JSX.Element;
60
+ declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
61
+ declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
62
+ declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): react_jsx_runtime.JSX.Element;
63
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
64
+ inset?: boolean;
65
+ variant?: "default" | "destructive";
66
+ }): react_jsx_runtime.JSX.Element;
67
+ declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): react_jsx_runtime.JSX.Element;
68
+ declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): react_jsx_runtime.JSX.Element;
69
+ declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): react_jsx_runtime.JSX.Element;
70
+ declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
71
+ inset?: boolean;
72
+ }): react_jsx_runtime.JSX.Element;
73
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): react_jsx_runtime.JSX.Element;
74
+ declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
75
+ declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): react_jsx_runtime.JSX.Element;
76
+ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
77
+ inset?: boolean;
78
+ }): react_jsx_runtime.JSX.Element;
79
+ declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
80
+
81
+ declare function Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>): react_jsx_runtime.JSX.Element;
82
+ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): react_jsx_runtime.JSX.Element;
83
+ declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): react_jsx_runtime.JSX.Element;
39
84
 
40
- export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Separator, Spinner, Textarea };
85
+ export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Skeleton, Spinner, Textarea };